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:com.allen_sauer.gwt.dnd.client.PickupDragController.java

License:Apache License

/**
 * Called by {@link PickupDragController#dragStart()} to allow subclasses to provide their own
 * drag proxies.//from  w w w .ja  va2s.  c  om
 *
 * @param context the current drag context
 * @return a new drag proxy
 */
protected Widget newDragProxy(DragContext context) {
    AbsolutePanel container = new AbsolutePanel();
    container.getElement().getStyle().setProperty("overflow", "visible");

    WidgetArea draggableArea = new WidgetArea(context.draggable, null);
    for (Widget widget : context.selectedWidgets) {
        WidgetArea widgetArea = new WidgetArea(widget, null);
        Widget proxy = new SimplePanel();
        proxy.setPixelSize(widget.getOffsetWidth(), widget.getOffsetHeight());
        proxy.addStyleName(DragClientBundle.INSTANCE.css().proxy());
        container.add(proxy, widgetArea.getLeft() - draggableArea.getLeft(),
                widgetArea.getTop() - draggableArea.getTop());
    }

    return container;
}

From source file:com.allen_sauer.gwt.dnd.demo.client.example.bin.BinDropController.java

License:Apache License

@Override
public void onEnter(DragContext context) {
    super.onEnter(context);
    for (Widget widget : context.selectedWidgets) {
        widget.addStyleName(CSS_DEMO_BIN_DRAGGABLE_ENGAGE);
    }//from www. ja  v a 2 s.  co  m
    bin.setEngaged(true);
}

From source file:com.allen_sauer.gwt.dnd.demo.client.example.flextable.FlexTableRowDropController.java

License:Apache License

Widget newPositioner(DragContext context) {
    Widget p = new SimplePanel();
    p.addStyleName(CSS_DEMO_TABLE_POSITIONER);
    p.setPixelSize(flexTable.getOffsetWidth(), 1);
    return p;//  ww  w .  j  a v  a2  s. com
}

From source file:com.allen_sauer.gwt.dnd.demo.client.example.palette.PaletteWidget.java

License:Apache License

/**
 * Default constructor to wrap the provided widget.
 * /*from  w ww. ja v a  2s .  co m*/
 * @param widget the widget to be wrapped
 */
public PaletteWidget(Widget widget) {
    this.widget = widget;
    add(widget);

    // Add some CSS styling
    addStyleName("demo-PaletteWidget");
    widget.addStyleName("demo-PaletteWidget-widget");
    shim.addStyleName("demo-PaletteWidget-shim");
}

From source file:com.allen_sauer.gwt.dnd.demo.client.example.resetcache.ResetCacheExample.java

License:Apache License

public ResetCacheExample(PickupDragController dragController) {
    super(dragController);
    addStyleName(CSS_DEMO_CACHE_EXAMPLE);

    // some colors to go with each tab
    String[] colors = { "#AAAAFF", "#AAFFAA", "#FFAAAA", "#FFFFAA", "#FFAAFF", "#AAFFFF", };

    // use the containing panel as this composite's widget
    AbsolutePanel containingPanel = new AbsolutePanel();
    containingPanel.setPixelSize(600, 300);
    setWidget(containingPanel);/*from   w ww .  j a  va2  s  .  c  o m*/

    // create a tab panel and populate with a few tabs
    TabPanel tabPanel = new TabPanel();
    tabPanel.addStyleName(CSS_DEMO_CACHE_EXAMPLE_TAB_PANEL);
    tabPanel.setPixelSize(300, 200);
    containingPanel.add(tabPanel, 40, 20);

    for (int i = 0; i < colors.length; i++) {
        // create a simple panel for the tab content
        AbsolutePanel contentPanel = new AbsolutePanel();
        contentPanel.setHeight("200px");
        contentPanel.getElement().getStyle().setProperty("backgroundColor", colors[i]);

        // create a tab widget
        HTML tabWidget = new HTML("Tab #" + (i + 1));
        tabWidget.setWordWrap(false);
        tabWidget.getElement().getStyle().setProperty("backgroundColor", colors[i]);
        tabPanel.add(contentPanel, tabWidget);

        // add drop controller to allow automatic tab selection and dropping on tab
        TabSelectingDropController tabSelectingDropController = new TabSelectingDropController(tabWidget,
                tabPanel, i);
        dragController.registerDropController(tabSelectingDropController);

        // create a sample draggable
        Widget draggableLabel = new Label("Drag me to another tab");
        draggableLabel.getElement().getStyle().setProperty("backgroundColor", colors[i]);
        draggableLabel.addStyleName(CSS_DEMO_CACHE_EXAMPLE_DRAGGABLE);

        // make label draggable
        dragController.makeDraggable(draggableLabel);

        // determine random location within target panel
        int left = Random.nextInt(200);
        int top = Random.nextInt(150);
        contentPanel.add(draggableLabel, left, top);

        // create a drop controller for the content panel
        AbsolutePositionDropController contentPanelDropController = new AbsolutePositionDropController(
                contentPanel);
        dragController.registerDropController(contentPanelDropController);
    }
    tabPanel.selectTab(0);

    // create a drop controller for the containing panel
    containerDropController = new AbsolutePositionDropController(containingPanel);
    dragController.registerDropController(containerDropController);
}

From source file:com.allen_sauer.gwt.log.client.DivLogger.java

License:Apache License

/**
 * Default constructor.// w w  w  . j a  va 2  s .c om
 */
public DivLogger() {
    logDockPanel.addStyleName(LogClientBundle.INSTANCE.css().logPanel());
    logTextArea.addStyleName(LogClientBundle.INSTANCE.css().logTextArea());
    scrollPanel.addStyleName(LogClientBundle.INSTANCE.css().logScrollPanel());

    // scrollPanel.setAlwaysShowScrollBars(true);

    final FocusPanel headerPanel = makeHeader();

    Widget resizePanel = new Image(GWT.getModuleBaseURL() + "gwt-log-triangle-10x10.png");
    resizePanel.addStyleName(LogClientBundle.INSTANCE.css().logResizeSe());
    new MouseResizeHandler(resizePanel);

    logDockPanel.add(headerPanel, DockPanel.NORTH);
    logDockPanel.add(scrollPanel, DockPanel.CENTER);
    logDockPanel.add(resizePanel, DockPanel.SOUTH);
    resizePanel.getElement().getStyle().setLineHeight(1, Unit.PX);
    logDockPanel.setCellHorizontalAlignment(resizePanel, HasHorizontalAlignment.ALIGN_RIGHT);

    scrollPanel.setWidget(logTextArea);

    timer = new Timer() {
        @Override
        public void run() {
            dirty = false;
            logTextArea.setHTML(logTextArea.getHTML() + logText);
            logText = "";
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {
                @Override
                public void execute() {
                    scrollPanel.setVerticalScrollPosition(MAX_VERTICAL_SCROLL);
                }
            });
        }
    };
}

From source file:com.brazoft.foundation.gwt.client.ui.Well.java

License:Apache License

public static void decorate(Widget widget) {
    widget.addStyleName("well");
}

From source file:com.brazoft.foundation.gwt.client.ui.Well.java

License:Apache License

public static void decorate(Widget widget, Size size) {
    widget.addStyleName("well-" + size.name().toLowerCase());
}

From source file:com.brazoft.foundation.gwt.client.ui.Widgets.java

License:Apache License

static void adaptPlaceholder(Input<?, ?> input, String placeholder, String className) {
    Widget parent = input.getParent();

    if (!parent.getElement().hasTagName("label")) {
        HTML<LabelElement> label = HTML.asLabel().text(placeholder).className(className);
        DOM.appendChild(parent.getElement(), label.getElement());
        label.setParent(parent);/*from w ww.  j av  a2s .  c o m*/
        label.add(input);
        return;
    }

    parent.getElement().setInnerText(placeholder);
    parent.addStyleName(className);
}

From source file:com.calclab.emiteuimodule.client.chat.ChatUIPanel.java

License:Open Source License

private void addWidget(final Widget widget) {
    childPanel.add(widget);//  ww w. ja v  a  2s.  co m
    if (childPanel.isRendered()) {
        childPanel.doLayout();
    }
    widget.addStyleName("emite-ChatPanel-Message");
    scrollDown();
}