Example usage for com.google.gwt.user.client.ui AbstractImagePrototype createImage

List of usage examples for com.google.gwt.user.client.ui AbstractImagePrototype createImage

Introduction

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

Prototype

public abstract Image createImage();

Source Link

Document

Creates a new Image instance based on the image represented by this prototype.

Usage

From source file:cazcade.vortex.widgets.client.misc.toolbar.RichTextToolbar.java

License:Apache License

@Nonnull
private PushButton createPushButton(@Nonnull final AbstractImagePrototype img, final String tip) {
    final PushButton pb = new PushButton(img.createImage());
    pb.addClickListener(listener);/*from w  ww .j  a v  a 2  s.c  o m*/
    pb.setTitle(tip);
    return pb;
}

From source file:cazcade.vortex.widgets.client.misc.toolbar.RichTextToolbar.java

License:Apache License

@Nonnull
private ToggleButton createToggleButton(@Nonnull final AbstractImagePrototype img, final String tip) {
    final ToggleButton tb = new ToggleButton(img.createImage());
    tb.addClickListener(listener);/*from ww w.j  ava  2  s  . c  o m*/
    tb.setTitle(tip);
    return tb;
}

From source file:cc.alcina.framework.gwt.client.ClientNotificationsImpl.java

License:Apache License

@Override
public void showDialog(String captionHTML, Widget captionWidget, String msg, MessageType messageType,
        List<Button> extraButtons, String containerStyle) {
    ensureImages();//from   w ww  . ja  v a2 s  .  c  o  m
    HorizontalAlignmentConstant align = messageType == MessageType.ERROR ? HasHorizontalAlignment.ALIGN_LEFT
            : HasHorizontalAlignment.ALIGN_CENTER;
    if (dialogBox != null) {
        dialogBox.hide();
    }
    String title = CommonUtils.friendlyConstant(messageType);
    dialogBox = new GlassDialogBox();
    dialogBox.setAnimationEnabled(dialogAnimationEnabled);
    AbstractImagePrototype aip = null;
    String text = "";
    switch (messageType) {
    case INFO:
        aip = AbstractImagePrototype.create(images.info());
        text = "Information";
        break;
    case WARN:
        aip = AbstractImagePrototype.create(images.warning());
        text = "Warning";
        break;
    case ERROR:
        aip = AbstractImagePrototype.create(images.error());
        text = "Problem notification";
        break;
    }
    dialogBox.setText(text);
    FlexTable ft = new FlexTable();
    containerStyle = containerStyle != null ? containerStyle
            : (messageType == MessageType.ERROR || !CommonUtils.isNullOrEmpty(msg)) ? "medium" : "narrow";
    ft.setCellSpacing(4);
    ft.setStyleName("alcina-Notification");
    ft.addStyleName(containerStyle);
    FlexCellFormatter cf = (FlexCellFormatter) ft.getCellFormatter();
    ft.setWidget(0, 0, aip.createImage());
    cf.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
    cf.setWidth(0, 0, "40px");
    FlowPanel fp = new FlowPanel();
    fp.setStyleName("text");
    Widget capWidget = captionHTML != null ? new HTML(captionHTML) : captionWidget;
    if (captionHTML != null) {
        capWidget.setStyleName("caption");
    }
    fp.add(capWidget);
    if (!CommonUtils.isNullOrEmpty(msg)) {
        Link nh = new Link("View detail");
        nh.addStyleName("pad-5");
        dialogHtml = new HTML("<span class='logboxpre'>" + msg.replace("\n", "<br>") + "</span>", true);
        final ScrollPanel sp = new ScrollPanel(dialogHtml);
        sp.setStyleName("logbox");
        sp.setVisible(containerStyle.equals("wide"));
        nh.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                sp.setVisible(!sp.isVisible());
            }
        });
        if (LooseContext.getBoolean(ClientNotifications.CONTEXT_AUTOSHOW_DIALOG_DETAIL)) {
            sp.setVisible(true);
        }
        fp.add(nh);
        fp.add(sp);
    }
    ft.setWidget(0, 1, fp);
    cf.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(8);
    Button closeButton = new Button("Close");
    hp.add(closeButton);
    if (extraButtons != null) {
        for (Button b : extraButtons) {
            hp.add(b);
        }
    }
    ft.setWidget(1, 0, hp);
    cf.setColSpan(1, 0, 2);
    cf.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);
    closeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    dialogBox.setWidget(ft);
    dialogBox.center();
    dialogBox.show();
    Scheduler.get().scheduleDeferred(() -> closeButton.setFocus(true));
}

From source file:cc.alcina.framework.gwt.client.widget.richtext.RichTextToolbar.java

License:Apache License

private ToggleButton createToggleButton(AbstractImagePrototype img, String tip) {
    ToggleButton tb = new ToggleButton(img.createImage());
    tb.addClickListener(listener);/* w  ww .  j ava2s. c o  m*/
    tb.setTitle(tip);
    return tb;
}

From source file:cc.alcina.framework.gwt.client.widget.richtext.RichTextToolbar.java

License:Apache License

protected PushButton createPushButton(AbstractImagePrototype img, String tip) {
    PushButton pb = new PushButton(img.createImage());
    pb.addClickListener(listener);//  w  w w  . j  av  a 2s.c o  m
    pb.setTitle(tip);
    return pb;
}

From source file:ch.unibas.medizin.osce.client.style.widgets.richtext.RichTextToolbar.java

License:Apache License

private PushButton createPushButton(AbstractImagePrototype img, String tip) {
    PushButton pb = new PushButton(img.createImage());
    pb.addClickHandler(handler);/*from ww  w .j a  va  2s  . c  o  m*/
    pb.setTitle(tip);
    return pb;
}

From source file:ch.unibas.medizin.osce.client.style.widgets.richtext.RichTextToolbar.java

License:Apache License

private ToggleButton createToggleButton(AbstractImagePrototype img, String tip) {
    ToggleButton tb = new ToggleButton(img.createImage());
    tb.addClickHandler(handler);/* w  w w .jav  a2  s  . com*/
    tb.setTitle(tip);
    return tb;
}

From source file:com.appspot.hommkmessage.client.view.ListView.java

License:Open Source License

private void setEntryHeader(final MessageMetadata messageMetadata, final DisclosurePanel entryPanel,
        boolean entryClosed) {
    HTML header = messageMetadata.getInfoLine(dateFormatter, localStorage);
    Panel entryHeaderPanel = new HorizontalPanel();
    AbstractImagePrototype imagePrototype = entryClosed ? images.disclosurePanelClosed()
            : images.disclosurePanelOpen();
    Image image = imagePrototype.createImage();
    entryHeaderPanel.add(image);//from w w w  .jav  a2s  . com
    entryHeaderPanel.add(header);
    entryPanel.setHeader(entryHeaderPanel);
}

From source file:com.apress.progwt.client.college.gui.ext.RichTextToolbar.java

License:Apache License

private PushButton createPushButton(AbstractImagePrototype img, String tip) {
    PushButton pb = new PushButton(img.createImage());
    pb.addClickListener(listener);//from w w w  .j a v  a2  s  . c  om
    pb.setTitle(tip);
    return pb;
}

From source file:com.fullmetalgalaxy.client.game.board.WgtBoardLayerLocked.java

License:Open Source License

private Image addImage() {
    AbstractImagePrototype imageprototype = AbstractImagePrototype.create(Icons.s_instance.strategy_padlock());
    if (GameEngine.model().getZoomDisplayed().getValue() == EnuZoom.Medium) {
        imageprototype = AbstractImagePrototype.create(Icons.s_instance.tactic_padlock());
    }/*from   w w w  . j a  v a  2  s  . c  o  m*/
    Image image = null;
    if (!m_unusedImages.isEmpty()) {
        image = m_unusedImages.iterator().next();
        imageprototype.applyTo(image);
        image.setVisible(true);
        m_unusedImages.remove(image);
    } else {
        image = imageprototype.createImage();
        add(image);
        DOM.setStyleAttribute(image.getElement(), "zIndex", "1000");
        image.addStyleName("transparent50");
    }
    m_usedImages.add(image);
    return image;
}