Example usage for com.google.gwt.user.client.ui HorizontalPanel add

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

Introduction

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

Prototype

@Override
    public void add(Widget w) 

Source Link

Usage

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

License:EUPL

public ControlPointForm(ImageAnnotationComposite annotationComposite, ControlPointLayer controlPointLayer,
        ImageAnnotationTreeNode annotationTreeNode, boolean fragmentAnnotation, boolean update) {
    // Reference to control point layer
    this.controlPointLayer = controlPointLayer;

    // Place name (will be geo-coded)
    HorizontalPanel placeNamePanel = new HorizontalPanel();

    Label placeNameLabel = new Label("Place: ");
    placeNameLabel.setStyleName("cp-Editor-Label");
    placeNamePanel.add(placeNameLabel);

    placeName = new TextBox();
    placeName.setStyleName("cp-Editor-Field");
    placeName.addKeyPressHandler(new KeyPressHandler() {
        @Override/*w  w w .  j a v  a  2s .  co  m*/
        public void onKeyPress(KeyPressEvent event) {
            doAsyncGeocoding(placeName.getText() + event.getCharCode());
        }
    });

    placeNamePanel.add(placeName);

    // Lon (determined automatically - field disabled)
    HorizontalPanel lonPanel = new HorizontalPanel();

    Label lonLabel = new Label("Lon: ");
    lonLabel.setStyleName("cp-Editor-Label");
    lonPanel.add(lonLabel);

    lon = new TextBox();
    lon.setEnabled(false);
    lon.setStyleName("cp-Editor-Field");
    lonPanel.add(lon);

    // Lat (determined automatically - field disabled)
    HorizontalPanel latPanel = new HorizontalPanel();

    Label latLabel = new Label("Lat: ");
    latLabel.setStyleName("cp-Editor-Label");
    latPanel.add(latLabel);

    lat = new TextBox();
    lat.setEnabled(false);
    lat.setStyleName("cp-Editor-Field");
    latPanel.add(lat);

    // X/Y (determined automatically - field disabled)
    HorizontalPanel xyPanel = new HorizontalPanel();

    Label xyLabel = new Label("X/Y: ");
    xyLabel.setStyleName("cp-Editor-Label");
    xyPanel.add(xyLabel);

    xy = new TextBox();
    xy.setEnabled(false);
    xy.setStyleName("cp-Editor-Field");
    xyPanel.add(xy);

    if (update) {
        ImageAnnotation annotation = annotationTreeNode.getAnnotation();
        placeName.setText(annotation.getTitle());
        GeoPoint p = (GeoPoint) annotation.getFragment().getShape();
        lon.setText(Double.toString(p.getLng()));
        lat.setText(Double.toString(p.getLat()));
        setXY(p.getX(), p.getY());
    }

    // Assemble the main FlowPanel
    FlowPanel form = new FlowPanel();
    form.setStyleName("cp-Editor");
    form.add(placeNamePanel);
    form.add(lonPanel);
    form.add(latPanel);
    form.add(xyPanel);
    form.add(createButtonsPanel(update, annotationTreeNode, annotationComposite));
    form.setStyleName("imageAnnotation-form");
    initWidget(form);

    controlPointLayer.setControlPointForm(this);
    if (update) {
        controlPointLayer.showActiveFragmentPanel(annotationTreeNode.getAnnotation(), false);
    } else {
        controlPointLayer.showActiveFragmentPanel(null, false);
    }
}

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

License:EUPL

private HorizontalPanel createRadioButton(final String kml, String label, boolean preselected) {
    HorizontalPanel panel = new HorizontalPanel();
    RadioButton radio = new RadioButton(RADIO_GROUP);
    radio.setValue(preselected);//ww  w  .jav a  2  s  .  co m
    radio.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (kml != null) {
                kmlLayer.showKml(kml);
            } else {
                kmlLayer.hideKml();
            }
        }
    });
    panel.add(radio);
    panel.add(new InlineHTML(label));
    return panel;
}

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

License:EUPL

public SearchPanel(TiledImageComposite imageComposite) {
    this.searchLayer = imageComposite.getSearchLayer();
    AnnotationConstants i18n = Application.getConstants();

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setStyleName("explore-PlaceSearch");
    Label searchLabel = new Label(i18n.searchLabel());
    searchBox = new TextBox();
    Button searchBtn = new Button(i18n.searchButton(), new ClickHandler() {
        @Override/*  w w w.  j  a v a  2  s.com*/
        public void onClick(ClickEvent event) {
            doAsyncGeocoding();
        }
    });
    hPanel.add(searchLabel);
    hPanel.add(searchBox);
    hPanel.add(searchBtn);

    this.add(hPanel);
}

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

License:EUPL

/**
 * show hints and create link to help page
 *///from w  ww . j ava  2  s .  co  m
protected Widget createHeader() {
    // The parent header panel
    FlowPanel header = new FlowPanel();

    // 'Add your Annotation' label
    Label addAnnotationLabel = new Label(YUMACoreProperties.getConstants().addAnnotation());
    addAnnotationLabel.setStyleName("imageAnnotation-add-annotation");
    header.add(addAnnotationLabel);

    // 'Loading' animation
    header.add(loadingImage);

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

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

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

    // 'Annotate' button
    annotateButton.setStyleName("imageAnnotation-button");
    annotateButton.setText(YUMACoreProperties.getConstants().annotate());
    annotateButton.addClickHandler(new AnnotateClickHandler(this, null, null, false));
    annotateButton.setEnabled(!User.get().isAnonymous());
    buttons.add(annotateButton);

    // 'Annotate Fragment' button
    annotateFragmentButton.setStyleName("imageAnnotation-button");
    annotateFragmentButton.setText(YUMACoreProperties.getConstants().annotateFragment());
    annotateFragmentButton.addClickHandler(new AnnotateClickHandler(this, null, null, true));
    annotateFragmentButton.setEnabled(!User.get().isAnonymous());
    buttons.add(annotateFragmentButton);

    header.add(buttons);
    return header;
}

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//from ww  w .j  a  v  a  2  s.co  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 createScopePanel() {
    HorizontalPanel radioPanel = new HorizontalPanel();

    Label scopeLabel = new Label();
    scopeLabel.setStyleName("imageAnnotation-form-label");

    rdPublic = new RadioButton(SCOPE_RADIO_GROUP_NAME, " " + i18n.publicScope());
    rdPublic.setStyleName("imageAnnotation-form-radiobutton");

    rdPrivate = new RadioButton(SCOPE_RADIO_GROUP_NAME, " " + i18n.privateScope());
    rdPrivate.setStyleName("imageAnnotation-form-radiobutton");

    if (annotation != null && annotation.getAnnotation().getScope() == Scope.PRIVATE) {
        rdPrivate.setValue(true, true);//w  w  w  . j a  va 2s. c o  m
    } else {
        rdPublic.setValue(true, true);
    }

    radioPanel.add(scopeLabel);
    radioPanel.add(rdPublic);
    radioPanel.add(rdPrivate);

    return radioPanel;
}

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 {//from   w  w w.  j  a  va  2 s. com
        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.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);

    Label userLabel = new Label(annotation.getCreatedBy().getUsername());
    userLabel.setStyleName("imageAnnotation-header-user");
    userLabel.getElement().setAttribute("property", "dc:creator");
    headerPanel.add(userLabel);//  ww w  .ja  va  2 s.  co  m

    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);

    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);//from   ww  w.  j a v  a  2  s .  c  om

    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;
}

From source file:at.ait.dme.yuma.suite.apps.map.client.explore.SearchPanel.java

License:EUPL

public SearchPanel(TileBasedImageViewer imageComposite) {
    this.searchLayer = imageComposite.getSearchLayer();
    I18NConstants i18n = YUMACoreProperties.getConstants();

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setStyleName("explore-PlaceSearch");
    Label searchLabel = new Label(i18n.searchLabel());
    searchBox = new TextBox();
    Button searchBtn = new Button(i18n.searchButton(), new ClickHandler() {
        @Override/*w w  w  .j a  va2s. c o m*/
        public void onClick(ClickEvent event) {
            doAsyncGeocoding();
        }
    });
    hPanel.add(searchLabel);
    hPanel.add(searchBox);
    hPanel.add(searchBtn);

    this.add(hPanel);
}