Java Code Examples for com.google.gwt.user.client.ui.Widget#addStyleName()

The following examples show how to use com.google.gwt.user.client.ui.Widget#addStyleName() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void load() {
    if (getType() == SubHeaderType.PINNED) {
        String subHeaderClass = DOM.createUniqueId();
        for (Widget w : getChildren()) {
            if (w instanceof MaterialSubHeader) {
                w.addStyleName(subHeaderClass);
                subHeaders.add((MaterialSubHeader) w);
            }
        }

        JsSubHeader.initSubheader("." + subHeaderClass, getElement());

        if (subHeaders.size() == 0) {
            $(getElement()).find(".top_holder").css("display", "none");
        }
    }
    AddinsDarkThemeReloader.get().reload(MaterialSubheaderDarkTheme.class);
}
 
Example 2
Source Project: unitime   File: TaskExecutionsTable.java    License: Apache License 2.0 6 votes vote down vote up
public int addExecution(final TaskExecutionInterface exec) {
	List<Widget> widgets = new ArrayList<Widget>();
	for (TaskExecutionsTableColumn column: TaskExecutionsTableColumn.values()) {
		int nbrCells = getNbrCells(column);
		for (int idx = 0; idx < nbrCells; idx ++) {
			Widget cell = getCell(exec, column, idx);
			if (cell == null)
				cell = new P();
			widgets.add(cell);
		}
	}
	for (Widget w: widgets)
		if (w != null)
			w.addStyleName("status-" + exec.getStatus().name().toLowerCase());
	int row = addRow(exec, widgets);
	getRowFormatter().setStyleName(row, "row");
	for (int col = 0; col < getCellCount(row); col++)
		getCellFormatter().setStyleName(row, col, "cell");
	return row;
}
 
Example 3
Source Project: unitime   File: SimpleForm.java    License: Apache License 2.0 6 votes vote down vote up
public int addRow(Widget header, Widget widget, int colSpan) {
	header.addStyleName("label-cell");
	int row = getRowCount();
	setWidget(row, 0, header);
	getCellFormatter().setStyleName(row, 0, "label-td");
	if (widget instanceof HasMobileScroll) {
		ScrollPanel scroll = new ScrollPanel(widget);
		scroll.addStyleName("table-cell");
		setWidget(row, 1, scroll);
		getCellFormatter().setStyleName(row, 1, "table-td");
	} else {
		widget.addStyleName("widget-cell");
		setWidget(row, 1, widget);
		getCellFormatter().setStyleName(row, 1, "widget-td");
	}
	if (colSpan != 1)
		getFlexCellFormatter().setColSpan(row, 1, colSpan);
	if (header.getElement().getId() == null || header.getElement().getId().isEmpty())
		header.getElement().setId(DOM.createUniqueId());
	if (widget instanceof UniTimeWidget)
		Roles.getTextboxRole().setAriaLabelledbyProperty(((UniTimeWidget)widget).getWidget().getElement(), Id.of(header.getElement()));
	else
		Roles.getTextboxRole().setAriaLabelledbyProperty(widget.getElement(), Id.of(header.getElement()));
	return row;
}
 
Example 4
Source Project: unitime   File: RestrictionsTable.java    License: Apache License 2.0 6 votes vote down vote up
protected Node addClass(Node parent, Clazz clazz) {
	List<Widget> line = new ArrayList<Widget>();
	Node node = new Node(parent, clazz.getAbbv(), clazz);
	line.add(node);
	line.add(new Label(clazz.hasExternalId() ? clazz.getExternalId() : ""));
	line.add(new UniTimeTable.NumberCell(clazz.getLimit() == null ? "" : clazz.getLimit().toString()));
	if (clazz.isCancelled()) {
		line.add(new CancelledCell());
	} else {
		line.add(new Label(clazz.hasTime() ? clazz.getTime() : ""));
		line.add(new Label(clazz.hasDate() ? clazz.getDate() : ""));
		line.add(new Label(clazz.hasRoom() ? clazz.getRoom() : ""));
	}
	line.add(new Label(clazz.hasInstructor() ? clazz.getInstructor() : ""));
	node.setRow(addRow(node, line));
	if (clazz.isCancelled())
		for (Widget w: line)
			w.addStyleName("cancelled");
	iClasses.put(clazz.getId(), node);
	parent.addChildNode(node);
	return node;
}
 
Example 5
Source Project: gwt-material   File: ActiveMixin.java    License: Apache License 2.0 5 votes vote down vote up
protected void applyActiveStyle(Widget widget, boolean active) {
    if (active) {
        widget.removeStyleName(CssName.INACTIVE);
        widget.addStyleName(CssName.ACTIVE);
    } else {
        widget.removeStyleName(CssName.ACTIVE);
        widget.addStyleName(CssName.INACTIVE);
    }
}
 
Example 6
Source Project: gwt-material   File: MaterialCardImage.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void add(final Widget child) {
    if (child instanceof MaterialImage) {
        child.addStyleName(CssName.ACTIVATOR);
    }
    add(child, (Element) getElement());
}
 
Example 7
public void addPage(String title, Widget pageWidget)
{
    deck.add(pageWidget);
    if(deck.getWidgetCount()>1 || navOnFirstPage)
        pageWidget.addStyleName("subpage");

    final int index = deck.getWidgetCount()-1;

    bar.addLink(title, new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            showPage(index);
        }
    });
}
 
Example 8
public void animate(int index) {
    clearHighlightStyle();
    Widget widget = widgets.get(index);
    if (widget != null) {
        widget.addStyleName(HIGHLIGHT);
    }
}
 
Example 9
Source Project: unitime   File: AriaTabBar.java    License: Apache License 2.0 5 votes vote down vote up
public void setRestWidget(Widget rest) {
	HorizontalPanel panel = (HorizontalPanel)getWidget();
	rest.addStyleName("gwt-TabBarRest");
	rest.setHeight("100%");
	panel.remove(panel.getWidgetCount() - 1);
	panel.add(rest);
	panel.setCellWidth(rest, "100%");
	setStyleName(rest.getElement().getParentElement(), "gwt-TabBarRest-wrapper");
}
 
Example 10
Source Project: unitime   File: UniTimeHeaderPanel.java    License: Apache License 2.0 5 votes vote down vote up
public void insertLeft(Widget widget, boolean first) {
	widget.addStyleName("left-widget");
	if (first)
		iLeft.insert(widget, 0);
	else
		iLeft.add(widget);
}
 
Example 11
Source Project: unitime   File: UniTimeHeaderPanel.java    License: Apache License 2.0 5 votes vote down vote up
public void insertRight(Widget widget, boolean first) {
	widget.addStyleName("right-widget");
	if (first)
		iRight.insert(widget, 0);
	else
		iRight.add(widget);
}
 
Example 12
@Override
public void add(final Widget w) {
  w.addStyleName(R.css().labelledValueFieldValue());

  if(getWidgetCount() == 2) {
    remove(1);
  }

  super.add(w);
}
 
Example 13
Source Project: cuba   File: CubaPopupButtonWidget.java    License: Apache License 2.0 4 votes vote down vote up
protected void childWidgetFocused(Widget target) {
    resetSelectedItem();

    target.addStyleName(SELECTED_ITEM_STYLE);
}
 
Example 14
@Override
public void add(Widget widget) {
    widget.addStyleName("split-center");
    super.add(widget);
}
 
Example 15
Source Project: cuba   File: Tools.java    License: Apache License 2.0 4 votes vote down vote up
public static void showPopup(VOverlay overlay, int left, int top) {
    overlay.setAutoHideEnabled(true);
    overlay.setVisible(false);
    overlay.show();

    Widget widget = overlay.getWidget();
    if (widget instanceof VVerticalLayout) {
        resetItemSelection(widget);

        VVerticalLayout verticalLayout = (VVerticalLayout) widget;
        if (verticalLayout.getStyleName().contains(CUBA_CONTEXT_MENU_CONTAINER)) {
            int widgetCount = verticalLayout.getWidgetCount();
            if (widgetCount > 1) {
                Widget verticalSlot = verticalLayout.getWidget(0);
                Widget buttonWidget = ((Slot) verticalSlot).getWidget();
                buttonWidget.addStyleName(SELECTED_ITEM_STYLE);
                if (buttonWidget instanceof FocusWidget) {
                    ((FocusWidget) buttonWidget).setFocus(true);
                }
            }
        }
    }

    // mac FF gets bad width due GWT popups overflow hacks,
    // re-determine width
    int offsetWidth = overlay.getOffsetWidth();
    int offsetHeight = overlay.getOffsetHeight();
    if (offsetWidth + left > Window.getClientWidth()) {
        left = left - offsetWidth;
        if (left < 0) {
            left = 0;
        }
    }
    if (offsetHeight + top > Window.getClientHeight()) {
        top = top - offsetHeight;
        if (top < 0) {
            top = 0;
        }
    }

    overlay.setPopupPosition(left, top);
    overlay.setVisible(true);
}
 
Example 16
@Override
public void addWest(Widget widget, double size) {
    widget.addStyleName("split-west");
    super.addWest(widget, size);
}
 
Example 17
Source Project: unitime   File: FilterPanel.java    License: Apache License 2.0 4 votes vote down vote up
public void addMiddle(Widget w) {
	w.addStyleName("filter-item");
	iMiddle.add(w);
}
 
Example 18
Source Project: unitime   File: FilterPanel.java    License: Apache License 2.0 4 votes vote down vote up
public void addRight(Widget w) {
	w.addStyleName("filter-item");
	iRight.add(w);
}
 
Example 19
Source Project: unitime   File: UniTimeHeaderPanel.java    License: Apache License 2.0 4 votes vote down vote up
public void insertWidget(Widget widget) {
	widget.addStyleName("widget");
	iContent.insert(widget, 1);
}
 
Example 20
@Override
public void addWest(Widget widget, double size) {
    super.addWest(widget, size);
    widget.addStyleName("split-west");


}