Avant de lire cette section, veuillez lire la section tooltip-uppercase . Cette section permet de gérer la propriété composite CSS tooltip avec le style CSS suivant :
JLabel {
tooltip:'bla bla bla content' true;
}
JLabel label = new JLabel();
label.setText("Jlabel text");
label.setToolTipText("bla bla bla...");

package com.mycompany.myapp.css.properties;
import org.akrogen.tkui.css.core.dom.properties.AbstractCSSPropertyCompositeHandler;
import org.akrogen.tkui.css.core.engine.CSSEngine;
import org.w3c.dom.css.CSSPrimitiveValue;
import org.w3c.dom.css.CSSValue;
public abstract class AbstractCSSPropertyTooltipCompositeHandler extends
AbstractCSSPropertyCompositeHandler {
private static final String[] TOOLTIP_CSSPROPERTIES = {
"tooltip-uppercase", "tooltip-content" };
public void applyCSSProperty(Object element, CSSValue value, String pseudo,
CSSEngine engine) throws Exception {
if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value;
short type = primitiveValue.getPrimitiveType();
switch (type) {
case CSSPrimitiveValue.CSS_IDENT:
engine.applyCSSProperty(element, "tooltip-uppercase", value,
pseudo);
break;
case CSSPrimitiveValue.CSS_STRING:
engine.applyCSSProperty(element, "tooltip-content", value,
pseudo);
break;
}
}
}
public boolean isCSSPropertyComposite(String property) {
return "tooltip".equals(property);
}
public String[] getCSSPropertiesNames(String property) {
if ("tooltip".equals(property))
return TOOLTIP_CSSPROPERTIES;
return null;
}
}
Veuillez modifier l'interface ICSSPropertyTooltipHandler qui ajoute les méthodes applyCSSProperty* et retrieveCSSProperty* pour les 2 nouvelles propriétés CSS tooltip-uppercase et tooltip-content .
package com.mycompany.myapp.css.properties;
import org.akrogen.tkui.css.core.engine.CSSEngine;
import org.w3c.dom.css.CSSValue;
public abstract class AbstractCSSPropertyTooltipHandler extends
AbstractCSSPropertyTooltipCompositeHandler implements
ICSSPropertyTooltipHandler {
public boolean applyCSSProperty(Object element, String property,
CSSValue value, String pseudo, CSSEngine engine) throws Exception {
if ("tooltip".equals(property)) {
super.applyCSSPropertyComposite(element, property, value, pseudo,
engine);
}
if ("tooltip-uppercase".equals(property)) {
applyCSSPropertyTooltipUpperCase(element, property, value, pseudo,
engine);
}
if ("tooltip-content".equals(property)) {
applyCSSPropertyTooltipContent(element, property, value, pseudo,
engine);
}
return false;
}
public String retrieveCSSProperty(Object element, String property,
CSSEngine engine) throws Exception {
if ("tooltip-uppercase".equals(property)) {
return retrieveCSSPropertyTooltipUpperCase(element, property,
engine);
}
if ("tooltip-content".equals(property)) {
return retrieveCSSPropertyTooltipContent(element, property, engine);
}
return null;
}
}