Search in sources :

Example 31 with Element

use of com.codename1.xml.Element in project CodenameOne by codenameone.

the class CSSEngine method applyStyle.

/**
 * Applies the given style attributes to the HTML DOM entry
 *
 * @param element The element to apply the style to
 * @param selector The selector containing the style directives
 * @param htmlC The HTMLComponent
 */
private void applyStyle(HTMLElement element, CSSElement selector, HTMLComponent htmlC) {
    if ((element.getUi() != null) && (element.getUi().size() > 0)) {
        if (!HTMLComponent.PROCESS_HTML_MP1_ONLY) {
            String reset = selector.getAttributeById(CSSElement.CSS_COUNTER_RESET);
            if (reset != null) {
                htmlC.incCounter(reset, true);
            }
            String inc = selector.getAttributeById(CSSElement.CSS_COUNTER_INCREMENT);
            if (inc != null) {
                htmlC.incCounter(inc, false);
            }
            if ((selector.getSelectorPseudoClass() & (CSSElement.PC_BEFORE | CSSElement.PC_AFTER)) != 0) {
                handleContentProperty(element, selector, htmlC);
                return;
            }
        }
        for (int iter = 0; iter < element.getUi().size(); iter++) {
            Object o = element.getUi().elementAt(iter);
            if (o != null && o instanceof Component) {
                final Component cmp = (Component) o;
                applyStyleToUIElement(cmp, selector, element, htmlC);
            }
        }
    }
}
Also used : Component(com.codename1.ui.Component)

Aggregations

Container (com.codename1.ui.Container)9 Label (com.codename1.ui.Label)9 Vector (java.util.Vector)9 Component (com.codename1.ui.Component)8 Button (com.codename1.ui.Button)5 Style (com.codename1.ui.plaf.Style)5 RadioButton (com.codename1.ui.RadioButton)4 TextArea (com.codename1.ui.TextArea)4 BorderLayout (com.codename1.ui.layouts.BorderLayout)4 BoxLayout (com.codename1.ui.layouts.BoxLayout)4 Border (com.codename1.ui.plaf.Border)4 Dimension (com.codename1.ui.geom.Dimension)3 EditableResources (com.codename1.ui.util.EditableResources)3 Hashtable (java.util.Hashtable)3 TextField (com.codename1.ui.TextField)2 Rectangle (com.codename1.ui.geom.Rectangle)2 CharArrayReader (com.codename1.io.CharArrayReader)1 NetworkEvent (com.codename1.io.NetworkEvent)1 CheckBox (com.codename1.ui.CheckBox)1 Command (com.codename1.ui.Command)1