Search in sources :

Example 1 with Widget

use of com.google.gwt.user.client.ui.Widget in project che by eclipse.

the class MainMenuViewImpl method add.

/**
     * Create and add new item in menu.
     */
private void add(Action action, PresentationFactory presentationFactory) {
    Presentation presentation = presentationFactory.getPresentation(action);
    if (action instanceof ActionGroup) {
        ActionGroup group = (ActionGroup) action;
        table.setText(0, menuBarItems.size(), presentation.getText());
        Element element = table.getCellFormatter().getElement(0, menuBarItems.size());
        MenuBarItem item = new MenuBarItem(group, actionManager, managerProvider, presentationFactory, element, this, keyBindingAgent, resources.menuCss());
        item.onMouseOut();
        menuBarItems.put(element, item);
        action2barItem.put(group, item);
    } else if (action instanceof CustomComponentAction) {
        Widget widget = ((CustomComponentAction) action).createCustomComponent(presentation);
        table.setWidget(0, menuBarItems.size(), widget);
        Element element = table.getCellFormatter().getElement(0, menuBarItems.size());
        menuBarItems.put(element, null);
    }
}
Also used : CustomComponentAction(org.eclipse.che.ide.api.action.CustomComponentAction) ActionGroup(org.eclipse.che.ide.api.action.ActionGroup) Element(com.google.gwt.dom.client.Element) Widget(com.google.gwt.user.client.ui.Widget) Presentation(org.eclipse.che.ide.api.action.Presentation)

Example 2 with Widget

use of com.google.gwt.user.client.ui.Widget in project che by eclipse.

the class EditorPartStackView method ensureActiveTabVisible.

/**
     * Makes active tab visible.
     */
private void ensureActiveTabVisible() {
    if (activeTab == null) {
        return;
    }
    for (int i = 0; i < tabsPanel.getWidgetCount(); i++) {
        if (editorPaneMenu != null && editorPaneMenu != tabsPanel.getWidget(i)) {
            tabsPanel.getWidget(i).setVisible(true);
        }
    }
    for (int i = 0; i < tabsPanel.getWidgetCount(); i++) {
        Widget currentWidget = tabsPanel.getWidget(i);
        Widget activeTabWidget = activeTab.getView().asWidget();
        if (editorPaneMenu != null && editorPaneMenu == currentWidget) {
            continue;
        }
        if (activeTabWidget.getAbsoluteTop() > tabsPanel.getAbsoluteTop() && activeTabWidget != currentWidget) {
            currentWidget.setVisible(false);
        }
    }
}
Also used : IsWidget(com.google.gwt.user.client.ui.IsWidget) Widget(com.google.gwt.user.client.ui.Widget) AcceptsOneWidget(com.google.gwt.user.client.ui.AcceptsOneWidget)

Example 3 with Widget

use of com.google.gwt.user.client.ui.Widget in project che by eclipse.

the class ToolbarViewImpl method createToolbarPart.

/**
     * Creates a toolbar part widget.
     *
     * @return widget
     */
private Widget createToolbarPart(List<Utils.VisibleActionGroup> visibleActionGroupList) {
    FlowPanel toolbarPart = new FlowPanel();
    if (addSeparatorFirst) {
        final Widget firstDelimiter = createDelimiter();
        toolbarPart.add(firstDelimiter);
    }
    for (Utils.VisibleActionGroup visibleActionGroup : visibleActionGroupList) {
        List<Action> actions = visibleActionGroup.getActionList();
        if (actions == null || actions.size() == 0) {
            continue;
        }
        FlowPanel actionGroupPanel = new FlowPanel();
        actionGroupPanel.setStyleName(toolbarResources.toolbar().toolbarActionGroupPanel());
        toolbarPart.add(actionGroupPanel);
        for (Action action : actions) {
            if (action instanceof Separator) {
                int actionIndex = actions.indexOf(action);
                if (actionIndex > 0 && actionIndex < actions.size() - 1) {
                    final Widget delimiter = createDelimiter();
                    actionGroupPanel.add(delimiter);
                }
            } else if (action instanceof CustomComponentAction) {
                Presentation presentation = presentationFactory.getPresentation(action);
                Widget customComponent = ((CustomComponentAction) action).createCustomComponent(presentation);
                actionGroupPanel.add(customComponent);
            } else if (action instanceof ActionGroup && ((ActionGroup) action).isPopup()) {
                ActionPopupButton button = new ActionPopupButton((ActionGroup) action, actionManager, keyBindingAgent, presentationFactory, managerProvider, toolbarResources);
                actionGroupPanel.add(button);
            } else {
                final ActionButton button = createToolbarButton(action);
                actionGroupPanel.add(button);
            }
        }
    }
    return toolbarPart;
}
Also used : Action(org.eclipse.che.ide.api.action.Action) CustomComponentAction(org.eclipse.che.ide.api.action.CustomComponentAction) CustomComponentAction(org.eclipse.che.ide.api.action.CustomComponentAction) Widget(com.google.gwt.user.client.ui.Widget) Presentation(org.eclipse.che.ide.api.action.Presentation) ActionGroup(org.eclipse.che.ide.api.action.ActionGroup) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Separator(org.eclipse.che.ide.api.action.Separator)

Example 4 with Widget

use of com.google.gwt.user.client.ui.Widget in project che by eclipse.

the class NotificationContainerItem method update.

/**
     * Update notification's widget values.
     * <p/>
     * Widget consumes:
     * <ul>
     * <li>{@link Notification#title}</li>
     * <li>{@link Notification#content}</li>
     * <li>Icon and background color based on {@link StatusNotification.Status}</li>
     * </ul>
     */
private void update() {
    Widget titleWidget = titlePanel.getWidget();
    if (titleWidget != null && titleWidget instanceof Label) {
        ((Label) titleWidget).setText(notification.getTitle());
        StringBuilder infoBuilder = new StringBuilder();
        if (notification.getProject() != null) {
            infoBuilder.append("Project: ").append(notification.getProject().getName()).append(". ");
        }
        infoBuilder.append(DATA_FORMAT.format(new Date(notification.getTime())));
        titlePanel.getElement().setAttribute("info", infoBuilder.toString());
    }
    Widget messageWidget = messagePanel.getWidget();
    if (messageWidget != null && messageWidget instanceof Label) {
        ((Label) messageWidget).setText(notification.getContent());
    }
    if (notification instanceof StatusNotification) {
        iconPanel.setWidget(getIconBaseOnStatus());
    }
}
Also used : Widget(com.google.gwt.user.client.ui.Widget) Label(com.google.gwt.user.client.ui.Label) StatusNotification(org.eclipse.che.ide.api.notification.StatusNotification) Date(java.util.Date)

Example 5 with Widget

use of com.google.gwt.user.client.ui.Widget in project che by eclipse.

the class ClipboardButtonBuilderImpl method append.

/**
     * Append to parentWidget as a child element.
     *
     * @param element
     */
private void append(Element element) {
    if (parentWidget == null && (resourceWidget == null || resourceWidget.getParent() == null)) {
        return;
    }
    Widget parent = parentWidget != null ? parentWidget : resourceWidget.getParent();
    parent.getElement().appendChild(element);
}
Also used : Widget(com.google.gwt.user.client.ui.Widget)

Aggregations

Widget (com.google.gwt.user.client.ui.Widget)260 Test (org.junit.Test)29 Element (com.google.gwt.dom.client.Element)23 IsWidget (com.google.gwt.user.client.ui.IsWidget)22 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)17 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)15 ArrayList (java.util.ArrayList)15 HTML (com.google.gwt.user.client.ui.HTML)13 Label (com.google.gwt.user.client.ui.Label)11 IFrameTabPanel (org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel)10 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)9 MaterialWidget (gwt.material.design.client.base.MaterialWidget)9 ListBox (org.gwtbootstrap3.client.ui.ListBox)9 ListItem (gwt.material.design.client.ui.html.ListItem)8 FactPattern (org.drools.workbench.models.datamodel.rule.FactPattern)8 TextBox (org.gwtbootstrap3.client.ui.TextBox)8 Command (com.google.gwt.user.client.Command)7 Image (com.google.gwt.user.client.ui.Image)7 VButton (com.vaadin.client.ui.VButton)7 Timer (com.google.gwt.user.client.Timer)6