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:asquare.gwt.tkdemo.client.demos.MiscPanel.java

License:Apache License

public MiscPanel() {
    HorizontalPanel outer = new HorizontalPanel();
    DomUtil.setAttribute(outer, "id", "miscPanel");
    initWidget(outer);//from  w  ww .j  ava 2  s .c o  m

    BasicPanel left = new BasicPanel();
    BasicPanel right = new BasicPanel();

    left.add(new FocusCycleDemo());
    left.add(createSimpleHyperLinkDemo());
    right.add(new GlassPanelDemo());
    right.add(createExternalHyperLinkDemo());

    outer.add(left);
    outer.setCellWidth(left, "50%");
    outer.add(right);
    outer.setCellWidth(right, "50%");
}

From source file:at.ait.dme.yuma.client.colorpicker.ColorPicker.java

License:Artistic License

public ColorPicker() {
    // UI Drawing
    //------------------

    hue = 0;//  www. j a va 2  s.  c  o m
    saturation = 100;
    brightness = 100;
    red = 255;
    green = 0;
    blue = 0;

    HorizontalPanel panel = new HorizontalPanel();
    FlexTable table = new FlexTable();

    // Add the large slider map
    slidermap = new SliderMap(this);
    panel.add(slidermap);
    panel.setCellWidth(slidermap, "258px");
    panel.setCellHeight(slidermap, "258px");

    // Add the small slider bar
    sliderbar = new SliderBar(this);
    panel.add(sliderbar);
    panel.setCellWidth(sliderbar, "40px");
    panel.setCellHeight(sliderbar, "258px");

    // Define the Flextable's content
    // Color preview at the top
    colorpreview = new HTML("");
    colorpreview.setWidth("50px");
    colorpreview.setHeight("50px");
    DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black");

    // Radio buttons
    rbHue = new RadioButton("color", "H:");
    rbHue.addClickHandler(this);
    rbSaturation = new RadioButton("color", "S:");
    rbSaturation.addClickHandler(this);
    rbBrightness = new RadioButton("color", "V:");
    rbBrightness.addClickHandler(this);
    rbRed = new RadioButton("color", "R:");
    rbRed.addClickHandler(this);
    rbGreen = new RadioButton("color", "G:");
    rbGreen.addClickHandler(this);
    rbBlue = new RadioButton("color", "B:");
    rbBlue.addClickHandler(this);

    // Textboxes
    tbHue = new TextBox();
    tbHue.setText(new Integer(hue).toString());
    tbHue.setMaxLength(3);
    tbHue.setVisibleLength(4);
    tbHue.addKeyPressHandler(this);
    tbHue.addChangeHandler(this);
    tbSaturation = new TextBox();
    tbSaturation.setText(new Integer(saturation).toString());
    tbSaturation.setMaxLength(3);
    tbSaturation.setVisibleLength(4);
    tbSaturation.addKeyPressHandler(this);
    tbSaturation.addChangeHandler(this);
    tbBrightness = new TextBox();
    tbBrightness.setText(new Integer(brightness).toString());
    tbBrightness.setMaxLength(3);
    tbBrightness.setVisibleLength(4);
    tbBrightness.addKeyPressHandler(this);
    tbBrightness.addChangeHandler(this);
    tbRed = new TextBox();
    tbRed.setText(new Integer(red).toString());
    tbRed.setMaxLength(3);
    tbRed.setVisibleLength(4);
    tbRed.addKeyPressHandler(this);
    tbRed.addChangeHandler(this);
    tbGreen = new TextBox();
    tbGreen.setText(new Integer(green).toString());
    tbGreen.setMaxLength(3);
    tbGreen.setVisibleLength(4);
    tbGreen.addKeyPressHandler(this);
    tbGreen.addChangeHandler(this);
    tbBlue = new TextBox();
    tbBlue.setText(new Integer(blue).toString());
    tbBlue.setMaxLength(3);
    tbBlue.setVisibleLength(4);
    tbBlue.addKeyPressHandler(this);
    tbBlue.addChangeHandler(this);
    tbHexColor = new TextBox();
    tbHexColor.setText("ff0000");
    tbHexColor.setMaxLength(6);
    tbHexColor.setVisibleLength(6);
    tbHexColor.addKeyPressHandler(this);
    tbHexColor.addChangeHandler(this);

    // Put together the FlexTable
    table.setWidget(0, 0, colorpreview);
    table.getFlexCellFormatter().setColSpan(0, 0, 3);
    table.setWidget(1, 0, rbHue);
    table.setWidget(1, 1, tbHue);
    table.setWidget(1, 2, new HTML("°"));
    table.setWidget(2, 0, rbSaturation);
    table.setWidget(2, 1, tbSaturation);
    table.setText(2, 2, "%");
    table.setWidget(3, 0, rbBrightness);
    table.setWidget(3, 1, tbBrightness);
    table.setText(3, 2, "%");
    table.setWidget(4, 0, rbRed);
    table.setWidget(4, 1, tbRed);
    table.setWidget(5, 0, rbGreen);
    table.setWidget(5, 1, tbGreen);
    table.setWidget(6, 0, rbBlue);
    table.setWidget(6, 1, tbBlue);
    table.setText(7, 0, "#:");
    table.setWidget(7, 1, tbHexColor);
    table.getFlexCellFormatter().setColSpan(7, 1, 2);

    // Final setup
    panel.add(table);
    rbSaturation.setValue(true);
    setPreview("ff0000");
    DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default");

    // First event
    onClick(rbSaturation);

    initWidget(panel);
}

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

License:EUPL

/**
 * show hints and create link to help page
 *//* ww w  .  j a v  a  2s . co m*/
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.StandardImageAnnotationForm.java

License:EUPL

private HorizontalPanel createTitlePanel(boolean update, ImageAnnotationTreeNode annotationTreeNode) {

    HorizontalPanel titlePanel = new HorizontalPanel();
    Label titleLabel = new Label(Application.getConstants().annotationTitle());
    titleLabel.setStyleName("imageAnnotation-form-label");
    titleTextBox.setStyleName("imageAnnotation-form-title");
    // in case of an update
    if (update)/*from w w  w .j a  v a  2 s  .  co  m*/
        titleTextBox.setText(annotationTreeNode.getTitle());
    //in case of an reply
    if (!update && annotationTreeNode != null)
        titleTextBox.setText(
                Application.getConstants().annotationReplyTitlePrefix() + annotationTreeNode.getTitle());

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

    return titlePanel;
}

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

License:EUPL

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

    HorizontalPanel textPanel = new HorizontalPanel();
    Label textLabel = new Label(Application.getConstants().annotationText());
    textLabel.setStyleName("imageAnnotation-form-label");
    textArea.setStyleName("imageAnnotation-form-text");
    if (update)//from   ww  w .j  ava2s  . com
        textArea.setText(annotationTreeNode.getText());

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

    textArea.addKeyDownHandler(createKeyDownHandler(annotationComposite));

    return textPanel;
}

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

License:EUPL

private HorizontalPanel createRadioPanel(boolean update, ImageAnnotationTreeNode annotationTreeNode) {

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

    HorizontalPanel radioPanel = new HorizontalPanel();
    radioPanel.add(scopeLabel);
    radioPanel.add(//from w  w  w  .  j  a  va 2s. co  m
            rdPublic = new RadioButton(SCOPE_RADIO_GROUP_NAME, " " + Application.getConstants().publicScope()));
    radioPanel.add(rdPrivate = new RadioButton(SCOPE_RADIO_GROUP_NAME,
            " " + Application.getConstants().privateScope()));
    rdPublic.setStyleName("imageAnnotation-form-radiobutton");
    rdPrivate.setStyleName("imageAnnotation-form-radiobutton");

    if (update && annotationTreeNode.getAnnotation().getScope() == ImageAnnotation.Scope.PRIVATE)
        rdPrivate.setValue(true, true);
    else
        rdPublic.setValue(true, true);

    return radioPanel;
}

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

License:EUPL

protected Panel createLinksPanel(boolean update, ImageAnnotationTreeNode annotationTreeNode) {

    HorizontalPanel linksPanel = new HorizontalPanel();
    Label linksLabel = new Label(Application.getConstants().annotationLinks());
    linksLabel.setStyleName("imageAnnotation-form-label");
    linksPanel.add(linksLabel);

    linksStack = new VerticalPanel();
    linksStack.setStyleName("imageAnnotation-form-links");
    linksPanel.add(linksStack);/*from w  ww  . ja  v  a 2s  .  c om*/

    if (update && annotationTreeNode.getAnnotation().hasSemanticTags()) {
        for (SemanticTag t : annotationTreeNode.getAnnotation().getSemanticTags()) {
            addLink(t, linksStack, true);
            if (!this.tags.contains(t)) {
                this.tags.add(t);
            }
        }
    }

    return linksPanel;
}

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

License:EUPL

protected Panel createSemanticLinksPanel(boolean update, ImageAnnotationTreeNode annotationTreeNode) {

    HorizontalPanel linksPanel = new HorizontalPanel();
    Label linksLabel = new Label(Application.getConstants().annotationSuggestedLinks());
    linksLabel.setStyleName("imageAnnotation-form-label");
    linksPanel.add(linksLabel);

    suggestedLinksStack = new VerticalPanel();
    suggestedLinksStack.setStyleName("imageAnnotation-form-links");

    linksPanel.add(suggestedLinksStack);

    return linksPanel;
}

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 a  v a  2  s.  c  om*/
                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  w w.j a v  a2s  .  co  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;
}