Example usage for com.google.gwt.user.client.ui Widget addStyleName

List of usage examples for com.google.gwt.user.client.ui Widget addStyleName

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Widget addStyleName.

Prototype

public void addStyleName(String style) 

Source Link

Document

Adds a secondary or dependent style name to this object.

Usage

From source file:hu.mapro.gwt.client.widget.MyTabLayoutPanel.java

License:Apache License

private void insert(final Widget child, Tab tab, int beforeIndex) {
    assert (beforeIndex >= 0) && (beforeIndex <= getWidgetCount()) : "beforeIndex out of bounds";

    // Check to see if the TabPanel already contains the Widget. If so,
    // remove it and see if we need to shift the position to the left.
    int idx = getWidgetIndex(child);
    if (idx != -1) {
        remove(child);//from  ww  w .  ja v a 2  s .  c  om
        if (idx < beforeIndex) {
            beforeIndex--;
        }
    }

    deckPanel.insertProtected(child, beforeIndex);
    tabs.add(beforeIndex, tab);

    tabBar.insert(tab, beforeIndex);
    tab.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            selectTab(child);
        }
    });

    if (isAttached()) {
        // if it isn't attached, this gets run onAttach();
        maybeShowButtons();
    }
    child.addStyleName(CONTENT_STYLE);

    if (selectedIndex == -1) {
        selectTab(0);
    } else if (selectedIndex >= beforeIndex) {
        // If we inserted before the currently selected tab, its index has just
        // increased.
        selectedIndex++;
    }
}

From source file:info.magnolia.ui.vaadin.gwt.client.magnoliashell.shell.ShellAppLauncher.java

License:Open Source License

public void activateControl(final ShellAppType type) {
    final ShellAppType currentActive = getActiveShellType();
    if (currentActive != null) {
        controlsMap.get(currentActive).removeStyleName("active");
    }/*from ww w . j  a v  a 2s.c  o  m*/
    doUpdateDivetPosition(type, currentActive != null);
    final Widget w = controlsMap.get(type);
    w.addStyleName("active");
}

From source file:info.magnolia.ui.vaadin.gwt.client.magnoliashell.viewport.widget.AppsViewportWidget.java

License:Open Source License

@Override
public void showChildNoTransition(Widget w) {
    getElement().appendChild(closeButton.getElement());
    getElement().appendChild(fullScreenButton.getElement());
    Widget formerVisible = getVisibleChild();
    // do not hide app if closing
    if (formerVisible != null && !isAppClosing()) {
        formerVisible.getElement().getStyle().setVisibility(Visibility.HIDDEN);
        formerVisible.addStyleName(APP_INACTIVE_CLASS_NAME);
    }//  ww  w.j av  a 2s  .  c  o  m
    w.setVisible(true);
    w.removeStyleName(APP_INACTIVE_CLASS_NAME);
    w.getElement().getStyle().clearVisibility();
}

From source file:io.pelle.mango.client.gwt.ControlHelper.java

License:Open Source License

public <ValueType> ControlHelper(final Widget widget,
        final IBaseControl<?, ? extends IBaseControlModel> baseControl, IGwtControl gwtControl,
        boolean addValueChangeListener, boolean addDefaultStyle, boolean setWidth) {

    this.uiObject = widget;
    this.baseControl = baseControl;
    this.gwtControl = gwtControl;

    if (addDefaultStyle) {
        widget.addStyleName(Styles.FORM_CONTROL);
    }//  w w  w .  j ava2s.  c om

    if (baseControl.isReadonly()) {
        widget.getElement().setPropertyBoolean("disabled", baseControl.isReadonly());
        widget.addStyleName(GwtStyles.CONTROL_DISABLED_STYLE);
    }

    if (setWidth) {
        widget.setWidth(WidthCalculationStrategy.getInstance().getControlWidthCss(baseControl.getModel()));
    }

    baseControl.addUpdateListener(this);

    if (widget instanceof HasValue<?>) {

        final HasValue<ValueType> hasValueWidget = (HasValue<ValueType>) widget;

        if (addValueChangeListener) {
            if (widget instanceof FocusWidget) {
                FocusWidget focusWidget = (FocusWidget) widget;

                focusWidget.addKeyUpHandler(new KeyUpHandler() {
                    @Override
                    public void onKeyUp(KeyUpEvent event) {
                        setParseValue(hasValueWidget.getValue());
                    }
                });
            }
        }

        widget.addDomHandler(new BlurHandler() {

            @Override
            public void onBlur(BlurEvent event) {
                baseControl.endEdit();
            }
        }, BlurEvent.getType());
    }

    onUpdate();

}

From source file:javawars.client.ui.VerticalTabBar.java

License:Open Source License

private void setSelectionStyle(Widget item, boolean selected) {
    if (item != null) {
        if (selected) {
            item.addStyleName("gwt-TabBarItem-selected");
        } else {//  ww  w .ja v a 2  s  . co m
            item.removeStyleName("gwt-TabBarItem-selected");
        }
    }
}

From source file:mat.client.shared.ui.MATTabBar.java

License:Apache License

/**
  * Sets the selection style./*from   w  w  w  .j  a  v a  2s  . co m*/
  * 
  * @param item
  *            the item
  * @param selected
  *            the selected
  */
private void setSelectionStyle(Widget item, boolean selected) {
    if (item != null) {
        if (selected) {
            item.addStyleName("gwt-TabBarItem-selected");
            setStyleName(DOM.getParent(item.getElement()), "gwt-TabBarItem-wrapper-selected", true);
        } else {
            item.removeStyleName("gwt-TabBarItem-selected");
            setStyleName(DOM.getParent(item.getElement()), "gwt-TabBarItem-wrapper-selected", false);
        }
    }
}

From source file:net.scran24.common.client.WidgetFactory.java

License:Apache License

public static FlowPanel createPromptPanel(SafeHtml prompt, Widget floatWidget) {
    FlowPanel result = createPromptPanel(prompt);
    result.insert(floatWidget, 0);/*from  w w  w  .  ja v a  2s .  c  om*/
    floatWidget.addStyleName("intake24-prompt-float-widget");
    return result;
}

From source file:net.scran24.user.client.ShepherdTour.java

License:Apache License

public static void makeShepherdTarget(Widget... widgets) {
    for (Widget w : widgets)
        w.addStyleName("intake24-shepherd-target");
}

From source file:net.sf.gudoku.client.widget.CandidatesGrid.java

License:Open Source License

public void onMouseEnter(Widget sender) {
    sender.addStyleName("markierung");
    if (sender instanceof CandidateLabel) {
        CandidateLabel cl = (CandidateLabel) sender;
        cl.setText(String.valueOf(cl.getValue()));
    }//w  w w .  j a  va2s.c  o m
}

From source file:next.i.view.widgets.XPopup.java

License:Apache License

@Override
public void setWidget(Widget w) {
    super.setWidget(w);
    w.addStyleName("xpopup");
}