/** * Returns an attributeMap for the specified position and color. */ public static Map createBounds(AttributeMap map, int x, int y, Color c) { GraphConstants.setBounds(map, map.createRect(x, y, 90, 30)); GraphConstants.setBorder(map, BorderFactory.createRaisedBevelBorder()); GraphConstants.setBackground(map, c.darker().darker()); GraphConstants .setGradientColor(map, c.brighter().brighter().brighter()); GraphConstants.setForeground(map, Color.white); if (GraphConstants.DEFAULTFONT != null) { GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont( Font.BOLD, 12)); } GraphConstants.setOpaque(map, true); return map; }
@Override protected void postProcessEntity(Entity entity, DefaultGraphCell cell) { super.postProcessEntity(entity, cell); GraphConstants.setBackground(cell.getAttributes(), ENTITY_COLOR); GraphConstants.setOpaque(cell.getAttributes(), true); DefaultEdge edge = createInheritanceEdge((ObjEntity) entity); if (edge != null) { createdObjects.add(edge); } }
@Override protected void postProcessEntity(Entity entity, DefaultGraphCell cell) { super.postProcessEntity(entity, cell); GraphConstants.setBackground(cell.getAttributes(), ENTITY_COLOR); GraphConstants.setOpaque(cell.getAttributes(), true); }
private void updateStateMachine() { if (oldStateDiagram) { this.repaint(); } else { K currentStateKey = stateMachine.getCurrentStateKey(); DefaultGraphCell currentStateCell = stateCells.get(currentStateKey); GraphConstants.setBackground(graph.getAttributes(currentStateCell), Color.RED); currentStateCell.setAttributes(graph.getAttributes(currentStateCell)); for (Entry<K, DefaultGraphCell> entry : stateCells.entrySet()) { if (entry.getKey() != currentStateKey) { DefaultGraphCell stateCell = entry.getValue(); GraphConstants.setBackground(graph.getAttributes(stateCell), Color.CYAN); stateCell.setAttributes(graph.getAttributes(stateCell)); } } graph.repaint(); graph.refresh(); } }
GraphConstants.setBackground(am,new Color(212,219,206)); GraphConstants.setBorderColor(am, Color.GRAY); GraphConstants.setLabelAlongEdge(am,true);
@Override public void stateChanged(K oldState, K newState) { if (oldStateDiagram) { this.repaint(); } else { if (oldState != null) { // At initialization, the state key is null. DefaultGraphCell oldStateCell = stateCells.get(oldState); GraphConstants.setBackground(graph.getAttributes(oldStateCell), Color.CYAN); oldStateCell.setAttributes(graph.getAttributes(oldStateCell)); } DefaultGraphCell newStateCell = stateCells.get(newState); GraphConstants.setBackground(graph.getAttributes(newStateCell), Color.RED); newStateCell.setAttributes(graph.getAttributes(newStateCell)); graph.repaint(); this.repaint(); graph.refresh(); } }
private DefaultGraphCell createCell(K stateKey, Point2D placement) { // System.out.println(name + " " + placement + " " + index); String cellName = stateKey.toString(); DefaultGraphCell stateCell = new DefaultGraphCell(new String(cellName)); Font font = new Font("Arial", Font.PLAIN, 12); GraphConstants.setFont(stateCell.getAttributes(), font); GraphConstants.setAutoSize(stateCell.getAttributes(), true); GraphConstants.setOpaque(stateCell.getAttributes(), true); Color color = colorStateCell(stateKey); GraphConstants.setBackground(stateCell.getAttributes(), color); GraphConstants.setBounds(stateCell.getAttributes(), new Rectangle2D.Double(placement.getX(), placement.getY(), 0, 0)); stateCell.addPort(); return stateCell; }
private DefaultGraphCell createCell(String name, Point2d placement, int index) { // System.out.println(name + " " + placement + " " + index); stateCells[index] = new DefaultGraphCell(new String(name)); Font f = new Font("Arial", Font.PLAIN, 12); GraphConstants.setFont(stateCells[index].getAttributes(), f); GraphConstants.setAutoSize(stateCells[index].getAttributes(), true); GraphConstants.setOpaque(stateCells[index].getAttributes(), true); Color color = colorStateCell(stateMachine.states.get(indexOfStateinStateMachine(name))); GraphConstants.setBackground(stateCells[index].getAttributes(), color); GraphConstants.setBounds(stateCells[index].getAttributes(), new Rectangle2D.Double(placement.getX(), placement.getY(), 0, 0)); stateCells[index].addPort(); return stateCells[index]; }
private DefaultGraphCell createCell(String name, Point2D placement, int index) { // System.out.println(name + " " + placement + " " + index); stateCells[index] = new DefaultGraphCell(new String(name)); Font f = new Font("Arial", Font.PLAIN, 12); GraphConstants.setFont(stateCells[index].getAttributes(), f); GraphConstants.setAutoSize(stateCells[index].getAttributes(), true); GraphConstants.setOpaque(stateCells[index].getAttributes(), true); Color color = colorStateCell(stateMachine.states.get(indexOfStateinStateMachine(name))); GraphConstants.setBackground(stateCells[index].getAttributes(), color); GraphConstants.setBounds(stateCells[index].getAttributes(), new Rectangle2D.Double(placement.getX(), placement.getY(), 0, 0)); stateCells[index].addPort(); return stateCells[index]; }
public void stateChanged(State<E> oldState, State<E> newState, double time) { if (oldStateDiagram) { this.repaint(); } else { int newIndex = indexOfStateInStateCells(newState); int oldIndex = indexOfStateInStateCells(oldState); GraphConstants.setBackground(graph.getAttributes(stateCells[oldIndex]), Color.CYAN); GraphConstants.setBackground(graph.getAttributes(stateCells[newIndex]), Color.RED); stateCells[oldIndex].setAttributes(graph.getAttributes(stateCells[oldIndex])); stateCells[newIndex].setAttributes(graph.getAttributes(stateCells[newIndex])); graph.repaint(); this.repaint(); graph.refresh(); } }
public void stateChanged(State<E> oldState, State<E> newState, double time) { if (oldStateDiagram) { this.repaint(); } else { int newIndex = indexOfStateInStateCells(newState); int oldIndex = indexOfStateInStateCells(oldState); GraphConstants.setBackground(graph.getAttributes(stateCells[oldIndex]), Color.CYAN); GraphConstants.setBackground(graph.getAttributes(stateCells[newIndex]), Color.RED); stateCells[oldIndex].setAttributes(graph.getAttributes(stateCells[oldIndex])); stateCells[newIndex].setAttributes(graph.getAttributes(stateCells[newIndex])); graph.repaint(); this.repaint(); graph.refresh(); } }
public void updateStateMachine() { State<E> currentState = stateMachine.getCurrentState(); if (oldStateDiagram) { this.repaint(); } else { int currentIndex = indexOfStateInStateCells(currentState); GraphConstants.setBackground(graph.getAttributes(stateCells[currentIndex]), Color.RED); stateCells[currentIndex].setAttributes(graph.getAttributes(stateCells[currentIndex])); for (int i = 0; i < stateCells.length; i++) { if (i != currentIndex) { GraphConstants.setBackground(graph.getAttributes(stateCells[i]), Color.CYAN); stateCells[i].setAttributes(graph.getAttributes(stateCells[i])); } } graph.repaint(); graph.refresh(); } }
public void updateStateMachine() { State<E> currentState = stateMachine.getCurrentState(); if (oldStateDiagram) { this.repaint(); } else { int currentIndex = indexOfStateInStateCells(currentState); GraphConstants.setBackground(graph.getAttributes(stateCells[currentIndex]), Color.RED); stateCells[currentIndex].setAttributes(graph.getAttributes(stateCells[currentIndex])); for (int i = 0; i < stateCells.length; i++) { if (i != currentIndex) { GraphConstants.setBackground(graph.getAttributes(stateCells[i]), Color.CYAN); stateCells[i].setAttributes(graph.getAttributes(stateCells[i])); } } graph.repaint(); graph.refresh(); } }
GraphConstants.setBorder(map, new TitledBorder(new LineBorder(Color.GRAY), "Inputs")); GraphConstants.setBackground(map, Color.WHITE); GraphConstants.setEditable(map, false); GraphConstants.setSelectable(map, false); GraphConstants.setBorder(map, new TitledBorder(new LineBorder(Color.GRAY), "Outputs")); GraphConstants.setBackground(map, Color.WHITE); GraphConstants.setEditable(map, false); GraphConstants.setSelectable(map, false); GraphConstants.setBackground(map, GraphColours.getColour(ProcessorHelper .getPreferredColour(processor), Color.WHITE)); GraphConstants.setOpaque(map, true); if (node instanceof InputPort) GraphConstants.setBackground(map, GraphColours.getColour("lightsteelblue2", Color.WHITE)); GraphConstants.setBackground(map, GraphColours .getColour("skyblue", Color.WHITE));
GraphConstants.setBackground(attr,new Color(212,219,206)); GraphConstants.setBorderColor(attr, Color.GRAY); GraphConstants.setLabelAlongEdge(attr,true);