org.netbeans.api.visual.model.ObjectState Java Examples
The following examples show how to use
org.netbeans.api.visual.model.ObjectState.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiConnectionWidget.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override protected void paintWidget() { Graphics2D g = getScene().getGraphics(); //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setColor(this.color); ObjectState state = this.getState(); float width = 1.0f; if (state.isHovered() || this.popupVisible) { width = HOVER_STROKE_WIDTH; } Stroke oldStroke = g.getStroke(); g.setStroke(new BasicStroke(width)); for (Route r : routeList) { g.drawLine(r.from.x, r.from.y, r.to.x, r.to.y); } g.setStroke(oldStroke); }
Example #2
Source File: DiagramConnectionWidget.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public void notifyStateChanged(ObjectState previousState, ObjectState state) { if (previousState.isHovered() != state.isHovered()) { color = connection.getColor(); if (state.isHovered()) { this.setStroke(BOLD_STROKE); } else { this.setStroke(NORMAL_STROKE); } if (state.isHovered()) { this.setStroke(BOLD_STROKE); } else { this.setStroke(NORMAL_STROKE); } repaint(); } super.notifyStateChanged(previousState, state); }
Example #3
Source File: BlockWidget.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { super.notifyStateChanged(previousState, state); if (previousState.isHovered() != state.isHovered()) { if (state.isHovered()) { this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR)); } else { this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR)); } } if (previousState.isSelected() != state.isSelected()) { if (state.isSelected()) { this.setFont(boldFont); } else { this.setFont(font); } } }
Example #4
Source File: BlockWidget.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { super.notifyStateChanged(previousState, state); if (previousState.isHovered() != state.isHovered()) { if (state.isHovered()) { this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR)); } else { this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR)); } } if (previousState.isSelected() != state.isSelected()) { if (state.isSelected()) { this.setFont(boldFont); } else { this.setFont(font); } } }
Example #5
Source File: BlockWidget.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { super.notifyStateChanged(previousState, state); if (previousState.isHovered() != state.isHovered()) { if (state.isHovered()) { this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR)); } else { this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR)); } } if (previousState.isSelected() != state.isSelected()) { if (state.isSelected()) { this.setFont(boldFont); } else { this.setFont(font); } } }
Example #6
Source File: DiagramConnectionWidget.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public void notifyStateChanged(ObjectState previousState, ObjectState state) { if (previousState.isHovered() != state.isHovered()) { color = connection.getColor(); if (state.isHovered()) { this.setStroke(BOLD_STROKE); } else { this.setStroke(NORMAL_STROKE); } if (state.isHovered()) { this.setStroke(BOLD_STROKE); } else { this.setStroke(NORMAL_STROKE); } repaint(); } super.notifyStateChanged(previousState, state); }
Example #7
Source File: BlockWidget.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { super.notifyStateChanged(previousState, state); if (previousState.isHovered() != state.isHovered()) { if (state.isHovered()) { this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR)); } else { this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR)); } } if (previousState.isSelected() != state.isSelected()) { if (state.isSelected()) { this.setFont(boldFont); } else { this.setFont(font); } } }
Example #8
Source File: MultiConnectionWidget.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override protected void paintWidget() { Graphics2D g = getScene().getGraphics(); //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setColor(this.color); ObjectState state = this.getState(); float width = 1.0f; if (state.isHovered() || this.popupVisible) { width = HOVER_STROKE_WIDTH; } Stroke oldStroke = g.getStroke(); g.setStroke(new BasicStroke(width)); for (Route r : routeList) { g.drawLine(r.from.x, r.from.y, r.to.x, r.to.y); } g.setStroke(oldStroke); }
Example #9
Source File: MultiConnectionWidget.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override protected void paintWidget() { Graphics2D g = getScene().getGraphics(); //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setColor(this.color); ObjectState state = this.getState(); float width = 1.0f; if (state.isHovered() || this.popupVisible) { width = HOVER_STROKE_WIDTH; } Stroke oldStroke = g.getStroke(); g.setStroke(new BasicStroke(width)); for (Route r : routeList) { g.drawLine(r.from.x, r.from.y, r.to.x, r.to.y); } g.setStroke(oldStroke); }
Example #10
Source File: BlockWidget.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { super.notifyStateChanged(previousState, state); if (previousState.isHovered() != state.isHovered()) { if (state.isHovered()) { this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR)); } else { this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR)); } } if (previousState.isSelected() != state.isSelected()) { if (state.isSelected()) { this.setFont(boldFont); } else { this.setFont(font); } } }
Example #11
Source File: BlockWidget.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { super.notifyStateChanged(previousState, state); if (previousState.isHovered() != state.isHovered()) { if (state.isHovered()) { this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR)); } else { this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR)); } } if (previousState.isSelected() != state.isSelected()) { if (state.isSelected()) { this.setFont(boldFont); } else { this.setFont(font); } } }
Example #12
Source File: ListWidget.java From netbeans with Apache License 2.0 | 6 votes |
/** * Creates a list widget. * @param scene the scene */ public ListWidget (Scene scene) { super (scene); LookFeel lookFeel = scene.getLookFeel (); setOpaque (true); setBackground (lookFeel.getBackground ()); setBorder (BorderFactory.createLineBorder ()); setLayout (LayoutFactory.createVerticalFlowLayout ()); header = new Widget (scene); header.setLayout (LayoutFactory.createHorizontalFlowLayout (LayoutFactory.SerialAlignment.CENTER, 0)); header.addChild (imageWidget = new ImageWidget (scene)); header.addChild (labelWidget = new LabelWidget (scene)); addChild (header); addChild (new SeparatorWidget (scene, SeparatorWidget.Orientation.HORIZONTAL)); setState (ObjectState.createNormal ()); }
Example #13
Source File: DiagramConnectionWidget.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public void notifyStateChanged(ObjectState previousState, ObjectState state) { if (previousState.isHovered() != state.isHovered()) { color = connection.getColor(); if (state.isHovered()) { this.setStroke(BOLD_STROKE); } else { this.setStroke(NORMAL_STROKE); } if (state.isHovered()) { this.setStroke(BOLD_STROKE); } else { this.setStroke(NORMAL_STROKE); } repaint(); } super.notifyStateChanged(previousState, state); }
Example #14
Source File: VMDNetBeans60ColorScheme.java From netbeans with Apache License 2.0 | 6 votes |
public void updateUI (VMDConnectionWidget widget, ObjectState previousState, ObjectState state) { if (state.isSelected ()) widget.setForeground (COLOR60_SELECT); else if (state.isHighlighted ()) widget.setForeground (VMDOriginalColorScheme.COLOR_HIGHLIGHTED); else if (state.isHovered () || state.isFocused ()) widget.setForeground (COLOR60_HOVER); else widget.setForeground (VMDOriginalColorScheme.COLOR_NORMAL); if (state.isSelected () || state.isHovered ()) { widget.setControlPointShape (PointShape.SQUARE_FILLED_SMALL); widget.setEndPointShape (PointShape.SQUARE_FILLED_BIG); widget.setControlPointCutDistance (0); } else { widget.setControlPointShape (PointShape.NONE); widget.setEndPointShape (POINT_SHAPE60_IMAGE); widget.setControlPointCutDistance (5); } }
Example #15
Source File: MultiConnectionWidget.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override protected void paintWidget() { Graphics2D g = getScene().getGraphics(); //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setColor(this.color); ObjectState state = this.getState(); float width = 1.0f; if (state.isHovered() || this.popupVisible) { width = HOVER_STROKE_WIDTH; } Stroke oldStroke = g.getStroke(); g.setStroke(new BasicStroke(width)); for (Route r : routeList) { g.drawLine(r.from.x, r.from.y, r.to.x, r.to.y); } g.setStroke(oldStroke); }
Example #16
Source File: BlockWidget.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { super.notifyStateChanged(previousState, state); if (previousState.isHovered() != state.isHovered()) { if (state.isHovered()) { this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR)); } else { this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR)); } } if (previousState.isSelected() != state.isSelected()) { if (state.isSelected()) { this.setFont(boldFont); } else { this.setFont(font); } } }
Example #17
Source File: PFENotModifiableScheme.java From netbeans with Apache License 2.0 | 6 votes |
public void updateUI (VMDConnectionWidget widget, ObjectState previousState, ObjectState state) { if (state.isSelected ()) { widget.setForeground (COLOR60_SELECT); } else if (state.isHighlighted ()) { widget.setForeground (COLOR_HIGHLIGHTED); } else if (state.isHovered () || state.isFocused ()) { widget.setForeground (COLOR60_HOVER); } else { widget.setForeground (COLOR_NORMAL); } if (state.isSelected () || state.isHovered ()) { widget.setControlPointShape (PointShape.SQUARE_FILLED_SMALL); widget.setEndPointShape (PointShape.SQUARE_FILLED_BIG); widget.setControlPointCutDistance (0); } else { widget.setControlPointShape (PointShape.NONE); widget.setEndPointShape (POINT_SHAPE_IMAGE); widget.setControlPointCutDistance (5); } }
Example #18
Source File: ObjectSceneLazyTest.java From netbeans with Apache License 2.0 | 6 votes |
/** * Checks that lazy object will maintain the state even if * a widget is registered */ public void testRegisterWidgetTransfersState() throws Exception { Object item = new String("lazyItem"); scene.setSelectedObjects(Collections.singleton(item)); scene.setHighlightedObjects(Collections.singleton(item)); scene.setHoveredObject(item); scene.setFocusedObject(item); Widget w = new LabelWidget(scene); scene.addObject(item, w); ObjectState s = scene.getObjectState(item); assertTrue(s.isSelected()); assertTrue(s.isHighlighted()); assertTrue(s.isHovered()); assertTrue(s.isFocused()); ObjectState ws = w.getState(); assertTrue(ws.isSelected()); assertTrue(ws.isHighlighted()); assertTrue(ws.isHovered()); assertTrue(ws.isFocused()); }
Example #19
Source File: IconNodeWidget.java From netbeans with Apache License 2.0 | 6 votes |
/** * Creates an icon node widget with a specified orientation. * @param scene the scene * @param orientation the text orientation */ public IconNodeWidget (Scene scene, TextOrientation orientation) { super (scene); LookFeel lookFeel = getScene ().getLookFeel (); switch (orientation) { case BOTTOM_CENTER: setLayout (LayoutFactory.createVerticalFlowLayout (LayoutFactory.SerialAlignment.CENTER, - lookFeel.getMargin () + 1)); break; case RIGHT_CENTER: setLayout (LayoutFactory.createHorizontalFlowLayout (LayoutFactory.SerialAlignment.CENTER, - lookFeel.getMargin () + 1)); break; } imageWidget = new ImageWidget (scene); addChild (imageWidget); labelWidget = new LabelWidget (scene); labelWidget.setFont (scene.getDefaultFont ().deriveFont (14.0f)); addChild (labelWidget); setState (ObjectState.createNormal ()); }
Example #20
Source File: ListWidget.java From netbeans with Apache License 2.0 | 6 votes |
/** * Creates a list widget. * @param scene the scene */ public ListWidget (Scene scene) { super (scene); GeomUtil.LOG.warning ("org.netbeans.api.visual.widget.general.ListWidget class is deprecated. Use org.netbeans.modules.visual.experimental.widget.general.ListWidget class instead. Since it is an experimental class outside of public-API packages, you have to set an implementation dependency on the org.netbeans.api.visual module."); // NOI18N LookFeel lookFeel = scene.getLookFeel (); setOpaque (true); setBackground (lookFeel.getBackground ()); setBorder (BorderFactory.createLineBorder ()); setLayout (LayoutFactory.createVerticalFlowLayout ()); header = new Widget (scene); header.setLayout (LayoutFactory.createHorizontalFlowLayout (LayoutFactory.SerialAlignment.CENTER, 0)); header.addChild (imageWidget = new ImageWidget (scene)); header.addChild (labelWidget = new LabelWidget (scene)); addChild (header); addChild (new SeparatorWidget (scene, SeparatorWidget.Orientation.HORIZONTAL)); setState (ObjectState.createNormal ()); }
Example #21
Source File: MultiConnectionWidget.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override protected void paintWidget() { Graphics2D g = getScene().getGraphics(); //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setColor(this.color); ObjectState state = this.getState(); float width = 1.0f; if (state.isHovered() || this.popupVisible) { width = HOVER_STROKE_WIDTH; } Stroke oldStroke = g.getStroke(); g.setStroke(new BasicStroke(width)); for (Route r : routeList) { g.drawLine(r.from.x, r.from.y, r.to.x, r.to.y); } g.setStroke(oldStroke); }
Example #22
Source File: GraphColorScheme.java From Llunatic with GNU General Public License v3.0 | 6 votes |
@Override public void updateUI(VMDNodeWidget widget, ObjectState previousState, ObjectState state) { if (!previousState.isSelected() && state.isSelected()) { widget.bringToFront(); } else if (!previousState.isHovered() && state.isHovered()) { widget.bringToFront(); } Widget header = widget.getHeader(); header.setOpaque(state.isSelected()); if (state.isFocused() || state.isHovered()) { header.setBorder(BORDER_PIN_HOVERED); } else { header.setBorder(HEADER_BORDER_PIN); } }
Example #23
Source File: DBColorScheme.java From jeddict with Apache License 2.0 | 6 votes |
@Override public void updateUI(IPEdgeWidget widget, ObjectState previousState, ObjectState state) { if (state.isSelected()) { widget.setForeground(EDGE_WIDGET_SELECT_COLOR); } else if (state.isHovered() || state.isFocused()) { widget.setForeground(EDGE_WIDGET_HOVER_COLOR); } else { widget.setForeground(EDGE_WIDGET_COLOR); } if (state.isSelected()) { widget.setControlPointShape(PointShape.SQUARE_FILLED_SMALL); widget.setEndPointShape(PointShape.SQUARE_FILLED_BIG); widget.setControlPointCutDistance(0); } else if (state.isHovered()) { widget.setControlPointShape(PointShape.SQUARE_FILLED_SMALL); widget.setEndPointShape(PointShape.SQUARE_FILLED_BIG); widget.setControlPointCutDistance(0); } else { widget.setControlPointShape(PointShape.NONE); widget.setEndPointShape(PointShape.NONE); widget.setControlPointCutDistance(5); } }
Example #24
Source File: BlockWidget.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { super.notifyStateChanged(previousState, state); if (previousState.isHovered() != state.isHovered()) { if (state.isHovered()) { this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR)); } else { this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR)); } } if (previousState.isSelected() != state.isSelected()) { if (state.isSelected()) { this.setFont(boldFont); } else { this.setFont(font); } } }
Example #25
Source File: VMDOriginalColorScheme.java From netbeans with Apache License 2.0 | 6 votes |
public void updateUI (VMDConnectionWidget widget, ObjectState previousState, ObjectState state) { if (state.isHovered ()) widget.setForeground (COLOR_HOVERED); else if (state.isSelected ()) widget.setForeground (COLOR_SELECTED); else if (state.isHighlighted ()) widget.setForeground (COLOR_HIGHLIGHTED); else if (state.isFocused ()) widget.setForeground (COLOR_HOVERED); else widget.setForeground (COLOR_NORMAL); if (state.isSelected ()) { widget.setControlPointShape (PointShape.SQUARE_FILLED_SMALL); widget.setEndPointShape (PointShape.SQUARE_FILLED_BIG); } else { widget.setControlPointShape (PointShape.NONE); widget.setEndPointShape (POINT_SHAPE_IMAGE); } }
Example #26
Source File: FigureWidget.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { super.notifyStateChanged(previousState, state); Color borderColor = Color.BLACK; int thickness = 1; boolean repaint = false; Font f = font; if (state.isSelected()) { thickness = 1; f = boldFont; } if (state.isHovered()) { borderColor = Color.BLUE; } if (state.isHovered() != previousState.isHovered()) { repaint = true; } if (state.isSelected() != previousState.isSelected()) { repaint = true; } if (repaint) { middleWidget.setBorder(BorderFactory.createLineBorder(borderColor, thickness)); for (LabelWidget labelWidget : labelWidgets) { labelWidget.setFont(f); } repaint(); } }
Example #27
Source File: ListItemWidget.java From netbeans with Apache License 2.0 | 5 votes |
/** * Creates a list item widget. * @param scene the scene */ public ListItemWidget (Scene scene) { super (scene); GeomUtil.LOG.warning ("org.netbeans.api.visual.widget.general.ListItemWidget class is deprecated. Use org.netbeans.modules.visual.experimental.widget.general.ListItemWidget class instead. Since it is an experimental class outside of public-API packages, you have to set an implementation dependency on the org.netbeans.api.visual module."); // NOI18N setState (ObjectState.createNormal ()); }
Example #28
Source File: FigureWidget.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { super.notifyStateChanged(previousState, state); Color borderColor = Color.BLACK; int thickness = 1; boolean repaint = false; Font f = font; if (state.isSelected()) { thickness = 1; f = boldFont; } if (state.isHovered()) { borderColor = Color.BLUE; } if (state.isHovered() != previousState.isHovered()) { repaint = true; } if (state.isSelected() != previousState.isSelected()) { repaint = true; } if (repaint) { middleWidget.setBorder(BorderFactory.createLineBorder(borderColor, thickness)); for (LabelWidget labelWidget : labelWidgets) { labelWidget.setFont(f); } repaint(); } }
Example #29
Source File: FigureWidget.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { super.notifyStateChanged(previousState, state); Color borderColor = Color.BLACK; int thickness = 1; boolean repaint = false; Font f = font; if (state.isSelected()) { thickness = 1; f = boldFont; } if (state.isHovered()) { borderColor = Color.BLUE; } if (state.isHovered() != previousState.isHovered()) { repaint = true; } if (state.isSelected() != previousState.isSelected()) { repaint = true; } if (repaint) { middleWidget.setBorder(BorderFactory.createLineBorder(borderColor, thickness)); for (LabelWidget labelWidget : labelWidgets) { labelWidget.setFont(f); } repaint(); } }
Example #30
Source File: MultiConnectionWidget.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { boolean repaint = false; if (state.isHovered() != previousState.isHovered()) { repaint = true; } repaint(); }