Example usage for com.google.gwt.user.client Element addClassName

List of usage examples for com.google.gwt.user.client Element addClassName

Introduction

In this page you can find the example usage for com.google.gwt.user.client Element addClassName.

Prototype

@Override
    public boolean addClassName(String className) 

Source Link

Usage

From source file:com.alkacon.forms.client.ComplexTypeRenderer.java

License:Open Source License

/**
 * @see com.alkacon.forms.client.I_EntityRenderer#render(com.alkacon.vie.shared.I_Entity, com.google.gwt.user.client.Element)
 *///  www  .  ja va  2 s.c o  m
public void render(I_Entity entity, Element context) {

    Element result = DOM.createDiv();
    result.addClassName(ENTITY_CLASS);
    result.setAttribute("typeof", Vie.removePointyBrackets(entity.getTypeName()));
    result.setAttribute("about", Vie.removePointyBrackets(entity.getId()));
    I_Type entityType = m_vie.getType(entity.getTypeName());
    List<String> attributeNames = entityType.getAttributeNames();
    for (String attributeName : attributeNames) {
        I_Type attributeType = entityType.getAttributeType(attributeName);
        I_EntityRenderer renderer = m_widgetService.getRendererForAttribute(attributeName, attributeType);
        Element label = DOM.createDiv();
        label.setInnerText(m_widgetService.getAttributeLabel(attributeName));
        label.addClassName(LABEL_CLASS);
        label.setTitle(m_widgetService.getAttributeHelp(attributeName));
        result.appendChild(label);
        renderer.render(entity, attributeName, result, entityType.getAttributeMinOccurrence(attributeName),
                entityType.getAttributeMaxOccurrence(attributeName));
    }
    context.appendChild(result);
}

From source file:com.alkacon.forms.client.ComplexTypeRenderer.java

License:Open Source License

/**
 * @see com.alkacon.forms.client.I_EntityRenderer#render(com.alkacon.vie.shared.I_Entity, java.lang.String, com.google.gwt.user.client.Element, int, int)
 */// w w w . j  a va 2 s  . c om
public void render(I_Entity parentEntity, String attributeName, Element context, int minOccurrence,
        int maxOccurrence) {

    I_EntityAttribute attribute = parentEntity.getAttribute(attributeName);
    Element holderDiv = DOM.createDiv();
    holderDiv.addClassName(WIDGET_HOLDER_CLASS);
    if (attribute.isSimpleValue()) {
        for (int i = 0; i < attribute.getSimpleValues().size(); i++) {
            String value = attribute.getSimpleValues().get(i);
            Element valueDiv = DOM.createDiv();
            valueDiv.setAttribute("property", Vie.removePointyBrackets(attributeName));
            valueDiv.setInnerText(value);
            holderDiv.appendChild(valueDiv);
            context.appendChild(holderDiv);
            m_widgetService.getAttributeWidget(attributeName).initWidget(valueDiv, parentEntity, attributeName,
                    i);
        }
    } else {
        for (I_Entity entity : attribute.getComplexValues()) {
            holderDiv.setAttribute("rel", attributeName);
            render(entity, holderDiv);
        }
    }
}

From source file:com.alkacon.geranium.client.ui.input.InlineLabel.java

License:Open Source License

/**
 * Creates a DIV element with display=inline/inlineBlock.<p>
 * //w  ww.j  a v a 2  s. c o m
 * @return a DIV element (inline or inline-block)
 */
private static Element createElement() {

    Element element = DOM.createDiv();
    element.addClassName(CSS.inlineBlock());
    return element;
}

From source file:com.ciplogic.web.codeeditor.render.html.ClassStyleResolver.java

License:Open Source License

private Element createElement() {
    Element containerDiv = DOM.createDiv();

    containerDiv.setAttribute("style", "display : none");
    containerDiv.setClassName("CodeMirror");
    containerDiv.addClassName("cm-s-default");

    Element div = DOM.createDiv();
    containerDiv.appendChild(div);//from w  w w.  j a v a 2 s  .c  o m

    Element preElement = DOM.createElement("pre");
    div.appendChild(preElement);

    Element spanElement = DOM.createSpan();
    preElement.appendChild(spanElement);

    Document.get().getBody().appendChild(containerDiv);

    return spanElement;
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

public static void addClass(String id, String classToAdd) {
    Element elementById = DOM.getElementById(id);
    if (elementById != null)
        elementById.addClassName(classToAdd);
}

From source file:com.eduworks.gwt.client.pagebuilder.screen.ScreenTemplate.java

License:Apache License

public static void setAlertBoxMessage(String message, AlertType type, final String containerName) {

    Element messageContainer = DOM.getElementById(containerName);

    if (messageContainer != null) {

        messageContainer.getFirstChildElement().setInnerText(message);

        clearAlertState();//from   w ww  .  j  av  a2  s.  c  o m

        if (type == AlertType.WARNING) {
            messageContainer.addClassName("warning");
            messageContainer.getStyle().setColor("white");
        } else if (type == AlertType.ERROR) {
            messageContainer.addClassName("alert");
            messageContainer.getStyle().setColor("white");
        } else if (type == AlertType.INFO) {
            messageContainer.addClassName("info");
            messageContainer.getStyle().setColor("black");
        } else if (type == AlertType.SUCCESS) {
            messageContainer.addClassName("success");
            messageContainer.getStyle().setColor("white");
        } else if (type == AlertType.SECONDARY) {
            messageContainer.addClassName("secondary");
            messageContainer.getStyle().setColor("black");
        }

        messageContainer.addClassName("active");
        messageContainer.removeClassName("hidden");

        Timer timeoutTimer = new Timer() {
            public void run() {
                hideAlertBox(containerName);
            }
        };
        timeoutTimer.schedule(TIMER_STATUS_WINDOW_DELAY);
    }
}

From source file:com.eduworks.gwt.client.pagebuilder.screen.ScreenTemplate.java

License:Apache License

public static void hideAlertBox(String containerName) {
    Element messageContainer = DOM.getElementById(containerName);

    if (messageContainer != null) {
        messageContainer.addClassName("hidden");
        messageContainer.removeClassName("active");
    }// ww w .  jav  a 2 s.c om
}

From source file:com.eduworks.gwt.client.pagebuilder.screen.ScreenTemplate.java

License:Apache License

public static void clearAlertState() {
    Element messageContainer = DOM.getElementById("innerMessageContainer");

    if (messageContainer != null) {
        messageContainer.addClassName("hidden");
        messageContainer.removeClassName("active");
        messageContainer.removeClassName("warning");
        messageContainer.removeClassName("alert");
        messageContainer.removeClassName("info");
        messageContainer.removeClassName("success");
        messageContainer.removeClassName("secondary");
    }//from w  w w  . j  av  a2 s . c om
}

From source file:com.googlecode.mgwt.ui.client.widget.HeaderButton.java

License:Apache License

/**
 * Construct a HeaderButton with a given css
 * // w w w. jav a2 s. c  o m
 * @param css the css to use
 */
public HeaderButton(HeaderCss css) {
    super(css);
    this.headerCss = css;
    addStyleName(css.headerButton());

    Element pointDiv = DOM.createDiv();
    pointDiv.addClassName(css.headerButtonBorderContainer());
    Element pointSpan = DOM.createSpan();
    pointSpan.addClassName(css.headerButtonBorderContent());
    pointDiv.appendChild(pointSpan);
    getElement().appendChild(pointDiv);

    pElement = Document.get().createPElement();
    pElement.addClassName(css.headerButtonText());
    getElement().appendChild(pElement);

}

From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.verticalsplitpanel.VDDVerticalSplitPanel.java

License:Apache License

/**
 * Emphasisizes a container element/*w  w w. j a v  a2s . co m*/
 * 
 * @param element
 */
protected void emphasis(Element element) {
    // Remove previous emphasis
    deEmphasis();

    // validate container
    if (element == null || !getElement().isOrHasChild(element)) {
        return;
    }

    if (element == firstContainer || element == secondContainer) {
        element.addClassName(OVER);
        currentEmphasis = element;
    } else if (splitter.isOrHasChild(element)) {
        currentEmphasis = splitter.getChild(0).cast();
        currentEmphasis.addClassName(OVER_SPLITTER);
    }
}