com.sun.hotspot.igv.view.DiagramScene Java Examples
The following examples show how to use
com.sun.hotspot.igv.view.DiagramScene.
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: SlotWidget.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public void handleDoubleClick(Widget w, WidgetAction.WidgetMouseEvent e) { Set<Integer> hiddenNodes = new HashSet<>(diagramScene.getModel().getHiddenNodes()); if (diagramScene.isAllVisible()) { hiddenNodes = new HashSet<>(diagramScene.getModel().getGraphToView().getGroup().getAllNodes()); } boolean progress = false; for (Figure f : diagramScene.getModel().getDiagramToView().getFigures()) { for (Slot s : f.getSlots()) { if (DiagramScene.doesIntersect(s.getSource().getSourceNodesAsSet(), slot.getSource().getSourceNodesAsSet())) { progress = true; hiddenNodes.removeAll(f.getSource().getSourceNodesAsSet()); } } } if (progress) { this.diagramScene.getModel().showNot(hiddenNodes); } }
Example #2
Source File: FigureWidget.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void build(JPopupMenu menu, Figure figure, FigureWidget figureWidget, boolean successors, DiagramScene diagramScene) { Set<Figure> set = figure.getPredecessorSet(); if (successors) { set = figure.getSuccessorSet(); } boolean first = true; for (Figure f : set) { if (f == figure) { continue; } if (first) { first = false; } else { menu.addSeparator(); } Action go = diagramScene.createGotoAction(f); menu.add(go); JMenu preds = new JMenu("Nodes Above"); preds.addMenuListener(figureWidget.new NeighborMenuListener(preds, f, false)); menu.add(preds); JMenu succs = new JMenu("Nodes Below"); succs.addMenuListener(figureWidget.new NeighborMenuListener(succs, f, true)); menu.add(succs); } if (figure.getPredecessorSet().isEmpty() && figure.getSuccessorSet().isEmpty()) { menu.add("(none)"); } }
Example #3
Source File: InputSlotWidget.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public InputSlotWidget(InputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); inputSlot = slot; //init(); //getFigureWidget().getLeftWidget().addChild(this); Point p = inputSlot.getRelativePosition(); p.x -= this.calculateClientArea().width / 2; p.y += Figure.SLOT_START; this.setPreferredLocation(p); }
Example #4
Source File: DiagramConnectionWidget.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override protected void paintWidget() { Graphics2D g = this.getGraphics(); if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) { return; } //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); DiagramScene ds = (DiagramScene) this.getScene(); boolean shouldHide = false;//ds.getShouldHide(this); Composite oldComposite = null; if (shouldHide) { Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR); g.setPaint(c); } else { g.setPaint(color); } if (split) { for (int i = 1; i < controlPoints.size(); i++) { Point prev = controlPoints.get(i - 1); Point cur = controlPoints.get(i); if (cur == null || prev == null) { continue; } g.drawLine(prev.x, prev.y, cur.x, cur.y); } } else { g.drawPolyline(xPoints, yPoints, pointCount); } /*for(int i=0; i<xPoints.length; i++) { int x = xPoints[i]; int y = yPoints[i]; g.fillOval(x - 2, y - 2, 4, 4); }*/ if (xPoints.length >= 2) { Graphics2D g2 = (Graphics2D) g.create(); int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1]; int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1]; if (xOff == 0 && yOff == 0 && yPoints.length >= 3) { xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1]; yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1]; } g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]); g2.rotate(Math.atan2(yOff, xOff)); g2.scale(0.55, 0.80); AnchorShape.TRIANGLE_FILLED.paint(g2, false); } }
Example #5
Source File: OutputSlotWidget.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public OutputSlotWidget(OutputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); outputSlot = slot; Point p = outputSlot.getRelativePosition(); p.y += getSlot().getFigure().getHeight() - Figure.SLOT_START; p.x -= this.calculateClientArea().width / 2; this.setPreferredLocation(p); }
Example #6
Source File: SlotWidget.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public SlotWidget(Slot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(scene); this.diagramScene = scene; this.slot = slot; figureWidget = fw; this.setToolTipText("<HTML>" + slot.getToolTipText() + "</HTML>"); this.setCheckClipping(true); parent.addChild(this); //this.setPreferredBounds(this.calculateClientArea()); }
Example #7
Source File: OutputSlotWidget.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public OutputSlotWidget(OutputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); outputSlot = slot; init(); getFigureWidget().getRightWidget().addChild(this); }
Example #8
Source File: OutputSlotWidget.java From hottub with GNU General Public License v2.0 | 4 votes |
public OutputSlotWidget(OutputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); outputSlot = slot; init(); getFigureWidget().getRightWidget().addChild(this); }
Example #9
Source File: InputSlotWidget.java From hottub with GNU General Public License v2.0 | 4 votes |
public InputSlotWidget(InputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); inputSlot = slot; init(); getFigureWidget().getLeftWidget().addChild(this); }
Example #10
Source File: FigureWidget.java From hottub with GNU General Public License v2.0 | 4 votes |
public FigureWidget(final Figure f, DiagramScene s, Widget parent) { super(s); font = f.getDiagram().getFont(); boldFont = f.getDiagram().getFont().deriveFont(Font.BOLD); this.setCheckClipping(true); this.diagramScene = s; parent.addChild(this); this.figure = f; this.resolveBounds(null, calculateClientArea()); leftWidget = new Widget(s); this.addChild(leftWidget); leftWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Right, VERTICAL_LAYOUT));//LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); middleWidget = new Widget(s); this.addChild(middleWidget); if (VERTICAL_LAYOUT) { this.setLayout(LayoutFactory.createVerticalFlowLayout()); } else { this.setLayout(LayoutFactory.createHorizontalFlowLayout()); } middleWidget.setLayout(LayoutFactory.createVerticalFlowLayout()); middleWidget.setBackground(f.getColor()); middleWidget.setOpaque(true); assert this.getScene() != null; assert this.getScene().getView() != null; middleWidget.setBorder(BorderFactory.createLineBorder(Color.BLACK)); labelWidgets = new ArrayList<LabelWidget>(); String[] strings = figure.getLines(); for (String cur : strings) { String displayString = cur; LabelWidget lw = new LabelWidget(s); labelWidgets.add(lw); middleWidget.addChild(lw); lw.setLabel(displayString); lw.setFont(font); lw.setForeground(Color.BLACK); lw.setAlignment(LabelWidget.Alignment.CENTER); lw.setVerticalAlignment(LabelWidget.VerticalAlignment.CENTER); lw.setMaximumSize(new Dimension(f.getWidth(), 20000)); lw.setMinimumSize(new Dimension(f.getWidth(), 20)); } rightWidget = new Widget(s); this.addChild(rightWidget); rightWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Left, VERTICAL_LAYOUT));//LayoutFactory.createVerticalLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); // Initialize node for property sheet node = new AbstractNode(Children.LEAF) { @Override protected Sheet createSheet() { Sheet s = super.createSheet(); PropertiesSheet.initializeSheet(f.getProperties(), s); return s; } }; node.setDisplayName(getName()); }
Example #11
Source File: DiagramConnectionWidget.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override protected void paintWidget() { Graphics2D g = this.getGraphics(); if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) { return; } //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); DiagramScene ds = (DiagramScene) this.getScene(); boolean shouldHide = false;//ds.getShouldHide(this); Composite oldComposite = null; if (shouldHide) { Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR); g.setPaint(c); } else { g.setPaint(color); } if (split) { for (int i = 1; i < controlPoints.size(); i++) { Point prev = controlPoints.get(i - 1); Point cur = controlPoints.get(i); if (cur == null || prev == null) { continue; } g.drawLine(prev.x, prev.y, cur.x, cur.y); } } else { g.drawPolyline(xPoints, yPoints, pointCount); } /*for(int i=0; i<xPoints.length; i++) { int x = xPoints[i]; int y = yPoints[i]; g.fillOval(x - 2, y - 2, 4, 4); }*/ if (xPoints.length >= 2) { Graphics2D g2 = (Graphics2D) g.create(); int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1]; int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1]; if (xOff == 0 && yOff == 0 && yPoints.length >= 3) { xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1]; yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1]; } g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]); g2.rotate(Math.atan2(yOff, xOff)); g2.scale(0.55, 0.80); AnchorShape.TRIANGLE_FILLED.paint(g2, false); } }
Example #12
Source File: DiagramConnectionWidget.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override protected void paintWidget() { Graphics2D g = this.getGraphics(); if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) { return; } //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); DiagramScene ds = (DiagramScene) this.getScene(); boolean shouldHide = false;//ds.getShouldHide(this); Composite oldComposite = null; if (shouldHide) { Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR); g.setPaint(c); } else { g.setPaint(color); } if (split) { for (int i = 1; i < controlPoints.size(); i++) { Point prev = controlPoints.get(i - 1); Point cur = controlPoints.get(i); if (cur == null || prev == null) { continue; } g.drawLine(prev.x, prev.y, cur.x, cur.y); } } else { g.drawPolyline(xPoints, yPoints, pointCount); } /*for(int i=0; i<xPoints.length; i++) { int x = xPoints[i]; int y = yPoints[i]; g.fillOval(x - 2, y - 2, 4, 4); }*/ if (xPoints.length >= 2) { Graphics2D g2 = (Graphics2D) g.create(); int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1]; int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1]; if (xOff == 0 && yOff == 0 && yPoints.length >= 3) { xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1]; yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1]; } g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]); g2.rotate(Math.atan2(yOff, xOff)); g2.scale(0.55, 0.80); AnchorShape.TRIANGLE_FILLED.paint(g2, false); } }
Example #13
Source File: InputSlotWidget.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public InputSlotWidget(InputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); inputSlot = slot; init(); getFigureWidget().getLeftWidget().addChild(this); }
Example #14
Source File: FigureWidget.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public FigureWidget(final Figure f, DiagramScene s, Widget parent) { super(s); font = f.getDiagram().getFont(); boldFont = f.getDiagram().getFont().deriveFont(Font.BOLD); this.setCheckClipping(true); this.diagramScene = s; parent.addChild(this); this.figure = f; this.resolveBounds(null, calculateClientArea()); leftWidget = new Widget(s); this.addChild(leftWidget); leftWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Right, VERTICAL_LAYOUT));//LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); middleWidget = new Widget(s); this.addChild(middleWidget); if (VERTICAL_LAYOUT) { this.setLayout(LayoutFactory.createVerticalFlowLayout()); } else { this.setLayout(LayoutFactory.createHorizontalFlowLayout()); } middleWidget.setLayout(LayoutFactory.createVerticalFlowLayout()); middleWidget.setBackground(f.getColor()); middleWidget.setOpaque(true); assert this.getScene() != null; assert this.getScene().getView() != null; middleWidget.setBorder(BorderFactory.createLineBorder(Color.BLACK)); labelWidgets = new ArrayList<LabelWidget>(); String[] strings = figure.getLines(); for (String cur : strings) { String displayString = cur; LabelWidget lw = new LabelWidget(s); labelWidgets.add(lw); middleWidget.addChild(lw); lw.setLabel(displayString); lw.setFont(font); lw.setForeground(Color.BLACK); lw.setAlignment(LabelWidget.Alignment.CENTER); lw.setVerticalAlignment(LabelWidget.VerticalAlignment.CENTER); lw.setMaximumSize(new Dimension(f.getWidth(), 20000)); lw.setMinimumSize(new Dimension(f.getWidth(), 20)); } rightWidget = new Widget(s); this.addChild(rightWidget); rightWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Left, VERTICAL_LAYOUT));//LayoutFactory.createVerticalLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); // Initialize node for property sheet node = new AbstractNode(Children.LEAF) { @Override protected Sheet createSheet() { Sheet s = super.createSheet(); PropertiesSheet.initializeSheet(f.getProperties(), s); return s; } }; node.setDisplayName(getName()); }
Example #15
Source File: DiagramConnectionWidget.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override protected void paintWidget() { Graphics2D g = this.getGraphics(); if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) { return; } //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); DiagramScene ds = (DiagramScene) this.getScene(); boolean shouldHide = false;//ds.getShouldHide(this); Composite oldComposite = null; if (shouldHide) { Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR); g.setPaint(c); } else { g.setPaint(color); } if (split) { for (int i = 1; i < controlPoints.size(); i++) { Point prev = controlPoints.get(i - 1); Point cur = controlPoints.get(i); if (cur == null || prev == null) { continue; } g.drawLine(prev.x, prev.y, cur.x, cur.y); } } else { g.drawPolyline(xPoints, yPoints, pointCount); } /*for(int i=0; i<xPoints.length; i++) { int x = xPoints[i]; int y = yPoints[i]; g.fillOval(x - 2, y - 2, 4, 4); }*/ if (xPoints.length >= 2) { Graphics2D g2 = (Graphics2D) g.create(); int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1]; int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1]; if (xOff == 0 && yOff == 0 && yPoints.length >= 3) { xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1]; yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1]; } g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]); g2.rotate(Math.atan2(yOff, xOff)); g2.scale(0.55, 0.80); AnchorShape.TRIANGLE_FILLED.paint(g2, false); } }
Example #16
Source File: OutputSlotWidget.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public OutputSlotWidget(OutputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); outputSlot = slot; init(); getFigureWidget().getRightWidget().addChild(this); }
Example #17
Source File: InputSlotWidget.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public InputSlotWidget(InputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); inputSlot = slot; init(); getFigureWidget().getLeftWidget().addChild(this); }
Example #18
Source File: FigureWidget.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public FigureWidget(final Figure f, DiagramScene s, Widget parent) { super(s); font = f.getDiagram().getFont(); boldFont = f.getDiagram().getFont().deriveFont(Font.BOLD); this.setCheckClipping(true); this.diagramScene = s; parent.addChild(this); this.figure = f; this.resolveBounds(null, calculateClientArea()); leftWidget = new Widget(s); this.addChild(leftWidget); leftWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Right, VERTICAL_LAYOUT));//LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); middleWidget = new Widget(s); this.addChild(middleWidget); if (VERTICAL_LAYOUT) { this.setLayout(LayoutFactory.createVerticalFlowLayout()); } else { this.setLayout(LayoutFactory.createHorizontalFlowLayout()); } middleWidget.setLayout(LayoutFactory.createVerticalFlowLayout()); middleWidget.setBackground(f.getColor()); middleWidget.setOpaque(true); assert this.getScene() != null; assert this.getScene().getView() != null; middleWidget.setBorder(BorderFactory.createLineBorder(Color.BLACK)); labelWidgets = new ArrayList<LabelWidget>(); String[] strings = figure.getLines(); for (String cur : strings) { String displayString = cur; LabelWidget lw = new LabelWidget(s); labelWidgets.add(lw); middleWidget.addChild(lw); lw.setLabel(displayString); lw.setFont(font); lw.setForeground(Color.BLACK); lw.setAlignment(LabelWidget.Alignment.CENTER); lw.setVerticalAlignment(LabelWidget.VerticalAlignment.CENTER); lw.setMaximumSize(new Dimension(f.getWidth(), 20000)); lw.setMinimumSize(new Dimension(f.getWidth(), 20)); } rightWidget = new Widget(s); this.addChild(rightWidget); rightWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Left, VERTICAL_LAYOUT));//LayoutFactory.createVerticalLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); // Initialize node for property sheet node = new AbstractNode(Children.LEAF) { @Override protected Sheet createSheet() { Sheet s = super.createSheet(); PropertiesSheet.initializeSheet(f.getProperties(), s); return s; } }; node.setDisplayName(getName()); }
Example #19
Source File: OutputSlotWidget.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public OutputSlotWidget(OutputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); outputSlot = slot; init(); getFigureWidget().getRightWidget().addChild(this); }
Example #20
Source File: FigureWidget.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public FigureWidget(final Figure f, WidgetAction hoverAction, WidgetAction selectAction, DiagramScene scene, Widget parent) { super(scene); assert this.getScene() != null; assert this.getScene().getView() != null; this.figure = f; this.setCheckClipping(true); this.diagramScene = scene; parent.addChild(this); Widget outer = new Widget(scene); outer.setBackground(f.getColor()); outer.setLayout(LayoutFactory.createOverlayLayout()); middleWidget = new Widget(scene); middleWidget.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.CENTER, 0)); middleWidget.setBackground(f.getColor()); middleWidget.setOpaque(true); middleWidget.getActions().addAction(new DoubleClickAction(this)); middleWidget.setCheckClipping(true); dummyTop = new Widget(scene); dummyTop.setMinimumSize(new Dimension(Figure.INSET / 2, 1)); middleWidget.addChild(dummyTop); String[] strings = figure.getLines(); labelWidgets = new ArrayList<>(strings.length); for (String displayString : strings) { LabelWidget lw = new LabelWidget(scene); labelWidgets.add(lw); middleWidget.addChild(lw); lw.setLabel(displayString); lw.setFont(figure.getDiagram().getFont()); lw.setForeground(getTextColor()); lw.setAlignment(LabelWidget.Alignment.CENTER); lw.setVerticalAlignment(LabelWidget.VerticalAlignment.CENTER); lw.setBorder(BorderFactory.createEmptyBorder()); } Widget dummyBottom = new Widget(scene); dummyBottom.setMinimumSize(new Dimension(Figure.INSET / 2, 1)); middleWidget.addChild(dummyBottom); middleWidget.setPreferredBounds(new Rectangle(0, Figure.SLOT_WIDTH - Figure.OVERLAPPING, f.getWidth(), f.getHeight())); this.addChild(middleWidget); // Initialize node for property sheet node = new AbstractNode(Children.LEAF) { @Override protected Sheet createSheet() { Sheet s = super.createSheet(); PropertiesSheet.initializeSheet(f.getProperties(), s); return s; } }; node.setDisplayName(getName()); }
Example #21
Source File: DiagramConnectionWidget.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override protected void paintWidget() { Graphics2D g = this.getGraphics(); if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) { return; } //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); DiagramScene ds = (DiagramScene) this.getScene(); boolean shouldHide = false;//ds.getShouldHide(this); Composite oldComposite = null; if (shouldHide) { Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR); g.setPaint(c); } else { g.setPaint(color); } if (split) { for (int i = 1; i < controlPoints.size(); i++) { Point prev = controlPoints.get(i - 1); Point cur = controlPoints.get(i); if (cur == null || prev == null) { continue; } g.drawLine(prev.x, prev.y, cur.x, cur.y); } } else { g.drawPolyline(xPoints, yPoints, pointCount); } /*for(int i=0; i<xPoints.length; i++) { int x = xPoints[i]; int y = yPoints[i]; g.fillOval(x - 2, y - 2, 4, 4); }*/ if (xPoints.length >= 2) { Graphics2D g2 = (Graphics2D) g.create(); int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1]; int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1]; if (xOff == 0 && yOff == 0 && yPoints.length >= 3) { xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1]; yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1]; } g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]); g2.rotate(Math.atan2(yOff, xOff)); g2.scale(0.55, 0.80); AnchorShape.TRIANGLE_FILLED.paint(g2, false); } }
Example #22
Source File: FigureWidget.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public FigureWidget(final Figure f, DiagramScene s, Widget parent) { super(s); font = f.getDiagram().getFont(); boldFont = f.getDiagram().getFont().deriveFont(Font.BOLD); this.setCheckClipping(true); this.diagramScene = s; parent.addChild(this); this.figure = f; this.resolveBounds(null, calculateClientArea()); leftWidget = new Widget(s); this.addChild(leftWidget); leftWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Right, VERTICAL_LAYOUT));//LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); middleWidget = new Widget(s); this.addChild(middleWidget); if (VERTICAL_LAYOUT) { this.setLayout(LayoutFactory.createVerticalFlowLayout()); } else { this.setLayout(LayoutFactory.createHorizontalFlowLayout()); } middleWidget.setLayout(LayoutFactory.createVerticalFlowLayout()); middleWidget.setBackground(f.getColor()); middleWidget.setOpaque(true); assert this.getScene() != null; assert this.getScene().getView() != null; middleWidget.setBorder(BorderFactory.createLineBorder(Color.BLACK)); labelWidgets = new ArrayList<LabelWidget>(); String[] strings = figure.getLines(); for (String cur : strings) { String displayString = cur; LabelWidget lw = new LabelWidget(s); labelWidgets.add(lw); middleWidget.addChild(lw); lw.setLabel(displayString); lw.setFont(font); lw.setForeground(Color.BLACK); lw.setAlignment(LabelWidget.Alignment.CENTER); lw.setVerticalAlignment(LabelWidget.VerticalAlignment.CENTER); lw.setMaximumSize(new Dimension(f.getWidth(), 20000)); lw.setMinimumSize(new Dimension(f.getWidth(), 20)); } rightWidget = new Widget(s); this.addChild(rightWidget); rightWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Left, VERTICAL_LAYOUT));//LayoutFactory.createVerticalLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); // Initialize node for property sheet node = new AbstractNode(Children.LEAF) { @Override protected Sheet createSheet() { Sheet s = super.createSheet(); PropertiesSheet.initializeSheet(f.getProperties(), s); return s; } }; node.setDisplayName(getName()); }
Example #23
Source File: InputSlotWidget.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public InputSlotWidget(InputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); inputSlot = slot; init(); getFigureWidget().getLeftWidget().addChild(this); }
Example #24
Source File: OutputSlotWidget.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public OutputSlotWidget(OutputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); outputSlot = slot; init(); getFigureWidget().getRightWidget().addChild(this); }
Example #25
Source File: DiagramConnectionWidget.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override protected void paintWidget() { Graphics2D g = this.getGraphics(); if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) { return; } //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); DiagramScene ds = (DiagramScene) this.getScene(); boolean shouldHide = false;//ds.getShouldHide(this); Composite oldComposite = null; if (shouldHide) { Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR); g.setPaint(c); } else { g.setPaint(color); } if (split) { for (int i = 1; i < controlPoints.size(); i++) { Point prev = controlPoints.get(i - 1); Point cur = controlPoints.get(i); if (cur == null || prev == null) { continue; } g.drawLine(prev.x, prev.y, cur.x, cur.y); } } else { g.drawPolyline(xPoints, yPoints, pointCount); } /*for(int i=0; i<xPoints.length; i++) { int x = xPoints[i]; int y = yPoints[i]; g.fillOval(x - 2, y - 2, 4, 4); }*/ if (xPoints.length >= 2) { Graphics2D g2 = (Graphics2D) g.create(); int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1]; int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1]; if (xOff == 0 && yOff == 0 && yPoints.length >= 3) { xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1]; yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1]; } g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]); g2.rotate(Math.atan2(yOff, xOff)); g2.scale(0.55, 0.80); AnchorShape.TRIANGLE_FILLED.paint(g2, false); } }
Example #26
Source File: FigureWidget.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public FigureWidget(final Figure f, DiagramScene s, Widget parent) { super(s); font = f.getDiagram().getFont(); boldFont = f.getDiagram().getFont().deriveFont(Font.BOLD); this.setCheckClipping(true); this.diagramScene = s; parent.addChild(this); this.figure = f; this.resolveBounds(null, calculateClientArea()); leftWidget = new Widget(s); this.addChild(leftWidget); leftWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Right, VERTICAL_LAYOUT));//LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); middleWidget = new Widget(s); this.addChild(middleWidget); if (VERTICAL_LAYOUT) { this.setLayout(LayoutFactory.createVerticalFlowLayout()); } else { this.setLayout(LayoutFactory.createHorizontalFlowLayout()); } middleWidget.setLayout(LayoutFactory.createVerticalFlowLayout()); middleWidget.setBackground(f.getColor()); middleWidget.setOpaque(true); assert this.getScene() != null; assert this.getScene().getView() != null; middleWidget.setBorder(BorderFactory.createLineBorder(Color.BLACK)); labelWidgets = new ArrayList<LabelWidget>(); String[] strings = figure.getLines(); for (String cur : strings) { String displayString = cur; LabelWidget lw = new LabelWidget(s); labelWidgets.add(lw); middleWidget.addChild(lw); lw.setLabel(displayString); lw.setFont(font); lw.setForeground(Color.BLACK); lw.setAlignment(LabelWidget.Alignment.CENTER); lw.setVerticalAlignment(LabelWidget.VerticalAlignment.CENTER); lw.setMaximumSize(new Dimension(f.getWidth(), 20000)); lw.setMinimumSize(new Dimension(f.getWidth(), 20)); } rightWidget = new Widget(s); this.addChild(rightWidget); rightWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Left, VERTICAL_LAYOUT));//LayoutFactory.createVerticalLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); // Initialize node for property sheet node = new AbstractNode(Children.LEAF) { @Override protected Sheet createSheet() { Sheet s = super.createSheet(); PropertiesSheet.initializeSheet(f.getProperties(), s); return s; } }; node.setDisplayName(getName()); }
Example #27
Source File: InputSlotWidget.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public InputSlotWidget(InputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); inputSlot = slot; init(); getFigureWidget().getLeftWidget().addChild(this); }
Example #28
Source File: OutputSlotWidget.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public OutputSlotWidget(OutputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(slot, scene, parent, fw); outputSlot = slot; init(); getFigureWidget().getRightWidget().addChild(this); }
Example #29
Source File: DiagramConnectionWidget.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override protected void paintWidget() { Graphics2D g = this.getGraphics(); if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) { return; } //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); DiagramScene ds = (DiagramScene) this.getScene(); boolean shouldHide = false;//ds.getShouldHide(this); Composite oldComposite = null; if (shouldHide) { Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR); g.setPaint(c); } else { g.setPaint(color); } if (split) { for (int i = 1; i < controlPoints.size(); i++) { Point prev = controlPoints.get(i - 1); Point cur = controlPoints.get(i); if (cur == null || prev == null) { continue; } g.drawLine(prev.x, prev.y, cur.x, cur.y); } } else { g.drawPolyline(xPoints, yPoints, pointCount); } /*for(int i=0; i<xPoints.length; i++) { int x = xPoints[i]; int y = yPoints[i]; g.fillOval(x - 2, y - 2, 4, 4); }*/ if (xPoints.length >= 2) { Graphics2D g2 = (Graphics2D) g.create(); int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1]; int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1]; if (xOff == 0 && yOff == 0 && yPoints.length >= 3) { xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1]; yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1]; } g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]); g2.rotate(Math.atan2(yOff, xOff)); g2.scale(0.55, 0.80); AnchorShape.TRIANGLE_FILLED.paint(g2, false); } }
Example #30
Source File: FigureWidget.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public FigureWidget(final Figure f, DiagramScene s, Widget parent) { super(s); font = f.getDiagram().getFont(); boldFont = f.getDiagram().getFont().deriveFont(Font.BOLD); this.setCheckClipping(true); this.diagramScene = s; parent.addChild(this); this.figure = f; this.resolveBounds(null, calculateClientArea()); leftWidget = new Widget(s); this.addChild(leftWidget); leftWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Right, VERTICAL_LAYOUT));//LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); middleWidget = new Widget(s); this.addChild(middleWidget); if (VERTICAL_LAYOUT) { this.setLayout(LayoutFactory.createVerticalFlowLayout()); } else { this.setLayout(LayoutFactory.createHorizontalFlowLayout()); } middleWidget.setLayout(LayoutFactory.createVerticalFlowLayout()); middleWidget.setBackground(f.getColor()); middleWidget.setOpaque(true); assert this.getScene() != null; assert this.getScene().getView() != null; middleWidget.setBorder(BorderFactory.createLineBorder(Color.BLACK)); labelWidgets = new ArrayList<LabelWidget>(); String[] strings = figure.getLines(); for (String cur : strings) { String displayString = cur; LabelWidget lw = new LabelWidget(s); labelWidgets.add(lw); middleWidget.addChild(lw); lw.setLabel(displayString); lw.setFont(font); lw.setForeground(Color.BLACK); lw.setAlignment(LabelWidget.Alignment.CENTER); lw.setVerticalAlignment(LabelWidget.VerticalAlignment.CENTER); lw.setMaximumSize(new Dimension(f.getWidth(), 20000)); lw.setMinimumSize(new Dimension(f.getWidth(), 20)); } rightWidget = new Widget(s); this.addChild(rightWidget); rightWidget.setLayout(new SlotLayout(SlotLayout.HorizontalAlignment.Left, VERTICAL_LAYOUT));//LayoutFactory.createVerticalLayout(LayoutFactory.SerialAlignment.JUSTIFY, 0)); // Initialize node for property sheet node = new AbstractNode(Children.LEAF) { @Override protected Sheet createSheet() { Sheet s = super.createSheet(); PropertiesSheet.initializeSheet(f.getProperties(), s); return s; } }; node.setDisplayName(getName()); }