Search in sources :

Example 46 with Image

use of com.google.gwt.user.client.ui.Image in project drools-wb by kiegroup.

the class FactPatternWidget method predicateEditor.

/**
 * This provides an inline formula editor, not unlike a spreadsheet does.
 */
private Widget predicateEditor(final SingleFieldConstraint c) {
    HorizontalPanel pred = new HorizontalPanel();
    pred.setWidth("100%");
    Image img = new Image(GuidedRuleEditorResources.INSTANCE.images().functionAssets());
    img.setTitle(GuidedRuleEditorResources.CONSTANTS.FormulaBooleanTip());
    pred.add(img);
    if (c.getValue() == null) {
        c.setValue("");
    }
    final TextBox box = new TextBox();
    box.setText(c.getValue());
    if (!this.readOnly) {
        box.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                setModified(true);
                c.setValue(box.getText());
            }
        });
        box.setWidth("100%");
        pred.add(box);
    } else {
        pred.add(new SmallLabel(c.getValue()));
    }
    return pred;
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) ExpressionTypeChangeEvent(org.drools.workbench.screens.guided.rule.client.editor.ExpressionTypeChangeEvent) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) ExpressionTypeChangeHandler(org.drools.workbench.screens.guided.rule.client.editor.ExpressionTypeChangeHandler) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) TextBox(org.gwtbootstrap3.client.ui.TextBox) Image(com.google.gwt.user.client.ui.Image)

Example 47 with Image

use of com.google.gwt.user.client.ui.Image in project opennms by OpenNMS.

the class Application method onModuleLoad.

/**
 * This is the entry point method.
 */
public void onModuleLoad() {
    m_chartService = new DefaultChartService();
    Image img = new Image();
    img.setUrl("../images/logo.png");
    img.getElement().getStyle().setPaddingTop(14, Unit.PX);
    img.getElement().getStyle().setPaddingLeft(14, Unit.PX);
    FlowPanel header = new FlowPanel();
    header.getElement().setId("header");
    header.add(img);
    final DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.PX);
    dockLayoutPanel.addNorth(header, 75.00);
    RootLayoutPanel.get().add(dockLayoutPanel);
    m_nav = new Navigation();
    m_nav.addLocationUpdateEventHandler(this);
    m_nav.addHostUpdateEventHandler(this);
    m_flowPanel = new FlowPanel();
    Runnable timelineCallback = new Runnable() {

        public void run() {
            m_chartService.getAllLocationsAvailability(new RequestCallback() {

                @Override
                public void onResponseReceived(Request request, Response response) {
                    if (response.getStatusCode() == 200) {
                        m_timeline = new AnnotatedTimeLine(ChartUtils.convertJSONToDataTable(response.getText()), createTimelineOptions(), "440px", "250px");
                        m_flowPanel.add(m_timeline);
                        m_flowPanel.add(m_nav);
                        dockLayoutPanel.add(m_flowPanel);
                    }
                }

                @Override
                public void onError(Request request, Throwable exception) {
                    Window.alert("Error Initializing Chart");
                }
            });
        }
    };
    VisualizationUtils.loadVisualizationApi(timelineCallback, AnnotatedTimeLine.PACKAGE);
    initializeNav();
}
Also used : Response(com.google.gwt.http.client.Response) AnnotatedTimeLine(com.google.gwt.visualization.client.visualizations.AnnotatedTimeLine) RequestCallback(com.google.gwt.http.client.RequestCallback) DockLayoutPanel(com.google.gwt.user.client.ui.DockLayoutPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Request(com.google.gwt.http.client.Request) Image(com.google.gwt.user.client.ui.Image)

Example 48 with Image

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

the class PopupMenu method redraw.

/** Render Popup Menu component. */
private void redraw() {
    String idPrefix = itemIdPrefix;
    if (idPrefix == null) {
        idPrefix = "";
    } else {
        idPrefix += "/";
    }
    table = new PopupMenuTable();
    table.setStyleName(POPUP_RESOURCES.popup().popupMenuTable());
    table.setCellPadding(0);
    table.setCellSpacing(0);
    for (int i = 0; i < list.size(); i++) {
        Action menuItem = list.get(i);
        if (menuItem instanceof Separator) {
            final String separatorText = ((Separator) menuItem).getText();
            if (separatorText == null) {
                table.getCellFormatter().setStyleName(i, 0, POPUP_RESOURCES.popup().popupMenuDelimiter());
            } else {
                table.setWidget(i, 0, new Label(separatorText));
                table.getCellFormatter().setStyleName(i, 0, POPUP_RESOURCES.popup().popupMenuTextDelimiter());
            }
            table.getFlexCellFormatter().setColSpan(i, 0, hasCheckedItems ? 5 : 4);
        } else {
            Presentation presentation = presentationFactory.getPresentation(menuItem);
            if (presentation.getImageResource() != null) {
                Image image = new Image(presentation.getImageResource());
                table.setWidget(i, 0, image);
            } else if (presentation.getSVGResource() != null) {
                SVGImage image = new SVGImage(presentation.getSVGResource());
                table.setWidget(i, 0, image);
            } else if (presentation.getHTMLResource() != null) {
                table.setHTML(i, 0, presentation.getHTMLResource());
            }
            table.getCellFormatter().setStyleName(i, 0, presentation.isEnabled() ? POPUP_RESOURCES.popup().popupMenuIconField() : POPUP_RESOURCES.popup().popupMenuIconFieldDisabled());
            int work = 1;
            if (hasCheckedItems) {
                if (menuItem instanceof ToggleAction) {
                    ToggleAction toggleAction = (ToggleAction) menuItem;
                    ActionEvent e = new ActionEvent(presentationFactory.getPresentation(toggleAction), actionManager, managerProvider.get());
                    if (toggleAction.isSelected(e)) {
                        // Temporary solution
                        table.setHTML(i, work, "<i class=\"fa fa-check\"></i>");
                    }
                    table.getCellFormatter().setStyleName(i, work, presentation.isEnabled() ? POPUP_RESOURCES.popup().popupMenuCheckField() : POPUP_RESOURCES.popup().popupMenuCheckFieldDisabled());
                } else {
                    table.setHTML(i, work, "");
                }
                work++;
            }
            table.setHTML(i, work, "<nobr id=\"" + idPrefix + presentation.getText() + "\">" + presentation.getText() + "</nobr>");
            table.getCellFormatter().setStyleName(i, work, presentation.isEnabled() ? POPUP_RESOURCES.popup().popupMenuTitleField() : POPUP_RESOURCES.popup().popupMenuTitleFieldDisabled());
            if (showTooltips) {
                Tooltip.create((elemental.dom.Element) table.getCellFormatter().getElement(i, work), BOTTOM, MIDDLE, presentation.getText());
            }
            work++;
            String hotKey = KeyMapUtil.getShortcutText(keyBindingAgent.getKeyBinding(actionManager.getId(menuItem)));
            if (hotKey == null) {
                hotKey = "&nbsp;";
            } else {
                hotKey = "<nobr>&nbsp;" + hotKey + "&nbsp;</nobr>";
            }
            table.setHTML(i, work, hotKey);
            table.getCellFormatter().setStyleName(i, work, presentation.isEnabled() ? POPUP_RESOURCES.popup().popupMenuHotKeyField() : POPUP_RESOURCES.popup().popupMenuHotKeyFieldDisabled());
            work++;
            if (menuItem instanceof ActionGroup && !(((ActionGroup) menuItem).canBePerformed() && !Utils.hasVisibleChildren((ActionGroup) menuItem, presentationFactory, actionManager, managerProvider.get()))) {
                table.setWidget(i, work, new SVGImage(POPUP_RESOURCES.subMenu()));
                table.getCellFormatter().setStyleName(i, work, presentation.isEnabled() ? POPUP_RESOURCES.popup().popupMenuSubMenuField() : POPUP_RESOURCES.popup().popupMenuSubMenuFieldDisabled());
            } else {
                table.getCellFormatter().setStyleName(i, work, presentation.isEnabled() ? POPUP_RESOURCES.popup().popupMenuSubMenuField() : POPUP_RESOURCES.popup().popupMenuSubMenuFieldDisabled());
            }
            work++;
            table.getRowFormatter().getElement(i).setAttribute("item-index", Integer.toString(i));
            table.getRowFormatter().getElement(i).setAttribute("item-enabled", Boolean.toString(presentation.isEnabled()));
            String actionId = actionManager.getId(menuItem);
            String debugId;
            if (actionId == null) {
                debugId = idPrefix + menuItem.getTemplatePresentation().getText();
            } else {
                debugId = idPrefix + actionId;
            }
            UIObject.ensureDebugId(table.getRowFormatter().getElement(i), debugId);
        }
    }
    popupMenuPanel.add(table);
}
Also used : ToggleAction(org.eclipse.che.ide.api.action.ToggleAction) Action(org.eclipse.che.ide.api.action.Action) ActionEvent(org.eclipse.che.ide.api.action.ActionEvent) Label(com.google.gwt.user.client.ui.Label) Presentation(org.eclipse.che.ide.api.action.Presentation) Image(com.google.gwt.user.client.ui.Image) SVGImage(org.vectomatic.dom.svg.ui.SVGImage) SVGImage(org.vectomatic.dom.svg.ui.SVGImage) ActionGroup(org.eclipse.che.ide.api.action.ActionGroup) ToggleAction(org.eclipse.che.ide.api.action.ToggleAction) Separator(org.eclipse.che.ide.api.action.Separator)

Example 49 with Image

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

the class ActionButton method renderImage.

/** Redraw icon. */
private void renderImage() {
    panel.clear();
    if (presentation.getImageResource() != null) {
        Image img = new Image(presentation.getImageResource());
        img.setStyleName(toolbarResources.toolbar().iconButtonIcon());
        panel.add(img);
    } else if (presentation.getSVGResource() != null) {
        SVGImage image = new SVGImage(presentation.getSVGResource());
        image.getElement().setAttribute("class", toolbarResources.toolbar().iconButtonIcon());
        panel.add(image);
    } else if (presentation.getHTMLResource() != null) {
        FlowPanel icon = new FlowPanel();
        icon.setStyleName(toolbarResources.toolbar().iconButtonIcon());
        FlowPanel inner = new FlowPanel();
        inner.setStyleName(toolbarResources.toolbar().iconButtonIconInner());
        inner.getElement().setInnerHTML(presentation.getHTMLResource());
        icon.add(inner);
        panel.add(inner);
    }
}
Also used : FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Image(com.google.gwt.user.client.ui.Image) SVGImage(org.vectomatic.dom.svg.ui.SVGImage) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 50 with Image

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

the class ImageViewer method getImage.

/**
     * Image to display file with image type.
     *
     * @return {@link Image}
     */
private Image getImage() {
    String contentLink = urlModifier.modify(input.getFile().getContentUrl());
    Image image = (contentLink != null) ? new Image(contentLink) : new Image();
    image.setStyleName(resources.imageViewerCss().imageViewer());
    return image;
}
Also used : Image(com.google.gwt.user.client.ui.Image)

Aggregations

Image (com.google.gwt.user.client.ui.Image)98 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)28 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)28 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)15 Test (org.junit.Test)13 FlexTable (com.google.gwt.user.client.ui.FlexTable)12 HTML (com.google.gwt.user.client.ui.HTML)10 Element (com.google.gwt.dom.client.Element)8 Label (com.google.gwt.user.client.ui.Label)8 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)7 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)7 ImageResource (com.google.gwt.resources.client.ImageResource)6 Widget (com.google.gwt.user.client.ui.Widget)6 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)5 Style (com.google.gwt.dom.client.Style)4 Anchor (com.google.gwt.user.client.ui.Anchor)4 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)4 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)3 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)3 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)3