/** * {@inheritDoc} */ @Override public void setCustomIconStyle(String customIconStyle) { icon.addStyleName(customIconStyle); }
/** * {@inheritDoc} */ @Override public void setIconSize(IconSize size) { icon.setIconSize(size); }
/** * Sets whether this icon is a "light" (white) icon. * * @param light White icon if true * @since 2.3.2.0 */ public void setLight(final boolean light) { classNameToggle(light, Constants.ICON_LIGHT); }
private void createDeleteIcon( final ParameterizedCommand<String> deleteCommand, final String dirURI ) { deleteIcon = new Icon( IconType.REMOVE_CIRCLE ); deleteIcon.setIconSize( IconSize.DEFAULT ); deleteIcon.addStyleName( APP_CSS.CSS().deleteIcon() ); deleteIcon.addDomHandler( new ClickHandler() { @Override public void onClick( ClickEvent event ) { deleteCommand.execute( dirURI ); } }, ClickEvent.getType() ); outerPanel.addDomHandler( new MouseOverHandler() { @Override public void onMouseOver( MouseOverEvent event ) { deletePanel.add( deleteIcon ); } }, MouseOverEvent.getType() ); outerPanel.addDomHandler( new MouseOutHandler() { @Override public void onMouseOut( MouseOutEvent event ) { deletePanel.remove( deleteIcon ); } }, MouseOutEvent.getType() ); }
private Icon generateRemoveIcon( final String value ) { final Icon icon = new Icon( IconType.REMOVE ); icon.addDomHandler( new ClickHandler() { @Override public void onClick( ClickEvent event ) { tagsList.remove( value ); generateTags(); } }, ClickEvent.getType() ); icon.getElement().getStyle().setColor( "rgb(153, 153, 153)" ); return icon; }
private void setLoadingBehavior(String behavior) { // Remove icon because it will be removed by Bootstrap's "$(element).button(behavior)" anyway icon.removeFromParent(); setLoadingBehavior(getElement(), behavior); // Recreate icon and add it to inner content with setText() icon = new Icon(icon.getIconType()); setText(getText()); }
private void createIcon( TYPE type ) { icon.setIconSize( IconSize.LARGE ); icon.setType( type.icon() ); }
private void classNameToggle(final boolean value, final String className) { if (value) { getElement().addClassName(className); } else { getElement().removeClassName(className); } } }
private void addCollapseButton() { collapseButton.getElement().setAttribute(Constants.DATA_TOGGLE, Constants.COLLAPSE); collapseButton.getElement().setAttribute(Constants.DATA_TARGET, Constants.NAV_COLLAPSE_TARGET); collapseButton.add(new Icon(IconType.BAR)); collapseButton.add(new Icon(IconType.BAR)); collapseButton.add(new Icon(IconType.BAR)); add(collapseButton); }
/** * {@inheritDoc} */ public void setText(String text) { this.text = text; if (icon.isAttached()) { icon.removeFromParent(); } getElement().setInnerText(text); }
/** * {@inheritDoc} */ @Override public void setBaseIcon(BaseIconType type) { if (text != null) { getElement().setInnerHTML(""); } icon.setBaseType(type); if (!icon.isAttached()) { add(icon); } }
/** * {@inheritDoc} */ @Override public void setIconPosition(IconPosition position) { this.iconPosition = position; icon.removeFromParent(); text.removeFromParent(); if(IconPosition.RIGHT == position) { this.insert(text , 0); this.insert(icon , 1); return; } else if(IconPosition.LEFT == position){ this.insert(icon, 0); this.insert(text, 1); return; } }
/** * Pulls icon left or right. * * @param alignment Alignment of icon * @since 2.3.2.0 */ @Override public void setAlignment(final Alignment alignment) { getElement().removeClassName(Alignment.LEFT.get()); getElement().removeClassName(Alignment.RIGHT.get()); if (alignment == null || alignment == Alignment.NONE) { return; } getElement().addClassName(alignment.get()); }
/** * Sets rotation of icon. * * @param iconRotate Rotation of icon * @see com.github.gwtbootstrap.client.ui.constants.IconRotate * @since 2.3.2.0 */ public void setRotate(final IconRotate iconRotate) { getElement().removeClassName(IconRotate.ROTATE_90.get()); getElement().removeClassName(IconRotate.ROTATE_180.get()); getElement().removeClassName(IconRotate.ROTATE_270.get()); if (iconRotate == null || iconRotate == IconRotate.NONE) { return; } getElement().addClassName(iconRotate.get()); }
/** * Sets the icon size. * * @param size the icon size */ public void setSize(IconSize size) { setIconSize(size); }
/** * {@inheritDoc} */ @Override public void setCustomIconStyle(String customIconStyle) { icon.addStyleName(customIconStyle); }
/** * Is the icon the base (bottom) icon of a {@link IconStack}? * Only relevant if icon is a child element of {@link IconStack}. * * @param stackBase Is this icon the base (bottom icon) of an icon stack? * @see IconStack * @since 2.3.2.0 */ public void setStackBase(final boolean stackBase) { classNameToggle(stackBase, Constants.ICON_STACK_BASE); }
/** * Sets (horizontal or vertical) flip of icon. * * @param iconFlip Flip of icon * @see com.github.gwtbootstrap.client.ui.constants.IconFlip * @since 2.3.2.0 */ public void setFlip(final IconFlip iconFlip) { getElement().removeClassName(IconFlip.HORIZONTAL.get()); getElement().removeClassName(IconFlip.VERTICAL.get()); if (iconFlip == null || iconFlip == IconFlip.NONE) { return; } getElement().addClassName(iconFlip.get()); }
/** * {@inheritDoc} */ @Override public void setIconSize(IconSize size) { icon.setIconSize(size); }
/** * If true icon will spin. * </p> * Note: Uses CSS3 animations which aren't supported in IE7 - IE9. * * @param spin true if icon should spin * @since 2.3.2.0 */ public void setSpin(final boolean spin) { classNameToggle(spin, Constants.ICON_SPIN); }