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

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

Introduction

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

Prototype

@Override
public void add(Widget w) 

Source Link

Document

Adds a new child widget to the panel.

Usage

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

License:EUPL

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

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

    // '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().addAnnotationHint());
    addAnnotationHint.setStyleName("imageAnnotation-add-annotation-hint");
    header.add(addAnnotationHint);

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

    // 'Annotate' button
    annotateButton.setStyleName("imageAnnotation-button");
    annotateButton.setText(Application.getConstants().actionCreate());
    annotateButton.addClickHandler(new CreateImageAnnotationClickHandler(this, null, false, false));
    annotateButton.setEnabled(!Application.getUser().isEmpty());
    buttons.add(annotateButton);

    // 'Annotate Fragment' button
    annotateFragmentButton.setStyleName("imageAnnotation-button");
    annotateFragmentButton.setText(Application.getConstants().actionCreateFragment());
    annotateFragmentButton.addClickHandler(new CreateImageAnnotationClickHandler(this, null, true, false));
    annotateFragmentButton.setEnabled(!Application.getUser().isEmpty());
    buttons.add(annotateFragmentButton);

    // 'Show on Map' button
    showOnMapButton.setStyleName("imageAnnotation-button");
    showOnMapButton.setText(Application.getConstants().actionShowOnMap());
    showOnMapButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            WindowPanel window = MinMaxWindowPanel.createMinMaxWindowPanel(550, 300, 500, 300);
            window.getHeader().setText("Map");
            window.setWidget(new GoogleMapsComposite(annotations));
            window.setResizable(false);
            window.show();
        }
    });
    showOnMapButton.setVisible(Application.getBbox() != null || Application.isInTileMode());
    buttons.add(showOnMapButton);

    header.add(buttons);
    header.add(annotationFormPanel);
    return header;
}

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

License:EUPL

/**
 * adds the body (title and text)/*from w w w.  j  a  va2s.  c  o m*/
 */
public void addBody() {
    title.setText(annotation.getTitle());
    title.setStyleName("imageAnnotation-title");

    text.setStyleName("imageAnnotation-text");
    text.setHTML(annotation.getText());

    if (title.getText() != null)
        annotationPanel.add(title);
    annotationPanel.add(text);

    // Semantic tags
    if (annotation.hasSemanticTags()) {
        FlowPanel tagPanel = new FlowPanel();
        tagPanel.setStyleName("imageAnnotation-taglist");
        for (SemanticTag t : annotation.getSemanticTags()) {
            InlineHTML span = new InlineHTML("<a target=\"_blank\" href=\"" + t.getURI() + "\" title=\""
                    + t.getDescription() + "\">" + t.getTitle() + "</a>");
            tagPanel.add(span);
        }
        annotationPanel.add(tagPanel);
    }
}

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

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

    // 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.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);/*from  ww w  . ja  v  a 2 s. co m*/

    placeName = new TextBox();
    placeName.setStyleName("cp-Editor-Field");
    placeName.addKeyPressHandler(new KeyPressHandler() {
        @Override
        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.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  ww. j  a  v  a  2 s. com

    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.client.util.LoadMask.java

License:EUPL

public LoadMask(String label) {
    this.setStyleName("loadmask");

    FlowPanel inner = new FlowPanel();
    inner.setStyleName("inner");
    inner.add(new Image("images/loading.gif"));
    inner.add(new Label(label));

    this.setWidget(inner);
    center();/*from   w ww .  j a  v  a 2 s  .c  o m*/
}

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 ww  w. j  a  v  a2  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.core.client.widgets.LoadingPopup.java

License:EUPL

public LoadingPopup(String label) {
    this.setStyleName("loadmask");

    FlowPanel inner = new FlowPanel();
    inner.setStyleName("inner");
    inner.add(new Image("images/ajax-loader-large.gif"));
    inner.add(new Label(label));

    this.setWidget(inner);
    center();/*from www  .  j ava  2 s.c  o  m*/
}

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

License:EUPL

protected FlowPanel createTitlePanel() {
    FlowPanel titlePanel = new FlowPanel();

    Label titleLabel = new Label(i18n.title());
    titleLabel.setStyleName("annotationEditForm-label");

    titleTextBox.setStyleName("annotationEditForm-title-input");
    if (annotation == null && parent != null) {
        titleTextBox.setText("RE: " + parent.getAnnotation().getTitle());
    } else if (annotation != null) {
        titleTextBox.setText(annotation.getAnnotation().getTitle());
    }//from  w  ww . ja  va  2s.  c  o m

    titlePanel.add(titleLabel);
    titlePanel.add(titleTextBox);
    return titlePanel;
}

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

License:EUPL

protected FlowPanel createTextPanel() {
    FlowPanel textPanel = new FlowPanel();

    Label textLabel = new Label(i18n.text());
    textLabel.setStyleName("annotationEditForm-label");

    textArea.setStyleName("annotationEditForm-text-input");
    if (annotation != null)
        textArea.setText(annotation.getAnnotation().getText());
    textArea.addKeyDownHandler(new AbstractKeyboardHandler(1000) {
        @Override/*ww w.  j  a  v a 2 s  .  c  om*/
        public void onSpace() {
            getTagSuggestions();
        }

        @Override
        public void onIdle() {
            getTagSuggestions();
        }
    });

    textPanel.add(textLabel);
    textPanel.add(textArea);

    return textPanel;
}