protected boolean canUngroup() { return getView() != null && getView().getSelectionCount() == 1 && prototype != null && getView().getSelectedFigures().iterator().next().getClass().equals( prototype.getClass()); }
public void selectionChanged(FigureSelectionEvent evt) { setEnabled(getView().getSelectionCount() == 1); } }
public void selectionChanged(FigureSelectionEvent evt) { setEnabled(getView().getSelectionCount() == 1); } }
protected boolean canUngroup() { return getView() != null && getView().getSelectionCount() == 1 && prototype != null && getView().getSelectedFigures().iterator().next().getClass().equals( prototype.getClass()) && ((CompositeFigure) getView().getSelectedFigures().iterator().next()).getChildCount() > 1; }
protected boolean canGroup() { return getView() != null && getView().getSelectionCount() > 1; }
protected boolean canGroup() { boolean canCombine = getView().getSelectionCount() > 1; if (canCombine) { for (Figure f : getView().getSelectedFigures()) { if (!(f instanceof SVGPathFigure)) { canCombine = false; break; } } } return canCombine; }
@Override protected boolean canGroup() { boolean canCombine = getView().getSelectionCount() > 1; if (canCombine) { for (Figure f : getView().getSelectedFigures()) { if (!(f instanceof ODGPathFigure)) { canCombine = false; break; } } } return canCombine; }
@Override public int getSourceActions(JComponent c) { int retValue; if (c instanceof DrawingView) { DrawingView view = (DrawingView) c; if (DEBUG) { System.out.println("DefaultDrawingViewTransferHandler .getSourceActions outputFormats.size=" + view.getDrawing().getOutputFormats().size()); } retValue = (view.getDrawing().getOutputFormats().size() > 0 && view.getSelectionCount() > 0) ? COPY | MOVE : NONE; } else { retValue = super.getSourceActions(c); } if (DEBUG) { System.out.println("DefaultDrawingViewTransferHandler .getSourceActions:" + retValue); } return retValue; }
@Override public void show(Component invoker, int x, int y) { if (colorChooser == null) { initialize(); } Color c; if (editor.getActiveView() != null && editor.getActiveView().getSelectionCount() > 0) { c = editor.getActiveView().getSelectedFigures().iterator().next().get(attributeKey); } else { c = editor.getDefaultAttribute(attributeKey); } colorChooser.setColor(c == null ? new Color(0, true) : c); super.show(invoker, x, y); }
@Override protected void updateEnabledState() { setEnabled(getEditor().isEnabled()); if (getView() != null && colorChooser != null && popupMenu != null) { colorChooser.setEnabled(getView().getSelectionCount() > 0); popupMenu.setEnabled(getView().getSelectionCount() > 0); isUpdating++; if (getView().getSelectionCount() > 0 /*&& colorChooser.isShowing()*/) { for (Figure f : getView().getSelectedFigures()) { Color figureColor = f.get(key); colorChooser.setColor(figureColor==null?new Color(0,true):figureColor); break; } } isUpdating--; } }
@Override protected void updateEnabledState() { setEnabled(getEditor().isEnabled()); if (getView() != null && fontChooser != null && popupMenu != null) { fontChooser.setEnabled(getView().getSelectionCount() > 0); popupMenu.setEnabled(getView().getSelectionCount() > 0); isUpdating++; if (getView().getSelectionCount() > 0 /*&& fontChooser.isShowing()*/) { for (Figure f : getView().getSelectedFigures()) { if (f instanceof TextHolderFigure) { TextHolderFigure thf = (TextHolderFigure) f; fontChooser.setSelectedFont(thf.getFont()); break; } } } isUpdating--; } }
@Override protected void updateEnabledState() { setEnabled(getEditor() != null && getEditor().isEnabled()); if (getView() != null && colorChooser != null && popupMenu != null) { colorChooser.setEnabled(getView().getSelectionCount() > 0); popupMenu.setEnabled(getView().getSelectionCount() > 0); isUpdating++; Color drawingColor = getView().getDrawing().get(key); colorChooser.setColor(drawingColor == null ? new Color(0, true) : drawingColor); isUpdating--; } }
@Override public void updateEnabledState() { if (getView() != null) { setEnabled(getView().isEnabled() && getView().getSelectionCount() > 1 ); } else { setEnabled(false); } } @Override
/** Updates the enabled state of this action to reflect the enabled state * of the active {@code DrawingView}. If no drawing view is active, this * action is disabled. */ protected void updateEnabledState() { if (getView() != null) { setEnabled(getView().isEnabled() && getView().getSelectionCount() > 0); } else { setEnabled(false); } }
public void updateVisibility() { boolean newValue = editor != null && editor.getActiveView() != null && (isVisibleIfCreationTool && editor.getTool() != null && !(editor.getTool() instanceof SelectionTool) || editor.getActiveView().getSelectionCount() >= minSelectionCount); JComponent component = weakRef.get(); if (component == null) { dispose(); return; } if (newValue != component.isVisible()) { component.setVisible(newValue); // The following is needed to trick BoxLayout if (newValue) { component.setPreferredSize(null); } else { component.setPreferredSize(new Dimension(0, 0)); } component.revalidate(); } }
@Override public void actionPerformed(java.awt.event.ActionEvent evt) { if (getView() != null && getView().getSelectionCount() > 0) { ResourceBundleUtil labels = ResourceBundleUtil.getBundle("org.jhotdraw.draw.Labels"); CompositeEdit edit = new CompositeEdit(labels.getString("drawAttributeChange")); fireUndoableEditHappened(edit); changeAttribute(); fireUndoableEditHappened(edit); } }
@Override public void actionPerformed(java.awt.event.ActionEvent e) { if (getView().getSelectionCount() > 0) {