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

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

Introduction

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

Prototype

protected Label(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:at.ait.dme.yuma.client.image.shape.ShapeControlPanel.java

License:EUPL

public ShapeControlPanel(AbsolutePanel shapeParentPanel, ShapePanel shapePanel, Shape shape) {

    this.shapeParentPanel = shapeParentPanel;
    this.shapePanel = shapePanel;
    this.shape = shape;

    createShapeRadioButtons();//from   w ww . jav a2s .com
    createStrokeWidthRadioButtons();
    createColorPicker();

    contentPanel.add(contentTable);
    contentPanel.add(colorPicker);
    // w/o this workaround IE crashes when applying an alpha filter
    contentPanel.add(new Label(" "));
    this.add(contentPanel);

    this.setStyleName("imageFragment-controlpanel");
}

From source file:at.ait.dme.yuma.client.image.shape.ShapeControlPanel.java

License:EUPL

/**
 * creates the radio buttons to choose the shape
 */// w  w w  . j  a  va2 s. co m
private void createShapeRadioButtons() {
    Label shapeLabel = new Label(shapeConstants.shape());
    shapeLabel.setStyleName("imageFragment-controlpanel-label");

    RadioButton rectangle = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.rectangle());
    rectangle.setStyleName("imageFragment-controlpanel-radio-button");
    rectangle.setValue(shape instanceof Rectangle);
    rectangle.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape = new Rectangle(shape);
            redrawShape();
        }
    });

    RadioButton ellipse = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.ellipse());
    ellipse.setStyleName("imageFragment-controlpanel-radio-button");
    ellipse.setValue(shape instanceof Ellipse);
    ellipse.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape = new Ellipse(shape);
            redrawShape();
        }
    });

    RadioButton cross = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.cross());
    cross.setStyleName("imageFragment-controlpanel-radio-button");
    cross.setValue(shape instanceof Cross);
    cross.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape = new Cross(shape);
            redrawShape();
        }
    });

    RadioButton polygon = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.polygon());
    polygon.setStyleName("imageFragment-controlpanel-radio-button");
    polygon.setValue(shape instanceof Polygon);
    polygon.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape = new Polygon(shape);
            redrawShape();
            shapePanel.startDrawPolygon((Polygon) shape);

        }
    });

    RadioButton freehand = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.freehand());
    freehand.setStyleName("imageFragment-controlpanel-radio-button");
    freehand.setValue(shape instanceof Polyline);
    freehand.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape = new Polyline(shape);
            redrawShape();
            shapePanel.startDrawPolyline((Polyline) shape);
        }
    });

    contentTable.setWidget(0, 0, shapeLabel);
    contentTable.setWidget(0, 1, rectangle);
    contentTable.setWidget(0, 2, ellipse);
    contentTable.setWidget(0, 3, cross);
    contentTable.setWidget(0, 4, polygon);
    contentTable.setWidget(0, 5, freehand);
}

From source file:at.ait.dme.yuma.client.image.shape.ShapeControlPanel.java

License:EUPL

/**
 * creates the color picker to change the shape's color
 *///from   w w  w  .j  a  v  a2  s  .c  o  m
private void createColorPicker() {
    Label colorLabel = new Label(shapeConstants.color());
    colorLabel.setStyleName("imageFragment-controlpanel-label");

    colorPicker = new ColorPicker();
    try {
        colorPicker.setRGB(shape.getColor().getR(), shape.getColor().getG(), shape.getColor().getB());
    } catch (Exception e) {
    }
    colorPicker.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            shape.setColor(new Color(colorPicker.getHexColor()));
            redrawShape();
            DOM.setStyleAttribute(colorPreview.getElement(), "backgroundColor",
                    "#" + colorPicker.getHexColor());
        }
    });

    colorPreview.setStyleName("imageFragment-controlpanel-color-preview");
    DOM.setStyleAttribute(colorPreview.getElement(), "backgroundColor", "#" + colorPicker.getHexColor());

    colorPreview.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (contentPanel.remove(colorPicker) == false)
                contentPanel.add(colorPicker);
        }
    });

    contentTable.setWidget(2, 0, colorLabel);
    contentTable.setWidget(2, 1, colorPreview);
}

From source file:at.ait.dme.yuma.client.image.shape.ShapeControlPanel.java

License:EUPL

/**
 * creates radio buttons to change the stroke width of the shape
 *//* w  w  w  .j  a  v a2s.c  o m*/
private void createStrokeWidthRadioButtons() {
    Label strokeLabel = new Label(shapeConstants.strokeWidth());
    strokeLabel.setStyleName("imageFragment-controlpanel-label");

    RadioButton thin = new RadioButton(STROKEWIDTH_RADIO_GROUP_NAME, shapeConstants.thin());
    thin.setStyleName("imageFragment-controlpanel-radio-button");
    thin.setValue(shape.getStrokeWidth() == 1);
    thin.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape.setStrokeWidth(1);
            redrawShape();
        }
    });

    RadioButton medium = new RadioButton(STROKEWIDTH_RADIO_GROUP_NAME, shapeConstants.medium());
    medium.setStyleName("imageFragment-controlpanel-radio-button");
    medium.setValue(shape.getStrokeWidth() == 2);
    medium.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape.setStrokeWidth(2);
            redrawShape();
        }
    });

    RadioButton thick = new RadioButton(STROKEWIDTH_RADIO_GROUP_NAME, shapeConstants.thick());
    thick.setStyleName("imageFragment-controlpanel-radio-button");
    thick.setValue(shape.getStrokeWidth() == 3);
    thick.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape.setStrokeWidth(3);
            redrawShape();
        }
    });

    contentTable.setWidget(1, 0, strokeLabel);
    contentTable.setWidget(1, 1, thin);
    contentTable.setWidget(1, 2, medium);
    contentTable.setWidget(1, 3, thick);
}

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);//  www  .  j  av  a  2 s. 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.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  w  w w . ja  v  a  2s  . c o 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.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 ww.ja  v a 2 s  . c  o  m*/
        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.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();//w w  w  .  ja  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 w w  w.j  av a 2s.  com
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 w w w.ja va2 s.c  o m
}