Example usage for com.google.gwt.user.client.ui PushButton PushButton

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

Introduction

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

Prototype

public PushButton(String upText) 

Source Link

Document

Constructor for PushButton.

Usage

From source file:ace.client.JSEditorToolbar.java

License:Apache License

private PushButton createPushButton(ImageResource img, String tip) {
    PushButton pb = new PushButton(new Image(img));
    pb.addClickHandler(handler);/*  w  w  w .j  a v a 2  s .co  m*/
    pb.setTitle(tip);
    return pb;
}

From source file:at.ac.fhcampuswien.atom.client.gui.attributes.components.RichTextToolbar.java

License:Open Source License

/** Method to create a Push button for the toolbar **/
private PushButton createPushButton(String url, Integer top, Integer left, Integer width, Integer height,
        String tip) {/*w  w w. j  a  va2  s.c  o  m*/
    Image extract = new Image(url, left, top, width, height);
    PushButton tb = new PushButton(extract);
    tb.setHeight(height + "px");
    tb.setWidth(width + "px");
    tb.addClickHandler(evHandler);
    if (tip != null) {
        tb.setTitle(tip);
    }
    return tb;
}

From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java

License:EUPL

private HorizontalPanel createButtonsPanel(boolean update, ImageAnnotationTreeNode annotationTreeNode,
        ImageAnnotationComposite annotationComposite) {

    HorizontalPanel buttonsPanel = new HorizontalPanel();
    PushButton saveButton = new PushButton(Application.getConstants().actionSave());
    if (update) {
        saveButton.addClickHandler(/*from w w w  .  j  av a 2 s .c o m*/
                new UpdateImageAnnotationClickHandler(annotationComposite, annotationTreeNode, this));
    } else {
        saveButton.addClickHandler(
                new SaveImageAnnotationClickHandler(annotationComposite, annotationTreeNode, this));
    }
    saveButton.setStyleName("imageAnnotation-form-button");
    buttonsPanel.add(saveButton);

    PushButton cancelButton = new PushButton(Application.getConstants().actionCancel());
    cancelButton.setStyleName("imageAnnotation-form-button");
    cancelButton
            .addClickHandler(new CancelImageAnnotationClickHandler(annotationComposite, annotationTreeNode));
    buttonsPanel.add(cancelButton);

    return buttonsPanel;
}

From source file:at.ait.dme.yuma.client.map.annotation.ControlPointComposite.java

License:EUPL

@Override
protected Widget createHeader() {
    // The parent header panel
    FlowPanel header = new FlowPanel();

    // 'Help geo-Reference' label
    Label addAnnotationLabel = new Label(Application.getConstants().helpGeoreference());
    addAnnotationLabel.setStyleName("imageAnnotation-add-annotation");
    header.add(addAnnotationLabel);/*w  ww . ja  va2s  . c  o m*/

    // 'Help' link
    HTML help = new HTML(
            "<a target=\"_blank\" href=\"userguide_" + LocaleInfo.getCurrentLocale().getLocaleName()
                    + ".html\">" + Application.getConstants().help() + "</a>");
    help.setStyleName("imageAnnotation-help");
    header.add(help);

    // Instructions text
    Label addAnnotationHint = new Label(Application.getConstants().helpGeoreferenceHint());
    addAnnotationHint.setStyleName("imageAnnotation-add-annotation-hint");
    header.add(addAnnotationHint);

    // Button panel
    HorizontalPanel buttons = new HorizontalPanel();

    // 'Create Control Point' button
    createButton = new PushButton(Application.getConstants().actionCreateCP());
    createButton.setStyleName("imageAnnotation-button");
    createButton.addClickHandler(new CreateImageAnnotationClickHandler(this, null, false, false));
    createButton.setEnabled(!Application.getUser().isEmpty());
    buttons.add(createButton);

    header.add(buttons);

    // Placeholder for the annotation form 
    header.add(annotationFormPanel);

    return header;
}

From source file:at.ait.dme.yuma.client.map.MapPopup.java

License:EUPL

public MapPopup(String title, String html, LonLat lonlat, Map map, ClickHandler closeHandler) {
    this.lonlat = lonlat;
    this.map = map;
    this.setStyleName("mapPopup");

    FlowPanel header = new FlowPanel();
    header.setStyleName("title");
    header.add(new InlineHTML(title));

    PushButton closeButton = new PushButton("X");
    closeButton.setStyleName("close");
    closeButton.addClickHandler(closeHandler);
    header.add(closeButton);//  w  w  w  . j  a  va2s .c  o m

    FlowPanel inner = new FlowPanel();
    inner.setStyleName("inner");
    inner.add(new InlineHTML(html));

    moveListener = new EventListener() {
        @Override
        public void onEvent(LonLat ll, Pixel p, String tagname) {
            updatePosition();
        }
    };
    map.registerMapEventListener(moveListener, Map.EVENT_MOVE);

    FlowPanel panel = new FlowPanel();
    panel.add(header);
    panel.add(inner);

    this.setWidget(panel);

    DeferredCommand.addCommand(new Command() {
        @Override
        public void execute() {
            updatePosition();
        }
    });
}

From source file:at.ait.dme.yuma.suite.apps.image.core.client.treeview.ImageAnnotationEditForm.java

License:EUPL

protected FlowPanel createAddNewTagPanel() {
    FlowPanel container = new FlowPanel();
    container.setStyleName("annotationEditForm-tag");

    Label addTagLabel = new Label(i18n.addTag());
    addTagLabel.setStyleName("annotationEditForm-label");

    HorizontalPanel addTagPanel = new HorizontalPanel();
    final TagSuggestBox newTagTextBox = new TagSuggestBox(10);
    newTagTextBox.setStyleName("annotationEditForm-tag-input");
    newTagTextBox.addSelectionHandler(new SelectionHandler<Suggestion>() {
        @Override/*w ww  . j a v  a  2s . c o m*/
        public void onSelection(SelectionEvent<Suggestion> evt) {
            addTag(newTagTextBox.getTag());
            newTagTextBox.clear();
        }
    });
    addTagPanel.add(newTagTextBox);

    PushButton btnAdd = new PushButton(i18n.add());
    btnAdd.addStyleName("annotationEditForm-tag-btn-add");
    btnAdd.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent evt) {
            addTag(newTagTextBox.getTag());
            newTagTextBox.clear();
        }
    });
    addTagPanel.add(btnAdd);

    PushButton btnBrowse = new PushButton(i18n.browse());
    btnBrowse.addStyleName("annotationEditForm-tag-btn-browse");

    final TagTreePanel tagTreePanel = new TagTreePanel(this);
    btnBrowse.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            WindowPanel window = MinMaxWindowPanel.createMinMaxWindowPanel(200, 200, 350, 450);
            window.setWidget(tagTreePanel);
            window.getHeader().setText(i18n.vocabularyBrowser());
            window.show();
        }
    });
    addTagPanel.add(btnBrowse);

    container.add(addTagLabel);
    container.add(addTagPanel);

    return container;
}

From source file:at.ait.dme.yuma.suite.apps.image.core.client.treeview.ImageAnnotationEditForm.java

License:EUPL

protected HorizontalPanel createButtonsPanel() {
    HorizontalPanel buttonsPanel = new HorizontalPanel();

    PushButton btnSave = new PushButton(i18n.save());
    btnSave.setStyleName("imageAnnotation-form-button");
    if (annotation == null) {
        btnSave.addClickHandler(new SaveClickHandler(panel, parent, this));
    } else {// w ww .jav a 2s.c o  m
        btnSave.addClickHandler(new UpdateClickHandler(panel, annotation, parent, this));
    }
    buttonsPanel.add(btnSave);

    PushButton btnCancel = new PushButton(i18n.cancel());
    btnCancel.setStyleName("imageAnnotation-form-button");
    if (annotation == null) {
        btnCancel.addClickHandler(new CancelClickHandler(panel, parent));
    } else {
        btnCancel.addClickHandler(new CancelClickHandler(panel, annotation));
    }
    buttonsPanel.add(btnCancel);

    return buttonsPanel;
}

From source file:at.ait.dme.yuma.suite.apps.image.core.client.treeview.ImageAnnotationEditForm.java

License:EUPL

@Override
public void addTag(final SemanticTag tag) {
    if (tag == null)
        return;//from w ww  .  j a va  2  s  .  c  o  m

    if (tags.containsKey(tag))
        return;

    FlowPanel container = new FlowPanel();

    InlineHTML span = new InlineHTML("<a target=\"_blank\" href=\"" + tag.getURI() + "\" title=\""
            + tag.getPrimaryDescription() + "\">" + tag.getPrimaryLabel() + "</a>");
    container.add(span);

    PushButton x = new PushButton(new Image(DELETE_TAG_ICON));
    x.setTitle("Remove Tag '" + tag.getPrimaryLabel() + "'");
    x.setStyleName("annotationEditForm-tag-btn-delete");
    x.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            removeTag(tag);
        }
    });
    container.add(x);

    tagPanel.add(container);
    tags.put(tag, container);
    panel.layout();
}

From source file:at.ait.dme.yuma.suite.apps.image.core.client.treeview.ImageAnnotationTreeNode.java

License:EUPL

protected HorizontalPanel createHeader() {
    HorizontalPanel headerPanel = new HorizontalPanel();
    headerPanel.setStyleName("imageAnnotation-header");

    Image avatar = new Image(annotation.getCreatedBy().getGravatarURL());
    avatar.setStyleName("imageAnnotation-header-avatar");
    headerPanel.add(avatar);//from   w w w  . j  a v  a  2  s.  c  om

    Label userLabel = new Label(annotation.getCreatedBy().getUsername());
    userLabel.setStyleName("imageAnnotation-header-user");
    userLabel.getElement().setAttribute("property", "dc:creator");
    headerPanel.add(userLabel);

    Label dateLabel = new Label("(" + DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT)
            .format(annotation.getLastModified()) + ")");
    dateLabel.setStyleName("imageAnnotation-header-date");
    headerPanel.add(dateLabel);

    PushButton feedIcon = new PushButton(new Image("images/feed-icon-14x14.png"));
    feedIcon.setStyleName("imageAnnotation-header-feedicon");
    feedIcon.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.open(YUMACoreProperties.getFeedUrl() + "replies/" + annotation.getId(), "_self", "");
        }
    });
    headerPanel.add(feedIcon);

    return headerPanel;
}

From source file:at.ait.dme.yuma.suite.apps.image.core.client.treeview.ImageAnnotationTreeNode.java

License:EUPL

private Panel createActions() {
    HorizontalPanel actionsPanel = new HorizontalPanel();

    btnReply = new PushButton(YUMACoreProperties.getConstants().reply());
    btnReply.setStyleName("imageAnnotation-action");
    btnReply.addClickHandler(new AnnotateClickHandler(panel, null, this, false));
    btnReply.setEnabled(!User.get().isAnonymous());
    actionsPanel.add(btnReply);//from ww w.  ja  v a  2 s.  c  om

    btnReplyFragment = new PushButton(YUMACoreProperties.getConstants().replyWithFragment());
    btnReplyFragment.setStyleName("imageAnnotation-action");
    btnReplyFragment.addClickHandler(new AnnotateClickHandler(panel, null, this, true));
    btnReplyFragment.setEnabled(!User.get().isAnonymous());
    actionsPanel.add(btnReplyFragment);

    btnEdit = new PushButton(YUMACoreProperties.getConstants().edit());
    btnEdit.setStyleName("imageAnnotation-action");
    btnEdit.setEnabled(User.get().equals(annotation.getCreatedBy()) && !annotation.hasReplies());
    btnEdit.addClickHandler(new AnnotateClickHandler(panel, this, parent, annotation.hasFragment()));
    actionsPanel.add(btnEdit);

    btnDelete = new PushButton(YUMACoreProperties.getConstants().delete());
    btnDelete.setStyleName("imageAnnotation-action");
    btnDelete.setEnabled(User.get().equals(annotation.getCreatedBy()) && !annotation.hasReplies());
    btnDelete.addClickHandler(new DeleteClickHandler(panel, this, parent));
    actionsPanel.add(btnDelete);

    actionsPanel.setStyleName("imageAnnotation-actions");
    return actionsPanel;
}