List of usage examples for com.google.gwt.user.client.ui Widget addStyleName
public void addStyleName(String style)
From source file:gwt.material.design.client.ui.MaterialTabs.java
License:Apache License
@Override protected void onAttach() { super.onAttach(); name = String.valueOf(hashCode()); int col = 12 / tabPanel.getWidgetCount(); int index = tabPanel.getWidgetCount(); for (Widget w : tabPanel) { if (w instanceof ListItem) { if (!waves.isEmpty()) ((ListItem) w).getWidget(0).getElement().addClassName("waves-effect waves-" + waves); if (!color.isEmpty()) w.getElement().addClassName(color); if (!textColor.isEmpty()) ((ListItem) w).getWidget(0).getElement().addClassName(textColor + "-text"); ((ListItem) w).getWidget(0).getElement().setAttribute("href", "#" + name + index); w.addStyleName("tab col s" + col); index--;/*from w w w . j ava2 s. c o m*/ } } int indexC = contentPanel.getWidgetCount(); for (Widget w : contentPanel) { w.getElement().setAttribute("id", name + indexC); indexC--; } initTabs(); changeIndicator(indicatorColor); }
From source file:gwt.material.design.client.ui.MaterialTabs.java
License:Apache License
@UiChild(tagname = "content") public void addContent(final Widget item) { item.addStyleName("col s12"); contentPanel.add(item);/*from ww w . ja v a 2 s .c o m*/ }
From source file:gwt.material.design.components.client.ui.MaterialCard.java
License:Apache License
@UiChild(tagname = "button") public void addButtons(final Widget chield) { chield.addStyleName(CssName.MDC_CARD__ACTION); chield.addStyleName(CssName.MDC_CARD__ACTION_BUTTON); buttons.add(chield);/*from www . j a v a2 s. com*/ add(actions); }
From source file:gwt.material.design.components.client.ui.MaterialCard.java
License:Apache License
@UiChild(tagname = "icon") public void addIcons(final Widget chield) { chield.addStyleName(CssName.MDC_CARD__ACTION); chield.addStyleName(CssName.MDC_CARD__ACTION_ICON); icons.add(chield);/*from w w w . jav a 2s. c o m*/ add(actions); }
From source file:gwt.material.design.components.client.ui.MaterialListItem.java
License:Apache License
private void insertDetail(final Widget widget, final String detailClass, final int detailPos) { widget.addStyleName(detailClass); insert(widget, detailPos);/*from w w w . j av a2 s. c om*/ }
From source file:gwt.material.design.components.client.utils.helper.UiHelper.java
License:Apache License
/** * Adds a mouse pressed handler to a widget. Adds a CSS style to the widget as * long as the mouse is pressed (or the user touches the widget on mobile * browser).// w ww . j av a 2s . com * * @param widget The widget to which the style must be applied for * mouse/touch event * @param cssStyleName CSS style name to be applied */ public static void addMousePressedHandlers(final Widget widget, final String cssStyleName) { widget.sinkEvents(Event.ONMOUSEDOWN); widget.sinkEvents(Event.ONMOUSEUP); widget.sinkEvents(Event.ONMOUSEOUT); widget.sinkEvents(Event.TOUCHEVENTS); widget.addHandler(event -> { widget.addStyleName(cssStyleName); }, MouseDownEvent.getType()); widget.addHandler(event -> { widget.removeStyleName(cssStyleName); }, MouseUpEvent.getType()); widget.addHandler(event -> { widget.removeStyleName(cssStyleName); }, MouseOutEvent.getType()); // Touch Events widget.addHandler(event -> { widget.addStyleName(cssStyleName); }, TouchStartEvent.getType()); widget.addHandler(event -> { widget.removeStyleName(cssStyleName); }, TouchEndEvent.getType()); widget.addHandler(event -> { widget.removeStyleName(cssStyleName); }, TouchCancelEvent.getType()); }
From source file:gwtquery.plugins.droppable.client.draughtssample.CheckerBoard.java
License:Apache License
private void initBoard() { setCellPadding(0);/*from w w w . j a v a 2 s. co m*/ setCellSpacing(0); boolean isWhiteCell = true; for (int row = 0; row < SQUARE_NUMBER; row++) { for (int column = 0; column < SQUARE_NUMBER; column++) { Widget cell = null; if (!isWhiteCell) { // only black cell can contains a piece and so is droppable cell = new DroppableSquare(new Position(column, row)); cell.addStyleName(CSS.blackCell()); droppableSquareList.add((DroppableSquare) cell); } else { cell = new SimplePanel(); cell.addStyleName(CSS.whiteCell()); } setWidget(row, column, cell); isWhiteCell = !isWhiteCell; } isWhiteCell = !isWhiteCell; } addStyleName(CSS.checkerBoard()); //set and id to retrieve it later thnaks to GwtQuery getElement().setId(CHECKERBOARD_ID); }
From source file:gwtupload.client.DecoratedFileUpload.java
License:Apache License
/** * Set the button the user has to click on to show the browse dialog. *///from w w w . j a v a 2s . c om public void setButton(Widget button) { if (button != null) { assert button instanceof HasClickHandlers : "Button should implement HasClickHandlers"; if (this.button != null) { this.remove(this.button); } this.button = button; super.add(button); impl.setButton(button); button.addStyleName(STYLE_CLICKABLE_WIDGET); updateSize(); } }
From source file:gwtupload.client.ResumableUploader.java
License:Apache License
/** * This constructor allows to use an existing form panel. * /*from w w w. j av a2s . c o m*/ * @param type * file input to use * @param status * Customized status widget to use * @param submitButton * Customized button which submits the form * @param form * Customized form panel */ public ResumableUploader(FileInputType type, IUploadStatus status, Widget submitButton, FormPanel form) { super(type, form); final Uploader thisInstance = this; if (status == null) { status = new BaseUploadStatus(); } super.setStatusWidget(status); this.button = submitButton; if (submitButton != null) { submitButton.addStyleName("submit"); if (submitButton instanceof HasClickHandlers) { ((HasClickHandlers) submitButton).addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { thisInstance.submit(); } }); } if (submitButton instanceof HasText) { ((HasText) submitButton).setText(I18N_CONSTANTS.uploaderSend()); } // The user could have attached the button anywhere in the page. if (!submitButton.isAttached()) { super.add(submitButton); } } }
From source file:gwtupload.client.SingleUploader.java
License:Apache License
/** * This constructor allows to use an existing form panel. * /*from ww w . ja v a 2 s. c o m*/ * @param type * file input to use * @param status * Customized status widget to use * @param submitButton * Customized button which submits the form * @param form * Customized form panel */ public SingleUploader(FileInputType type, IUploadStatus status, Widget submitButton, FormPanel form) { super(type, form); final Uploader thisInstance = this; if (status == null) { status = new BaseUploadStatus(); } super.setStatusWidget(status); this.button = submitButton; if (submitButton != null) { submitButton.addStyleName("submit"); if (submitButton instanceof HasClickHandlers) { ((HasClickHandlers) submitButton).addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { thisInstance.submit(); } }); } if (submitButton instanceof HasText) { ((HasText) submitButton).setText(I18N_CONSTANTS.uploaderSend()); } // The user could have attached the button anywhere in the page. if (!submitButton.isAttached()) { super.add(submitButton); } } }