private Color getStatusColour(String status) { if (status.equals("ProcessComplete")) { return GraphColours.getColour("medium sea green", Color.GREEN); } else if (status.equals("ServiceError") || status.equals("ServiceFailure")) { return GraphColours.getColour("firebrick1", Color.RED); } else if (status.startsWith("Invoking")) { return GraphColours.getColour("medium purple", Color.MAGENTA); } return GraphColours.getColour("light gray", Color.GRAY); }
/** * Return the color in the color table with the given name. If the name is parseable as a * numeric color, use that Otherwise, If the color is not found, the supplied default is * returned. If the supplied default is null, the class default is returned. The name search is * case insensitive and looks at alphanumerics only. * * @param name * the name of the color to be retrieved. * @param def * the color value to return if requested color is not found. * * @return the color matching the name or the default. */ public static Color getColour(String name, Color def) { if (def == null) def = defaultColor; if (name == null) return def; Color retColor = parseNumericColor(name); if (retColor == null) { String canonName = canonColor(name); retColor = colorTable.get(canonName); } return (retColor == null) ? def : retColor; }
/** * Adds a color to the application color table. For search purposes, names are canonicalized by * converting to lower case and stripping non-alphanumerics. A name must contains at least one * alphabetic. Once in the table, colors can be set by name, and names can be retrieved by color * (although a single color referred to by multiple names only causes the retrieval of the last * name mapped to that color). * * @param name * the name to be used to reference the color. * @param color * the Color value. * @throws IllegalArgumentException */ public static void addColor(String name, Color color) throws IllegalArgumentException { if (name == null || color == null) { throw new IllegalArgumentException("supplied name or color is null"); } String canonName = canonColor(name); if (canonName == null) { throw new IllegalArgumentException("supplied name does not contain alphabetics (" + name + ")"); } doAddColor(canonName, color); }
private static void doAddColor(String name, Color color) { doAddColor(name, color, true); }
public JComponent getComponent(Processor processor) { col = GraphColours.getColour(ProcessorHelper .getPreferredColour(processor), Color.WHITE); col2 = ShadedLabel.halfShade(col);
setOpaque(false); setLayout(new BorderLayout()); col = GraphColours.getColour(ProcessorHelper .getPreferredColour(processor), Color.WHITE); col2 = ShadedLabel.halfShade(col);
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)); .getColour("skyblue", Color.WHITE));