/** * Set the sorting mode. * @param sortingMode one of {@link #UNSORTED} or {@link #SORTED_BY_NAMES}. {@link #SORTED_BY_TYPES} is * no longer supported. * @throws PropertyVetoException if a value other than one of the defined sorting modes is set */ public void setSortingMode(int sortingMode) throws PropertyVetoException { try { table.getPropertySetModel().setComparator(PropUtils.getComparator(sortingMode)); this.sortingMode = sortingMode; psheet.setMarginPainted(getSortingMode() == UNSORTED); PropUtils.putSortOrder (sortingMode); } catch (IllegalArgumentException iae) { throw new PropertyVetoException( NbBundle.getMessage( PropertySheet.class, "EXC_Unknown_sorting_mode"), new PropertyChangeEvent(this, PROPERTY_SORTING_MODE, new Integer(0), new Integer(sortingMode)) ); //NOI18N } }
/** * Set the sorting mode. * @param sortingMode one of {@link #UNSORTED} or {@link #SORTED_BY_NAMES}. {@link #SORTED_BY_TYPES} is * no longer supported. * @throws PropertyVetoException if a value other than one of the defined sorting modes is set */ public void setSortingMode(int sortingMode) throws PropertyVetoException { try { table.getPropertySetModel().setComparator(PropUtils.getComparator(sortingMode)); this.sortingMode = sortingMode; psheet.setMarginPainted(getSortingMode() == UNSORTED); PropUtils.putSortOrder (sortingMode); } catch (IllegalArgumentException iae) { throw new PropertyVetoException( NbBundle.getMessage( PropertySheet.class, "EXC_Unknown_sorting_mode"), new PropertyChangeEvent(this, PROPERTY_SORTING_MODE, new Integer(0), new Integer(sortingMode)) ); //NOI18N } }
final void showPopup (Point p) { JMenuItem helpItem=new JMenuItem(); JRadioButtonMenuItem sortNamesItem = new JRadioButtonMenuItem(); JRadioButtonMenuItem unsortedItem = new JRadioButtonMenuItem(); JCheckBoxMenuItem descriptionItem = new JCheckBoxMenuItem(); JPopupMenu popup = new JPopupMenu(); unsortedItem.setSelected(getSortingMode() == UNSORTED); sortNamesItem.setSelected(getSortingMode() == SORTED_BY_NAMES); helpAction.checkContext(); helpItem.setAction(helpAction); sortNamesItem.setAction (new MutableAction (MutableAction.SORT_NAMES, this)); unsortedItem.setAction (new MutableAction (MutableAction.UNSORT, this)); descriptionItem.setAction (new MutableAction (MutableAction.SHOW_DESCRIPTION, this)); descriptionItem.setSelected (isDescriptionVisible()); popup.add (unsortedItem); popup.add (sortNamesItem); popup.add (new JSeparator()); popup.add (descriptionItem); popup.add (new JSeparator()); popup.add (helpItem); popup.show(psheet, p.x, p.y); }
final void showPopup (Point p) { JMenuItem helpItem=new JMenuItem(); JRadioButtonMenuItem sortNamesItem = new JRadioButtonMenuItem(); JRadioButtonMenuItem unsortedItem = new JRadioButtonMenuItem(); JCheckBoxMenuItem descriptionItem = new JCheckBoxMenuItem(); JPopupMenu popup = new JPopupMenu(); unsortedItem.setSelected(getSortingMode() == UNSORTED); sortNamesItem.setSelected(getSortingMode() == SORTED_BY_NAMES); helpAction.checkContext(); helpItem.setAction(helpAction); sortNamesItem.setAction (new MutableAction (MutableAction.SORT_NAMES, this)); unsortedItem.setAction (new MutableAction (MutableAction.UNSORT, this)); descriptionItem.setAction (new MutableAction (MutableAction.SHOW_DESCRIPTION, this)); descriptionItem.setSelected (isDescriptionVisible()); popup.add (unsortedItem); popup.add (sortNamesItem); popup.add (new JSeparator()); popup.add (descriptionItem); popup.add (new JSeparator()); popup.add (helpItem); popup.show(psheet, p.x, p.y); }
popup = new JPopupMenu(); unsortedItem.setSelected(getSortingMode() == UNSORTED); sortNamesItem.setSelected(getSortingMode() == SORTED_BY_NAMES); helpAction.checkContext(); helpItem.setAction(helpAction);