Example usage for com.google.gwt.dom.client SpanElement addClassName

List of usage examples for com.google.gwt.dom.client SpanElement addClassName

Introduction

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

Prototype

@Override
    public boolean addClassName(String className) 

Source Link

Usage

From source file:com.smartgwt.mobile.client.widgets.tableview.TableView.java

License:Open Source License

/**
 * Renders the records in <code>recordsToShow</code> on screen.
 *
 * @see #getShowRecordComponents()//from w ww  .  j  av a  2  s .c  om
 */
public void loadRecords(List<Record> recordsToShow) {
    destroyRecordComponents();
    final boolean hadShowDeletableRecordsClassName, hadShowMoveableRecordsClassName;
    if (_ul != null) {
        hadShowDeletableRecordsClassName = ElementUtil.hasClassName(_ul,
                _CSS.tableViewShowDeleteDisclosuresClass());
        hadShowMoveableRecordsClassName = ElementUtil.hasClassName(_ul,
                _CSS.tableViewShowMoveIndicatorsClass());
        if (_ul.hasParentElement()) {
            _ul.removeFromParent();
        }
    } else {
        hadShowDeletableRecordsClassName = false;
        hadShowMoveableRecordsClassName = false;
    }
    final Document document = Document.get();
    _ul = document.createULElement();
    _ul.addClassName(COMPONENT_CLASS_NAME);
    if (parentNavStack != null) {
        _ul.addClassName(_CSS.tableViewHasParentNavStackClass());
    }
    if (hadShowDeletableRecordsClassName) {
        _ul.addClassName(_CSS.tableViewShowDeleteDisclosuresClass());
    }
    if (hadShowMoveableRecordsClassName) {
        _ul.addClassName(_CSS.tableViewShowMoveIndicatorsClass());
    }
    if (this.tableMode == TableMode.GROUPED) {
        _ul.addClassName(_CSS.groupedTableViewClass());
    }

    if (recordsToShow == null)
        recordsToShow = Collections.emptyList();
    for (int i = 0; i < recordsToShow.size(); ++i) {
        final Record record = recordsToShow.get(i);
        if (record == null)
            throw new NullPointerException("The Record at index " + i + " is null.");
        record.setAttribute(recordIndexProperty, Integer.valueOf(i));
    }

    ListGridField groupByField = null;
    GroupNode[] sortedGroupNodes = null;

    // Handle table grouping
    if (groupByFieldName != null) {
        final ListGridField[] fields = getFields();
        if (fields != null) {
            for (ListGridField field : fields) {
                if (field != null && groupByFieldName.equals(field.getName())) {
                    groupByField = field;
                    break;
                }
            }
        }

        if (groupByField == null) {
            SC.logWarn("Could not find groupByField '" + groupByFieldName + "'");
        } else if (groupByField.getGroupValueFunction() == null) {
            SC.logWarn("The groupByField '" + groupByFieldName + "' does not have a GroupByFunction.");
        } else {
            final GroupValueFunction groupByFunction = groupByField.getGroupValueFunction();
            final Map<Object, GroupNode> groupNodes = new LinkedHashMap<Object, GroupNode>();
            for (Record record : recordsToShow) {
                final Object groupValue = groupByFunction.getGroupValue(
                        record.getAttributeAsObject(groupByFieldName), record, groupByField, groupByFieldName,
                        this);
                GroupNode groupNode = groupNodes.get(groupValue);
                if (groupNode == null) {
                    groupNode = new GroupNode(groupValue);
                    groupNodes.put(groupValue, groupNode);
                }
                groupNode._add(record);
            }

            sortedGroupNodes = groupNodes.values().toArray(new GroupNode[groupNodes.size()]);
            Arrays.sort(sortedGroupNodes, GroupNode._COMPARATOR);
        }
    }

    elementMap = new HashMap<Object, Element>();
    if (getShowRecordComponents())
        recordComponents = new ArrayList<Canvas>();

    if (recordsToShow.isEmpty()) {
        if (_getData() instanceof ResultSet && !((ResultSet) _getData()).lengthIsKnown()) {
            _ul.setInnerText(this.getLoadingMessage());
        } else {
            if (emptyMessage != null)
                _ul.setInnerText(emptyMessage);
        }
        getElement().appendChild(_ul);
    } else {
        UListElement ul = _ul;
        LIElement lastLI;
        if (sortedGroupNodes == null) {
            lastLI = showGroup(recordsToShow, ul);
        } else {
            assert groupByField != null;
            assert sortedGroupNodes.length >= 1;

            final GroupTitleRenderer groupTitleRenderer = groupByField.getGroupTitleRenderer();

            int i = 0;
            LIElement li;
            do {
                final GroupNode groupNode = sortedGroupNodes[i];
                groupNode._setGroupTitle(
                        groupTitleRenderer == null ? SafeHtmlUtils.htmlEscape(groupNode._getGroupValueString())
                                : groupTitleRenderer.getGroupTitle(groupNode.getGroupValue(), groupNode,
                                        groupByField, groupByFieldName, this));

                li = document.createLIElement();
                li.setAttribute(GROUP_VALUE_STRING_ATTRIBUTE_NAME, groupNode._getGroupValueString());
                if (ul == null || _ul.equals(ul))
                    li.addClassName(_CSS.firstTableViewGroupClass());
                final String groupTitle = groupNode.getGroupTitle();
                if (groupTitle == null) {
                    li.addClassName(_CSS.tableViewGroupWithoutGroupTitleClass());
                } else {
                    final DivElement labelDiv = document.createDivElement();
                    labelDiv.setClassName(Label.COMPONENT_CLASS_NAME);
                    labelDiv.setInnerHTML(groupTitle);
                    li.appendChild(labelDiv);
                }
                ul = document.createULElement();
                ul.setClassName(COMPONENT_CLASS_NAME);
                ul.addClassName(TABLE_GROUP_CLASS_NAME);
                lastLI = showGroup(groupNode._getGroupMembersList(), ul);
                if (i != sortedGroupNodes.length - 1 && lastLI != null) {
                    lastLI.addClassName(_CSS.lastTableViewRowClass());
                }
                li.appendChild(ul);
                _ul.appendChild(li);
            } while (++i < sortedGroupNodes.length);
            assert li != null;
            li.addClassName(_CSS.lastTableViewGroupClass());
        }

        if (_getData() instanceof ResultSet) {
            ResultSet rs = (ResultSet) _getData();
            if (rs.getFetchMode() == FetchMode.PAGED && !rs.allRowsCached()) {
                LIElement li = document.createLIElement();
                li.setClassName(ROW_CLASS_NAME);
                com.google.gwt.user.client.Element loadMoreRecordsElement = (com.google.gwt.user.client.Element) li
                        .cast();
                DOM.setEventListener(loadMoreRecordsElement, this);
                SpanElement span = document.createSpanElement();
                span.addClassName(RECORD_TITLE_CLASS_NAME);
                span.setInnerText(SmartGwtMessages.INSTANCE.listGrid_loadMoreRecords());
                span.setAttribute(IS_LOAD_MORE_RECORDS_ATTRIBUTE_NAME, "true");
                li.setAttribute(IS_LOAD_MORE_RECORDS_ATTRIBUTE_NAME, "true");
                li.appendChild(span);
                ul.appendChild(li);
                lastLI = li;
            }
        }
        if (lastLI != null) {
            lastLI.addClassName(_CSS.lastTableViewRowClass());
        }

        getElement().appendChild(_ul);
        setSelecteds();
    }

    if (isAttached()) {
        _fireContentChangedEvent();

        // If this `TableView' is not currently attached, defer the firing of the content
        // changed event.
    } else {
        fireContentChangedOnLoad = true;
    }
}

From source file:com.smartgwt.mobile.client.widgets.tableview.TableView.java

License:Open Source License

private LIElement showGroup(List<Record> recordsToShow, UListElement ul) {
    final Document document = Document.get();
    final String primaryKeyField = getPrimaryKeyFieldName(), iconField = getIconField(),
            titleField = getTitleField(), infoField = getInfoField(), descriptionField = getDescriptionField();
    LIElement lastLI = null;//  w w  w. j a  v  a  2s  . co m
    for (final Record record : recordsToShow) {
        final Canvas recordComponent;
        if (getShowRecordComponents()) {
            recordComponent = createRecordComponent(record);
            if (recordComponent == null) {
                continue;
            } else
                recordComponents.add(recordComponent);
        } else
            recordComponent = null;

        final LIElement li = document.createLIElement();
        li.addClassName(ROW_CLASS_NAME);
        com.google.gwt.user.client.Element element = li.cast();
        final Object recordID = record.getAttributeAsObject(primaryKeyField);
        elementMap.put(recordID, element);
        final Integer recordIndex = record.getAttributeAsInt(recordIndexProperty);
        li.setAttribute(RECORD_INDEX_ATTRIBUTE_NAME, recordIndex.toString());

        if (lastLI == null) {
            li.addClassName(_CSS.firstTableViewRowClass());
        }

        if (showSelectedIcon && selectedIcon == null && getSelectionType() == SelectionStyle.MULTIPLE) {
            DivElement selectionDisclosure = document.createDivElement();
            selectionDisclosure.setClassName(_CSS.recordSelectionDisclosureClass());
            if (!_canSelectRecord(record)) {
                selectionDisclosure.addClassName(_CSS.nonselectableSelectionDisclosureClass());
            }
            SpanElement span = document.createSpanElement();
            selectionDisclosure.appendChild(span);
            li.appendChild(selectionDisclosure);
        }

        if (canRemoveRecords) {
            Boolean deletable = record.getAttributeAsBoolean(canRemoveProperty);
            if (deletable == null || (deletable != null && deletable.booleanValue())) {
                DivElement div = document.createDivElement();
                div.addClassName(_CSS.recordDeleteDisclosureClass());
                SpanElement span = document.createSpanElement();
                div.appendChild(span);
                li.appendChild(div);

                if (markedForRemoval != null && markedForRemoval.contains(record)) {
                    _markRecordRemoved(record, div, true);
                }
            }
        }

        if (canReorderRecords) {
            MoveIndicator draggableRow = new MoveIndicator(element);
            add(draggableRow, element);
        }

        if (!getShowRecordComponents()) {
            if (recordFormatter != null) {
                DivElement div = document.createDivElement();
                div.setClassName("content");
                div.setInnerHTML(recordFormatter.format(record));
                li.appendChild(div);
            } else {
                if (getShowNavigation(record)) {
                    final ImageResource navIcon = getNavigationIcon(record);
                    if (navigationMode == NavigationMode.NAVICON_ONLY) {
                        Boolean navigate = record.getAttributeAsBoolean(getRecordNavigationProperty());
                        if (navigate == null || (navigate != null && navigate.booleanValue())) {
                            final DetailsRow detailsRow = new DetailsRow(navIcon);
                            add(detailsRow, element);
                        }
                    } else if (navIcon != null) {
                        final Image image = new Image(navIcon);
                        image.getElement().addClassName(TableView._CSS.recordDetailDisclosureNavIconClass());
                        add(image, element);
                    } else {
                        li.addClassName(_CSS.tableViewRowHasNavigationDisclosureClass());
                    }
                }
                if (showIcons) {
                    Object icon = record.get(iconField);
                    if (!(icon instanceof ImageResource) && !(icon instanceof Image)) {
                        icon = formatCellValue(record, recordIndex.intValue(), iconField);
                    }
                    if (icon != null) {
                        SpanElement span = document.createSpanElement();
                        span.addClassName(RECORD_ICON_CLASS_NAME);
                        li.appendChild(span);
                        li.addClassName(_CSS.tableViewRowHasIconClass());
                        ImageElement img = document.createImageElement();
                        if (icon instanceof ImageResource) {
                            img.setSrc(((ImageResource) icon).getSafeUri().asString());
                        } else if (icon instanceof Image) {
                            img.setSrc(((Image) icon).getUrl());
                        } else {
                            img.setSrc(icon.toString());
                        }
                        span.appendChild(img);
                    }
                }
                if (showDetailCount) {
                    String count = formatCellValue(record, recordIndex.intValue(), detailCountProperty);
                    if (count != null) {
                        SpanElement span = document.createSpanElement();
                        span.addClassName(RECORD_COUNTER_CLASS_NAME);
                        span.setInnerHTML(count);
                        li.appendChild(span);
                    }
                }
                String title = formatCellValue(record, recordIndex.intValue(), titleField);
                if (title != null) {
                    SpanElement span = document.createSpanElement();
                    final String baseStyle = getBaseStyle(record, recordIndex.intValue(),
                            getFieldNum(titleField));
                    if (baseStyle != null)
                        span.setClassName(baseStyle);
                    span.addClassName(RECORD_TITLE_CLASS_NAME);
                    span.setInnerHTML(title);
                    li.appendChild(span);
                }
                if (recordLayout == RecordLayout.AUTOMATIC || recordLayout == RecordLayout.SUMMARY_FULL
                        || recordLayout == RecordLayout.SUMMARY_INFO) {
                    String info = formatCellValue(record, recordIndex.intValue(), infoField);
                    if (info != null) {
                        ul.addClassName(_CSS.stackedTableViewClass());
                        li.addClassName(_CSS.tableViewRowHasRecordInfoClass());
                        SpanElement span = document.createSpanElement();
                        final String baseStyle = getBaseStyle(record, recordIndex.intValue(),
                                getFieldNum(infoField));
                        if (baseStyle != null)
                            span.setClassName(baseStyle);
                        span.addClassName(RECORD_INFO_CLASS_NAME);
                        span.appendChild(document.createTextNode(info));
                        li.appendChild(span);
                    }
                }
                if (recordLayout == RecordLayout.AUTOMATIC || recordLayout == RecordLayout.TITLE_DESCRIPTION
                        || recordLayout == RecordLayout.SUMMARY_DATA
                        || recordLayout == RecordLayout.SUMMARY_FULL
                        || recordLayout == RecordLayout.SUMMARY_INFO) {
                    String description = formatCellValue(record, recordIndex.intValue(), descriptionField);
                    if (description != null) {
                        SpanElement span = document.createSpanElement();
                        final String baseStyle = getBaseStyle(record, recordIndex.intValue(),
                                getFieldNum(descriptionField));
                        if (baseStyle != null)
                            span.setClassName(baseStyle);
                        span.addClassName(RECORD_DESCRIPTION_CLASS_NAME);
                        span.appendChild(document.createTextNode(description));
                        li.appendChild(span);
                    }
                }
            }
        } else {
            assert recordComponent != null;
            recordComponent.getElement().addClassName(RECORD_COMPONENT_CLASS_NAME);
            add(recordComponent, element);
        }

        ul.appendChild(li);
        lastLI = li;
    }
    return lastLI;
}

From source file:com.smartgwt.mobile.client.widgets.tableview.TableView.java

License:Open Source License

@SGWTInternal
protected void _setSelected(Element element) {
    final SelectionStyle selectionType = getSelectionType();
    assert selectionType != null && selectionType != SelectionStyle.NONE;
    if (!hasClassName(element, _CSS.selectedTableViewRowClass())
            && !hasClassName(element, _CSS.selectedTableViewRowHasIconClass())) {
        if (showSelectedIcon) {
            element.addClassName(_CSS.selectedTableViewRowHasIconClass());
            if (selectionType == SelectionStyle.SINGLE || selectedIcon != null) {
                SpanElement span = Document.get().createSpanElement();
                span.addClassName(_CSS.selectedClass());
                Image image = selectedIcon != null ? new Image(selectedIcon)
                        : impl.getDefaultSingleSelectionIcon();
                image.getElement().addClassName(_CSS.selectedClass());
                span.setInnerHTML(image.toString());
                element.insertFirst(span);
            } else {
                assert selectionType != SelectionStyle.SINGLE;
                assert selectionType == SelectionStyle.MULTIPLE;

                // Find the .selection-disclosure element and add class `CSS.checkedSelectionOrDeleteDisclosureClass()'.
                NodeList<Node> children = element.getChildNodes();
                final int children_length = children.getLength();
                int i = 0;
                for (; i < children_length; ++i) {
                    final Node n = children.getItem(i);
                    if (n.getNodeType() != Node.ELEMENT_NODE) {
                        continue;
                    }//  www  .  j a  va 2 s.c o m
                    final Element child = Element.as(n);
                    if (hasClassName(child, _CSS.recordSelectionDisclosureClass())) {
                        child.addClassName(_CSS.checkedSelectionOrDeleteDisclosureClass());
                        break;
                    }
                }
                assert i < children_length;
            }
        } else {
            element.removeClassName(_CSS.clearingTemporaryTableViewRowSelectionClass());
            element.addClassName(_CSS.selectedTableViewRowClass());
        }
    }
}

From source file:com.tasktop.c2c.server.profile.web.ui.client.view.components.account.profile.AccountNotificationsReadOnlyView.java

License:Open Source License

private void updateCBSpanStyle(SpanElement span, boolean checked) {
    if (checked) {
        span.addClassName("active");
    } else {/*from w  w w.  j  av  a  2 s .co m*/
        span.removeClassName("active");
    }
}

From source file:fr.putnami.pwt.core.widget.client.OutputProgressBar.java

License:Open Source License

public void setValue(T value) {
    this.value = value;
    double val = 0;
    if (value == null) {
        val = this.min;
    } else {/* w  w w . j a va2  s.  c  om*/
        val = value.doubleValue();
    }
    if (val > this.max) {
        val = this.max;
    } else if (val < this.min) {
        val = this.min;
    }

    this.progressBarElement.setAttribute(OutputProgressBar.ATT_ARIA_VALUE, value + "");
    double percent = 100 * (val - this.min) / (this.max - this.min);
    this.progressBarElement.getStyle().setProperty("width", percent, Unit.PCT);

    NumberFormat formatter = NumberFormat.getFormat("#.##");

    String stringToDisplay = this.format;
    stringToDisplay = RegExp.compile("\\{0\\}").replace(stringToDisplay, formatter.format(val));
    stringToDisplay = RegExp.compile("\\{1\\}").replace(stringToDisplay, formatter.format(percent));
    stringToDisplay = RegExp.compile("\\{2\\}").replace(stringToDisplay, formatter.format(this.min));
    stringToDisplay = RegExp.compile("\\{3\\}").replace(stringToDisplay, formatter.format(this.max));

    this.progressBarElement.removeAllChildren();
    if (this.displayValue) {
        this.progressBarElement.setInnerText(stringToDisplay);
    } else {
        SpanElement reader = Document.get().createSpanElement();
        reader.setInnerText(stringToDisplay);
        reader.addClassName("sr-only");
        this.progressBarElement.appendChild(reader);
    }
}

From source file:fr.putnami.pwt.plugin.code.client.output.CodeLineImpl.java

License:Open Source License

@Override
public void redraw() {
    this.getElement().removeAllChildren();
    for (Token<?> token : this.tokenList) {
        if (token.getContent() != null && token.getContent() instanceof CssRendererTokenContent
                && ((CssRendererTokenContent) token.getContent()).getCssStyle() != null) {
            SpanElement spanElement = Document.get().createSpanElement();
            spanElement.addClassName(((CssRendererTokenContent) token.getContent()).getCssStyle());
            spanElement.setInnerText(token.getText());
            this.getElement().appendChild(spanElement);
        } else {//from ww  w.jav a2 s  .  co  m
            Text textElement = Document.get().createTextNode(token.getText());
            this.getElement().appendChild(textElement);
        }
    }
}

From source file:org.drools.workbench.screens.scenariosimulation.client.collectioneditor.CollectionEditorUtils.java

License:Apache License

public static void toggleRowExpansion(SpanElement faAngleRight, boolean toExpand) {
    if (toExpand) {
        faAngleRight.addClassName(FA_ANGLE_DOWN);
        faAngleRight.removeClassName(FA_ANGLE_RIGHT);
    } else {//ww w.  ja v  a 2s. c  o m
        faAngleRight.addClassName(FA_ANGLE_RIGHT);
        faAngleRight.removeClassName(FA_ANGLE_DOWN);
    }
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.endpoint.EndpointProfileViewImpl.java

License:Apache License

@Override
protected void initDetailsTable() {

    detailsTable.getColumnFormatter().setWidth(0, "200px");
    detailsTable.getColumnFormatter().setWidth(1, "550px");
    detailsTable.getColumnFormatter().setWidth(2, "0px");

    getSaveButtonWidget().removeFromParent();
    getCancelButtonWidget().removeFromParent();
    requiredFieldsNoteLabel.setVisible(false);

    int row = 0;//from  w w w.  ja v a 2s. c o  m
    Label keyHashLabel = new Label(Utils.constants.endpointKeyHash());
    endpointKeyHash = new KaaAdminSizedTextBox(-1, false);
    endpointKeyHash.setWidth("100%");
    detailsTable.setWidget(row, 0, keyHashLabel);
    detailsTable.setWidget(row, 1, endpointKeyHash);

    userInfoList = new ArrayList<>();
    Label userIDLabel = new Label(Utils.constants.userId());
    userID = new KaaAdminSizedTextBox(-1, false);
    userID.setWidth("100%");
    detailsTable.setWidget(++row, 0, userIDLabel);
    detailsTable.setWidget(row, 1, userID);
    userInfoList.add(userIDLabel);
    userInfoList.add(userID);

    Label userExternalIDLabel = new Label(Utils.constants.userExternalId());
    userExternalID = new KaaAdminSizedTextBox(-1, false);
    userExternalID.setWidth("100%");
    detailsTable.setWidget(++row, 0, userExternalIDLabel);
    detailsTable.setWidget(row, 1, userExternalID);
    userInfoList.add(userExternalIDLabel);
    userInfoList.add(userExternalID);

    Label sdkLabel = new Label(Utils.constants.sdkProfile());
    sdkAnchor = new Anchor();
    sdkAnchor.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    sdkAnchor.setWidth("100%");
    detailsTable.getFlexCellFormatter().setHeight(row, 0, "40px");
    detailsTable.setWidget(row, 0, sdkLabel);
    detailsTable.setWidget(row++, 1, sdkAnchor);

    SpanElement span = Document.get().createSpanElement();
    span.appendChild(Document.get().createTextNode(Utils.constants.endpointProfile()));
    span.addClassName("gwt-Label");

    CaptionPanel formPanel = new CaptionPanel(span.getString(), true);
    FlexTable recordTable = new FlexTable();
    recordTable.setWidth("100%");

    Label endpointProfSchemaLabel = new Label(Utils.constants.schemaName());
    endpointProfSchemaName = new Anchor();
    endpointProfSchemaName.getElement().getStyle().setCursor(Style.Cursor.POINTER);

    HorizontalPanel schemaNamePanel = new HorizontalPanel();
    schemaNamePanel.setHeight("40px");
    schemaNamePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    schemaNamePanel.add(endpointProfSchemaLabel);
    schemaNamePanel.add(endpointProfSchemaName);
    schemaNamePanel.setCellWidth(endpointProfSchemaName, "200px");
    endpointProfSchemaName.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX);

    HorizontalPanel schemaButtonsPanel = new HorizontalPanel();
    schemaButtonsPanel.setSpacing(6);
    downloadEndpointProfileJsonButton = new ImageTextButton(Utils.resources.download(),
            Utils.constants.downloadJson());
    schemaButtonsPanel.add(downloadEndpointProfileJsonButton);
    schemaNamePanel.add(schemaButtonsPanel);
    schemaButtonsPanel.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX);

    recordTable.setWidget(0, 0, schemaNamePanel);

    endpointProfForm = new RecordPanel(new AvroWidgetsConfig.Builder().recordPanelWidth(700).createConfig(),
            Utils.constants.profile(), this, true, true);
    endpointProfForm.getRecordWidget().setForceNavigation(true);
    endpointProfForm.setPreferredHeightPx(200);
    recordTable.setWidget(1, 0, endpointProfForm);
    recordTable.getFlexCellFormatter().setColSpan(1, 0, 2);

    formPanel.add(recordTable);

    detailsTable.setWidget(++row, 0, formPanel);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);

    formPanel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);

    span = Document.get().createSpanElement();
    span.appendChild(Document.get().createTextNode(Utils.constants.serverProfile()));
    span.addClassName("gwt-Label");

    CaptionPanel serverFormPanel = new CaptionPanel(span.getString(), true);
    FlexTable serverRecordTable = new FlexTable();
    serverRecordTable.setWidth("100%");

    Label serverProfSchemaLabel = new Label(Utils.constants.schemaName());
    serverProfSchemaName = new Anchor();
    serverProfSchemaName.getElement().getStyle().setCursor(Style.Cursor.POINTER);

    schemaNamePanel = new HorizontalPanel();
    schemaNamePanel.setHeight("40px");
    schemaNamePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    schemaNamePanel.add(serverProfSchemaLabel);
    schemaNamePanel.add(serverProfSchemaName);
    schemaNamePanel.setCellWidth(serverProfSchemaName, "200px");
    serverProfSchemaName.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX);

    schemaButtonsPanel = new HorizontalPanel();
    schemaButtonsPanel.setSpacing(6);
    downloadServerProfileJsonButton = new ImageTextButton(Utils.resources.download(),
            Utils.constants.downloadJson());
    schemaButtonsPanel.add(downloadServerProfileJsonButton);
    editServerProfileButton = new Button(Utils.constants.edit());
    schemaButtonsPanel.add(editServerProfileButton);
    schemaNamePanel.add(schemaButtonsPanel);
    schemaButtonsPanel.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX);

    serverRecordTable.setWidget(0, 0, schemaNamePanel);
    serverProfForm = new RecordPanel(new AvroWidgetsConfig.Builder().recordPanelWidth(700).createConfig(),
            Utils.constants.profile(), this, true, true);
    serverProfForm.getRecordWidget().setForceNavigation(true);
    serverProfForm.setPreferredHeightPx(200);
    serverRecordTable.setWidget(1, 0, serverProfForm);
    serverRecordTable.getFlexCellFormatter().setColSpan(1, 0, 2);

    serverFormPanel.add(serverRecordTable);

    detailsTable.setWidget(++row, 0, serverFormPanel);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);
    serverFormPanel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);

    groupsGrid = new EndpointGroupGrid(true);
    groupsGrid.setSize("100%", "200px");
    Label groupsLabel = new Label(Utils.constants.endpointGroups());
    detailsTable.setWidget(++row, 0, groupsLabel);
    groupsLabel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);
    detailsTable.setWidget(++row, 0, groupsGrid);
    groupsGrid.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);

    topicsGrid = new TopicGrid(false, true);
    topicsGrid.setSize("100%", "200px");
    Label topicLabel = new Label(Utils.constants.subscribedOnNfTopics());
    topicLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitleLabel());
    detailsTable.setWidget(++row, 0, topicLabel);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);
    topicLabel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);
    detailsTable.setWidget(++row, 0, topicsGrid);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);
    topicsGrid.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.widget.RecordPanel.java

License:Apache License

public void setTitle(String title) {
    if (showCaption) {
        if (optional) {
            recordCaption.setCaptionText(title);
        } else {/*from   w ww  .j av  a 2  s .co  m*/
            SpanElement span = Document.get().createSpanElement();
            span.appendChild(Document.get().createTextNode(title));
            span.addClassName("gwt-Label");
            span.addClassName(REQUIRED);
            recordCaption.setCaptionHTML(span.getString());
        }
    }
}

From source file:org.uberfire.client.views.pfly.listbar.PartListDropdown.java

License:Apache License

private SpanElement buildTitleTextWidget(final String title, final IsWidget titleDecoration) {
    final SpanElement spanElement = Document.get().createSpanElement();
    spanElement.addClassName("uf-listbar-panel-header-title-text");
    spanElement.addClassName(CSSLocatorsUtils.buildLocator("qe-list-bar-header", title));
    final String titleWidget = (titleDecoration instanceof Image) ? titleDecoration.toString() : "";
    spanElement.setInnerHTML(titleWidget + " " + title.replaceAll(" ", "\u00a0"));
    spanElement.setTitle(title);//w ww  .  ja  v  a 2  s.  c om
    return spanElement;
}