/** * Set the foreground color. * * @param color the new foreground color or <code>null</code> */ public void setForeground(Color color) { Color oldVal = this.getForeground(); setAttribute(SELECTOR_ALL, CSSProperty.COLOR, CSSStyleSheet.getAttribute(color)); propertyChangeSupport.firePropertyChange("foreground", oldVal, this.getForeground()); }
/** * Append a inline CSS style definition for the passed component of the aspect foreground- and background color. * * @param styleString StringBuilder to append to * @param component Component to use as style source * @return The passed styleString */ public static StringBuilder appendCSSComponentInlineColorStyle(StringBuilder styleString, final SComponent component) { if (component != null) { if (component.getBackground() != null) { styleString.append("background-color:#").append(toColorString(component.getBackground())).append(";"); } if (component.getForeground() != null) { styleString.append("color:#").append(toColorString(component.getForeground())).append(";"); } } return styleString; }
/** * {@inheritDoc} */ @Override public void updateState() { if (isReadable()) { if (savedForeground != null) { getConnectedSComponent().setForeground(savedForeground); } savedForeground = null; } else if (savedForeground == null) { savedForeground = getConnectedSComponent().getForeground(); getConnectedSComponent().setForeground( getConnectedSComponent().getBackground()); } }
/** * {@inheritDoc} */ @Override public void readabilityChange() { super.readabilityChange(); if (isReadable()) { if (savedForeground != null) { getConnectedSComponent().setForeground(savedForeground); } savedForeground = null; } else if (savedForeground == null) { savedForeground = getConnectedSComponent().getForeground(); getConnectedSComponent().setForeground( getConnectedSComponent().getBackground()); } }