@Override public DrawingView getActiveView() { return (target == null) ? null : target.getActiveView(); }
public DrawingView getView() { return editor.getActiveView(); } public DrawingEditor getEditor() {
protected DrawingView getView() { return editor.getActiveView(); }
protected DrawingView getView() { return editor.getActiveView(); }
@Nullable protected DrawingView getView() { return (editor == null) ? null : editor.getActiveView(); }
@Nullable public DrawingView getFocusedView() { return (target == null) ? null : target.getActiveView(); }
@Nullable protected DrawingView getView() { return (specificView != null || editor==null) ? specificView : editor.getActiveView(); }
public SelectionComponentDisplayer(DrawingEditor editor, JComponent component) { this.editor = editor; this.weakRef = new WeakReference<JComponent>(component); if (editor.getActiveView() != null) { view = editor.getActiveView(); view.addPropertyChangeListener(this); view.addFigureSelectionListener(this); } editor.addPropertyChangeListener(this); updateVisibility(); }
@Override public void propertyChange(PropertyChangeEvent evt) { // String constants are interned if (evt.getPropertyName() == DrawingEditor.ACTIVE_VIEW_PROPERTY) { if (evt.getNewValue() == null) { zoomPopupButton.setText("100 %"); } else { zoomPopupButton.setText((int) (editor.getActiveView().getScaleFactor() * 100) + " %"); } } } });
@Override public void mouseClicked(MouseEvent e) { if (wasSelectedOnPressed) { DrawingView view = editor.getActiveView(); if (view != null) { view.setHandleDetailLevel(view.getHandleDetailLevel() + 1); } } }
@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 public void show(Component invoker, int x, int y) { if (colorChooser == null) { initialize(); } Color c; if (editor.getActiveView() != null) { c = editor.getActiveView().getDrawing().get(attributeKey); } else { c = editor.getDefaultAttribute(attributeKey); } colorChooser.setColor(c == null ? new Color(0, true) : c); super.show(invoker, x, y); }
@Nullable protected DrawingView getActiveView() { if (getView() != null) { return getView(); } else { return editor.getActiveView(); } }
public DrawingComponentRepainter(DrawingEditor editor, JComponent component) { this.editor = editor; this.component = component; if (editor != null) { if (editor.getActiveView() != null) { DrawingView view = editor.getActiveView(); view.addPropertyChangeListener(this); if (view.getDrawing() != null) { view.getDrawing().addFigureListener(this); } } editor.addPropertyChangeListener(this); } }
@Override public void actionPerformed(java.awt.event.ActionEvent e) { super.actionPerformed(e); zoomPopupButton.setText((int) (editor.getActiveView().getScaleFactor() * 100) + " %"); } });
@Override protected Color getInitialColor() { Color initialColor = null; DrawingView v = getEditor().getActiveView(); if (v != null && v.getSelectedFigures().size() == 1) { Figure f = v.getSelectedFigures().iterator().next(); initialColor = f.get(key); } if (initialColor == null) { initialColor = super.getInitialColor(); } return initialColor; } }
protected void drawTool(Graphics2D g) { if (editor != null && editor.getActiveView() == this && editor.getTool() != null) { editor.getTool().draw(g); } }
public SelectionComponentRepainter(DrawingEditor editor, JComponent component) { this.editor = editor; this.component = component; if (editor != null) { if (editor.getActiveView() != null) { DrawingView view = editor.getActiveView(); view.addPropertyChangeListener(this); view.addFigureSelectionListener(this); if (view.getDrawing() != null) { view.getDrawing().addFigureListener(this); } } editor.addPropertyChangeListener(this); } }
@Override protected Color getInitialColor() { Color initialColor = null; DrawingView v = getEditor().getActiveView(); if (v != null) { Figure f = v.getDrawing(); initialColor = f.get(key); } if (initialColor == null) { initialColor = super.getInitialColor(); } return initialColor; }
protected void drawHandles(java.awt.Graphics2D g) { if (editor != null && editor.getActiveView() == this) { validateHandles(); for (Handle h : getSelectionHandles()) { h.draw(g); } for (Handle h : getSecondaryHandles()) { h.draw(g); } } }