List of usage examples for com.google.gwt.user.client Element addClassName
@Override public boolean addClassName(String className)
From source file:info.magnolia.ui.vaadin.gwt.client.magnoliashell.viewport.widget.AppPreloader.java
License:Open Source License
public AppPreloader() { super();//from w w w. j av a2 s.com setElement(root); setStyleName("v-app-preloader v-viewport v-shell-tabsheet app"); navigator.addClassName("nav nav-tabs single-tab"); tab.addClassName("clearfix active"); tabCaption.setClassName("tab-title"); tab.appendChild(tabCaption); navigator.appendChild(tab); root.appendChild(navigator); Element preloader = DOM.createDiv(); preloader.addClassName("v-preloader"); Element loading = DOM.createSpan(); loading.addClassName("v-caption"); loading.setInnerText("Loading"); preloader.appendChild(new LoadingIconWidget().getElement()); preloader.appendChild(DOM.createElement("br")); preloader.appendChild(loading); root.appendChild(preloader); }
From source file:org.bonitasoft.forms.client.view.controller.FormPagesViewController.java
License:Open Source License
/** * Insert the widget in the page//from w w w.java 2s . c o m * * @param pageHTMLPanel * the HTMLPanel * @param formWidgetData * the widget definition * @param widget * the widget to insert * @param containerStyle * the style to apply to the container */ protected void insertWidget(final HTMLPanel pageHTMLPanel, final ReducedFormWidget formWidgetData, final Widget widget, final String containerStyle) { if (formWidgetData.isDisplayCondition()) { final Element widgetParentElement = pageHTMLPanel.getElementById(formWidgetData.getId()); final String widgetStyle; if (formWidgetData.getStyle() != null && formWidgetData.getStyle().length() > 0) { widgetStyle = containerStyle + " " + formWidgetData.getStyle(); } else { widgetStyle = containerStyle; } if (widgetParentElement != null) { pageHTMLPanel.add(widget, widgetParentElement); widgetParentElement.addClassName(widgetStyle); } else { Window.alert( "An element with id " + formWidgetData.getId() + " is missing from the page template."); } } }
From source file:org.bonitasoft.web.toolkit.client.ui.component.CodeFormatter.java
License:Open Source License
/** * Generate the DOM Element corresponding to the current CodeFormatter. */// w ww . j av a 2 s . co m @Override protected Element makeElement() { final Element pre = DOM.createElement("pre"); final Element code = DOM.createElement("code"); if (this.language != null) { code.addClassName(this.language); } code.setInnerText(this.code); pre.appendChild(code); return pre; }
From source file:org.bonitasoft.web.toolkit.client.ui.component.containers.ContainerStyled.java
License:Open Source License
@SuppressWarnings("unchecked") @Override/*from w w w .j a v a2 s.co m*/ protected Element makeElement() { // Root element this.element = DOM.createElement(this.rootTagName); if (this.rootTagClass != null) { this.element.addClassName(this.rootTagClass); } if (getJsId() != null) { this.element.addClassName(getJsId().toString()); } // Styling and adding children final int size = this.components.size(); int counter = 0; for (final T component : this.components) { final List<Element> childElements = component.getElements(); // Set style on children if also styled (and avoid mapper) if (component instanceof ContainerStyled) { childElements.get(0).addClassName( this.makeClasses(((ContainerStyled<Node>) component).getRootTagClass(), counter, size - 1)); // Adding this to DOM HTML.append(this.element, childElements); } // If we use a wrapper else if (this.wrapTagName != null) { final Element wrapper = DOM.createElement(this.wrapTagName); if (this.wrapTagClass != null) { wrapper.addClassName(this.wrapTagClass); wrapper.addClassName(this.makeClasses(this.wrapTagClass, counter, size - 1)); } else { wrapper.addClassName(this.makeClasses("", counter, size - 1)); } HTML.append(wrapper, childElements); // Adding this to DOM this.element.appendChild(wrapper); } // If we don't use a wrapper else { // If the component is a singleElementComponent, we set the style on the component if (component instanceof Component) { if (this.wrapTagClass != null) { childElements.get(0).addClassName(this.wrapTagClass); childElements.get(0).addClassName(this.makeClasses(this.wrapTagClass, counter, size - 1)); } else { childElements.get(0).addClassName(this.makeClasses("", counter, size - 1)); } } // Adding this to DOM HTML.append(this.element, childElements); } counter++; } return this.element; }
From source file:org.bonitasoft.web.toolkit.client.ui.component.form.AbstractForm.java
License:Open Source License
@Override protected Element makeElement() { final Element form = DOM.createForm(); form.addClassName("form"); if (getJsId() != null) { form.addClassName(getJsId().toString("form")); }//from ww w . j ava2 s . c o m form.appendChild(this.containers.firstElement().getElement()); form.appendChild(this.buttons.getElement()); GQuery.$(form).submit(new Function() { @Override public boolean f(final Event e) { e.stopPropagation(); AbstractForm.this.defaultAction.execute(); return false; } }); return form; }
From source file:org.bonitasoft.web.toolkit.client.ui.component.form.entry.FormEntry.java
License:Open Source License
@Override protected Element makeElement() { Boolean isMandatory = false;//from w w w.j a v a 2 s . c om final Element entry = DOM.createDiv(); entry.addClassName("formentry"); entry.addClassName(getJsId().toString("formentry").toLowerCase()); this.labelElement = DOM.createDiv(); this.labelElement.addClassName("label"); for (final Validator validator : getValidators()) { if (validator instanceof MandatoryValidator) { isMandatory = true; entry.addClassName("mandatory"); break; } } final Element label = DOM.createLabel(); label.setInnerText(this.label); label.setTitle(this.tooltip); label.setAttribute("for", this.uid.toLowerCase()); if (isMandatory) { final Element mandatorySpan = DOM.createSpan(); mandatorySpan.addClassName("mandatoryflag"); mandatorySpan.setInnerText("*"); label.appendChild(mandatorySpan); } this.labelElement.appendChild(label); if (this.description != null) { final Element description = DOM.createDiv(); description.addClassName("description"); description.setInnerText(this.description); this.labelElement.appendChild(description); } entry.appendChild(this.labelElement); final Element body = DOM.createDiv(); body.addClassName("input"); final Element input = makeInput(this.uid); if (this.inputElement == null) { this.inputElement = input; } body.appendChild(input); if (this.example != null) { final Element example = DOM.createDiv(); example.addClassName("example"); example.setInnerText(this.example); body.appendChild(example); } entry.appendChild(body); return entry; }
From source file:org.bonitasoft.web.toolkit.client.ui.component.form.entry.Tab.java
License:Open Source License
@Override protected void postProcessHtml() { this.element.addClassName("body"); final Element newRoot = DOM.createElement("div"); newRoot.addClassName("tab"); newRoot.appendChild(this.element); this.element = newRoot; super.postProcessHtml(); }
From source file:org.bonitasoft.web.toolkit.client.ui.component.menu.MenuLink.java
License:Open Source License
@Override protected Element makeElement() { final Element rootElement = DOM.createElement("li"); if (linkId != null) { link.setId(this.linkId); }/*from w w w . ja va 2s . c o m*/ Element linkElement = this.link.getElement(); linkElement.setAttribute("href", "#"); rootElement.appendChild(linkElement); if (this.link.getJsId() != null) { rootElement.addClassName(this.link.getJsId().toString()); } return rootElement; }
From source file:org.bonitasoft.web.toolkit.client.ui.component.table.filters.TableFilter.java
License:Open Source License
protected Element makeRootElement() { // Root tag/* ww w . j ava2s. c o m*/ final Element e = DOM.createDiv(); e.addClassName("tablefilter"); e.addClassName(new JsId(this.name).toString("tablefilter")); e.setAttribute("title", this.tooltip); // Label e.setInnerHTML(HTML.label(this.label, XML.getUniqueId())); return e; }
From source file:org.bonitasoft.web.toolkit.client.ui.component.table.filters.TableFilterSelect.java
License:Open Source License
@Override protected Element makeElement() { // Root tag//from ww w . j av a 2s.co m final Element rootElement = makeRootElement(); rootElement.addClassName("tablefilterselect"); // Input this.selectElement = $(HTML.select(this.name, new XMLAttributes("id", XML.getLastUniqueId()))); for (final Entry<String, String> entry : this.options.entrySet()) { makeOptionHtml(entry.getKey(), entry.getValue(), entry.getValue().equals(this.value)); } this.selectElement.change(new Function() { @Override public boolean f(final Event e) { TableFilterSelect.this.table.setPage(0); TableFilterSelect.this.table.refresh(); return true; } }); rootElement.appendChild(this.selectElement.get(0)); return rootElement; }