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() . 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
Source File: RestrictionsTable.java    From unitime with 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 2
Source File: MaterialSubHeaderContainer.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
@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 3
Source File: TaskExecutionsTable.java    From unitime with 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 4
Source File: SimpleForm.java    From unitime with 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 5
Source File: LabelledWidget.java    From bitcoin-transaction-explorer with MIT License 5 votes vote down vote up
@Override
public void add(final Widget w) {
  w.addStyleName(R.css().labelledValueFieldValue());

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

  super.add(w);
}
 
Example 6
Source File: ActiveMixin.java    From gwt-material with 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 7
Source File: MaterialCardImage.java    From gwt-material with 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 8
Source File: PagedView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 9
Source File: StepHighlighter.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public void animate(int index) {
    clearHighlightStyle();
    Widget widget = widgets.get(index);
    if (widget != null) {
        widget.addStyleName(HIGHLIGHT);
    }
}
 
Example 10
Source File: AriaTabBar.java    From unitime with 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 11
Source File: UniTimeHeaderPanel.java    From unitime with 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
Source File: UniTimeHeaderPanel.java    From unitime with 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 13
Source File: DefaultSplitLayoutPanel.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void addWest(Widget widget, double size) {
    widget.addStyleName("split-west");
    super.addWest(widget, size);
}
 
Example 14
Source File: UniTimeHeaderPanel.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void insertWidget(Widget widget) {
	widget.addStyleName("widget");
	iContent.insert(widget, 1);
}
 
Example 15
Source File: FilterPanel.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void addRight(Widget w) {
	w.addStyleName("filter-item");
	iRight.add(w);
}
 
Example 16
Source File: FilterPanel.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void addMiddle(Widget w) {
	w.addStyleName("filter-item");
	iMiddle.add(w);
}
 
Example 17
Source File: CubaPopupButtonWidget.java    From cuba with Apache License 2.0 4 votes vote down vote up
protected void childWidgetFocused(Widget target) {
    resetSelectedItem();

    target.addStyleName(SELECTED_ITEM_STYLE);
}
 
Example 18
Source File: Tools.java    From cuba with 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 19
Source File: DefaultSplitLayoutPanel.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void add(Widget widget) {
    widget.addStyleName("split-center");
    super.add(widget);
}
 
Example 20
Source File: FinderPanel.java    From core with GNU Lesser General Public License v2.1 3 votes vote down vote up
@Override
public void addWest(Widget widget, double size) {
    super.addWest(widget, size);
    widget.addStyleName("split-west");


}