Example usage for com.google.gwt.user.client.ui HTML getHTML

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

Introduction

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

Prototype

public String getHTML() 

Source Link

Usage

From source file:ch.eaternity.client.Search.java

License:Apache License

/**
 * the displaying functions for recipes//from www  .ja va 2  s  . c o m
 */

public void displayRecipeItem(final Recipe recipe, boolean yours) {
    if (yours) {
        final int row = tableMealsYours.getRowCount();

        Button removeRezeptButton = new Button(" x ");
        removeRezeptButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                final ConfirmDialog dlg = new ConfirmDialog("Hiermit werden Sie das...");
                dlg.statusLabel.setText("Rezept lschen.");

                //  recheck user if he really want to do this...
                dlg.yesButton.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        presenter.removeRecipe(recipe);
                        tableMealsYours.removeCells(row, 0, tableMealsYours.getCellCount(row));
                        dlg.hide();
                        dlg.clear();
                    }
                });
                dlg.show();
                dlg.center();

            }
        });
        // remove button is 1
        tableMealsYours.setWidget(row, 1, removeRezeptButton);

        HTML item = new HTML();

        if (recipe.eaternitySelected != null && recipe.eaternitySelected) {
            item.setHTML(item.getHTML() + "<img src='pixel.png' height=1 width=20 />");
            item.setStyleName("base-icons carrot");
        }
        if (recipe.regsas != null && recipe.regsas) {
            item.setHTML(item.getHTML()
                    + "<div class='extra-icon regloc'><img src='pixel.png' height=1 width=20 /></div>");
        }
        if (recipe.bio != null && recipe.bio) {
            item.setHTML(item.getHTML()
                    + "<div class='extra-icon bio'><img src='pixel.png' height=1 width=20 /></div>");
        }

        item.setHTML(item.getHTML() + "<div class='ingText'>" + recipe.getSymbol() + "</div>");
        // Text and CO2 is 0
        tableMealsYours.setWidget(row, 0, item);

        recipe.setCO2Value();
        String formatted = NumberFormat.getFormat("##").format(recipe.getCO2Value());
        item.setHTML(item.getHTML() + "<div class='putRight2'>ca " + formatted + " g*</div>");

        if (presenter.getLoginInfo().isAdmin()) {
            // This is ugly, but that's the way it is...
            if (!recipe.isOpen()) {
                //               if(recipe.openRequested){
                // this should be a link to make it open
                Anchor openThis = new Anchor("o");
                openThis.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        presenter.recipeApproval(recipe, true);
                    }
                });
                tableMealsYours.setWidget(row, 2, openThis);
                //               item.setHTML(openThis+" "+item.getHTML());
                //               }
            } else {
                // this should be a link to make it close
                Anchor closeThis = new Anchor("c");
                closeThis.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        presenter.recipeApproval(recipe, false);
                    }
                });
                tableMealsYours.setWidget(row, 2, closeThis);
                //               item.setHTML(closeThis+" "+item.getHTML());
            }
        } else {

            //             how to show, that this recipe is public??

            //            if(recipe.isOpen()){
            //               tableMealsYours.setText(row, 2,"o");
            //            } else if(recipe.openRequested){
            //               tableMealsYours.setText(row, 2,"c");
            //            }

            //TODO better show in the menu itself

        }

        //TODO should this not be called after the sort?
        if ((row % 2) == 1) {
            String style = evenStyleRow.evenRow();
            tableMealsYours.getRowFormatter().addStyleName(row, style);
        }

    } else {
        final int row = tableMeals.getRowCount();
        HTML item = new HTML();

        if (recipe.eaternitySelected != null && recipe.eaternitySelected) {
            item.setHTML(item.getHTML() + "<img src='pixel.png' height=1 width=20 />");
            item.setStyleName("base-icons carrot");
        }
        if (recipe.regsas != null && recipe.regsas) {
            item.setHTML(item.getHTML()
                    + "<div class='extra-icon regloc'><img src='pixel.png' height=1 width=20 /></div>");
        }
        if (recipe.bio != null && recipe.bio) {
            item.setHTML(item.getHTML()
                    + "<div class='extra-icon bio'><img src='pixel.png' height=1 width=20 /></div>");
        }

        item.setHTML(item.getHTML() + "<div class='ingText'>" + recipe.getSymbol() + "</div>");

        // Text and CO2 is 0
        tableMeals.setWidget(row, 0, item);

        recipe.setCO2Value();
        String formatted = NumberFormat.getFormat("##").format(recipe.getCO2Value());
        item.setHTML(item.getHTML() + "<div class='putRight'>ca " + formatted + " g*</div>");

        if (presenter.getLoginInfo() != null && presenter.getLoginInfo().isAdmin()) {

            Anchor removeRezeptButton = new Anchor(" x ");
            removeRezeptButton.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    final ConfirmDialog dlg = new ConfirmDialog("Sie wollen dieses...");
                    dlg.statusLabel.setText("Rezept lschen?");
                    // TODO recheck user if he really want to do this...
                    dlg.yesButton.addClickHandler(new ClickHandler() {
                        public void onClick(ClickEvent event) {
                            presenter.removeRecipe(recipe);
                            tableMeals.removeCells(row, 0, tableMealsYours.getCellCount(row));
                            dlg.hide();
                            dlg.clear();
                        }
                    });
                    dlg.show();
                    dlg.center();
                }
            });

            // remove button is 1
            tableMeals.setWidget(row, 1, removeRezeptButton);
            //            item.setHTML(item.getHTML()+"<div class='putRight2'>ca "+formatted+ " g* ("+removeRezeptButton+")</div>");

            if (!recipe.isOpen()) {
                if (recipe.openRequested) {
                    // TODO this should be a link to make it open
                    Anchor openThis = new Anchor("o");
                    openThis.addClickHandler(new ClickHandler() {
                        public void onClick(ClickEvent event) {
                            presenter.recipeApproval(recipe, true);
                            //                         initTable();
                            // why does the layout suck after this button press?????
                        }
                    });
                    tableMeals.setWidget(row, 2, openThis);
                    //                  item.setHTML(openThis+" "+item.getHTML());
                }
            } else {
                // TODO this should be a link to make it close
                Anchor closeThis = new Anchor("c");
                closeThis.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        presenter.recipeApproval(recipe, false);
                        //                      initTable();
                    }
                });
                tableMeals.setWidget(row, 2, closeThis);
                //               item.setHTML(closeThis+" "+item.getHTML());
            }
        }

        //TODO should this not be called after the sort?
        if ((row % 2) == 1) {
            String style = evenStyleRow.evenRow();
            tableMeals.getRowFormatter().addStyleName(row, style);
        }
    }

}

From source file:ch.eaternity.client.Search.java

License:Apache License

/**
 * the displaying functions for ingredients
 *//*  ww w . ja v  a2  s  . c  o  m*/
public void displayIngredient(final Ingredient ingredient) {
    int row = table.getRowCount();

    /*if ((row % 2) == 1) {
       String style = evenStyleRow.evenRow();
       table.getRowFormatter().addStyleName(row, style);
    }*/

    HTML icon = new HTML();

    //      icon.addMouseListener(
    //             new TooltipListener(
    //               "add", 15000 /* timeout in milliseconds*/,"bla",400,10));

    // these value (400,1200) are based on the 0.2 and 0.5 quantile of all ingredients
    if (ingredient.getCo2eValue() < 400) {
        //         icon.setHTML(icon.getHTML()+"<img src='pixel.png' height=1 width=20 />");
        icon.setStyleName("base-icons");
        icon.setHTML(icon.getHTML()
                + "<div class='extra-icon smiley2'><img src='pixel.png' height=1 width=20 /></div>");
        icon.setHTML(icon.getHTML()
                + "<div class='extra-icon smiley1'><img src='pixel.png' height=1 width=20 /></div>");
    } else if (ingredient.getCo2eValue() < 1200) {
        //         icon.setHTML(icon.getHTML()+"<img src='pixel.png' height=1 width=20 />");
        icon.setStyleName("base-icons");
        icon.setHTML(icon.getHTML()
                + "<div class='extra-icon smiley2'><img src='pixel.png' height=1 width=20 /></div>");

    }

    if (ingredient.hasSeason != null && ingredient.hasSeason) {
        //         Date date = DateTimeFormat.getFormat("MM").parse(Integer.toString(TopPanel.Monate.getSelectedIndex()+1));
        //         presenter
        Date date = null;
        if (presenter != null) {
            date = DateTimeFormat.getFormat("MM").parse(Integer.toString(presenter.getSelectedMonth()));
        }

        // In Tagen
        //      String test = InfoZutat.zutat.getStartSeason();
        Date dateStart = DateTimeFormat.getFormat("dd.MM").parse(ingredient.stdExtraction.startSeason);
        Date dateStop = DateTimeFormat.getFormat("dd.MM").parse(ingredient.stdExtraction.stopSeason);

        if (dateStart.before(dateStop) && date.after(dateStart) && date.before(dateStop)
                || dateStart.after(dateStop) && !(date.before(dateStart) && date.after(dateStop))) {
            icon.setHTML(icon.getHTML()
                    + "<div class='extra-icon regloc'><img src='pixel.png' height=1 width=20 /></div>");
        }
    }

    if (ingredient.noAlternative) {
        icon.setHTML(icon.getHTML() + "<div class='ingText'>" + ingredient.getSymbol() + "</div>");

    } else {
        icon.setHTML(icon.getHTML() + "(alt): " + ingredient.getSymbol());
    }

    icon.setHTML(icon.getHTML() + "<div class='putRight'>ca "
            + Integer.toString((int) ingredient.getCo2eValue() / 10).concat(" g*") + "</div>");

    table.setWidget(row, 0, icon);

}

From source file:ch.unifr.pai.twice.comm.serverPush.standalone.client.ServerPushStandalone.java

License:Apache License

/**
 * This is the entry point method.//from  w  w w  . j a  va 2  s .  com
 */
/*
 * (non-Javadoc)
 * @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
 */
@Override
public void onModuleLoad() {

    //
    //
    //
    //
    FlexTable table = new FlexTable();
    final TextBox message = new TextBox();
    table.setWidget(0, 0, new Label("Message"));
    table.setWidget(0, 1, message);
    table.setWidget(1, 0, new Label("Event date"));
    final DatePicker datePicker = new DatePicker();
    table.setWidget(1, 1, datePicker);

    Button undoable = new Button("Send as undoable event", new ClickHandler() {

        /**
         * Creates an {@link UndoableTestEvent} and fires it on the event bus.
         * 
         * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
         */
        @Override
        public void onClick(ClickEvent event) {
            UndoableTestEvent e = GWT.create(UndoableTestEvent.class);
            e.setFoo(message.getText());
            if (datePicker.getValue() != null)
                e.setTimestamp(datePicker.getValue().getTime());
            eventBus.fireEvent(e);
        }
    });

    Button blocking = new Button("Send as blocking event", new ClickHandler() {

        /**
         * Creates an {@link BlockingTestEvent} and fires it on the event bus.
         * 
         * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
         */
        @Override
        public void onClick(ClickEvent event) {
            BlockingTestEvent e = GWT.create(BlockingTestEvent.class);
            e.foo = message.getText();
            if (datePicker.getValue() != null)
                e.setTimestamp(datePicker.getValue().getTime());
            eventBus.fireEvent(e);
        }
    });

    Button discarding = new Button("Send as discarding event", new ClickHandler() {

        /**
         * Creates an {@link DiscardingTestEvent} and fires it on the event bus.
         * 
         * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
         */
        @Override
        public void onClick(ClickEvent event) {
            DiscardingTestEvent e = GWT.create(DiscardingTestEvent.class);
            e.setInstanceId("eventTests");
            e.setFoo(message.getText());
            if (datePicker.getValue() != null)
                e.setTimestamp(datePicker.getValue().getTime());
            eventBus.fireEvent(e);
        }
    });

    final HTML html = new HTML("");
    final HTML value = new HTML("");
    eventBus.addHandler(BlockingTestEvent.TYPE, new BlockingTestHandler() {

        /**
         * listens for blocking test events and adds their message to the display
         * 
         * @param event
         */
        @Override
        public void onEvent(BlockingTestEvent event) {
            html.setHTML(html.getHTML() + " [BLOCKING " + event.getTimestamp() + "] " + event.foo);
            value.setHTML(event.foo);
        }
    });
    eventBus.addHandler(UndoableTestEvent.TYPE, new UndoableTestHandler() {

        /**
         * undo the event in case of a conflict by resetting the display to the values valid before the event has been applied
         * 
         * @param event
         */
        @Override
        public void undo(UndoableTestEvent event) {
            html.setHTML(event.getOldHistory());
            value.setHTML(event.getOldValue());
        }

        /**
         * listens for undoable events and adds their message to the display
         * 
         * @param event
         */
        @Override
        public void onEvent(UndoableTestEvent event) {
            html.setHTML(html.getHTML() + " [UNDOABLE " + event.getTimestamp() + "] " + event.getFoo());
            value.setHTML(event.getFoo());
        }

        /**
         * stores the state of the display before the newly arrived event has arrived
         * 
         * @param event
         */
        @Override
        public void saveState(UndoableTestEvent event) {
            event.setOldHistory(html.getHTML());
            event.setOldValue(value.getHTML());
        }
    });

    eventBus.addHandler(DiscardingTestEvent.TYPE, new DiscardingTestHandler() {

        /**
         * listens for discarding test events and adds their message to the display
         * 
         * @param event
         */
        @Override
        public void onEvent(DiscardingTestEvent event) {
            html.setHTML(html.getHTML() + " [DISCARDING " + event.getTimestamp() + "] " + event.getFoo());
            value.setHTML(event.getFoo());
        }
    });

    table.setWidget(2, 0, undoable);
    table.setWidget(2, 1, blocking);
    table.setWidget(2, 2, discarding);
    table.setWidget(3, 0, new Label("Current value: "));
    table.setWidget(3, 1, value);
    table.setWidget(4, 0, new Label("Event history: "));
    table.setWidget(4, 1, html);

    Button ping = new Button("Send ping", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            PingEvent e = GWT.create(PingEvent.class);
            e.setInstanceId("eventTests");
            if (datePicker.getValue() != null)
                e.setTimestamp(datePicker.getValue().getTime());
            eventBus.fireEvent(e);
        }
    });

    RootPanel.get().add(table);
    RootPanel.get().add(ping);

    RootPanel.get().add(new Label("GWTEvent wrapper"));
    FlexTable table2 = new FlexTable();

    final TextBox box = new TextBox();
    table2.setWidget(0, 0, new Label("Textbox"));
    table2.setWidget(0, 1, box);

    eventBus.addHandlerToSource(RemoteKeyPressEvent.TYPE, "test",
            new RemoteKeyPressEvent.RemoteKeyPressHandler() {

                @Override
                public void onEvent(RemoteKeyPressEvent event) {
                    box.setValue(box.getValue() + event.getCharCode());
                }
            });
    box.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            RemoteKeyPressEvent e = GWT.create(RemoteKeyPressEvent.class);
            e.wrap(event);
            eventBus.fireEventFromSource(e, "test");
            event.preventDefault();
        }
    });

    final MyNewTextBox box4 = new MyNewTextBox(eventBus, "myNewTextBox");
    table2.setWidget(1, 0, new Label("My new textbox"));
    table2.setWidget(1, 1, box4);

    final RemoteKeyRecorder recorder = new RemoteKeyRecorder("multiFocus", eventBus);
    RootPanel.get().add(recorder);

    // final RemoteTextBox box3 = new RemoteTextBox("multiFocus", eventBus);
    // box3.setValue("");
    // RootPanel.get().add(box3);
    // table2.setWidget(2, 0, new Label("Textbox (undoable - other resource)"));
    // table2.setWidget(2,1,box3);
    // RootPanel.get().add(table2);
    //
    MultiFocusTextBox multiFocus = new RemoteMultiFocusTextBox("multiFocus", eventBus);
    RootPanel.get().add(multiFocus);

}

From source file:com.gwtmobile.ui.client.widgets.HeaderPanel.java

License:Apache License

public String getCaption() {
    FlowPanel contents = (FlowPanel) getWidget(1);
    if (contents.getWidgetCount() > 0) {
        HTML w = (HTML) contents.getWidget(0);
        return w.getHTML();
    }/*from   w  w w  .j  a  v  a  2 s  . com*/
    return "";
}

From source file:com.ikon.frontend.client.widget.form.FormManager.java

License:Open Source License

/**
 * updateFormElementsWithNewer//w  ww . j av  a2s. c  o  m
 */
public List<GWTFormElement> updateFormElementsValuesWithNewer() {
    for (GWTFormElement formElement : formElementList) {
        if (formElement instanceof GWTTextArea) {
            HorizontalPanel hPanel = (HorizontalPanel) hWidgetProperties.get(formElement.getName());
            TextArea textArea = (TextArea) hPanel.getWidget(0);
            ((GWTTextArea) formElement).setValue(textArea.getText());
        } else if (formElement instanceof GWTInput) {
            HorizontalPanel hPanel = (HorizontalPanel) hWidgetProperties.get(formElement.getName());
            TextBox textBox = (TextBox) hPanel.getWidget(0);
            ((GWTInput) formElement).setValue(textBox.getText());

            // note that date is added by click handler in drawform method
            if (((GWTInput) formElement).getType().equals(GWTInput.TYPE_FOLDER)) {
                // Must be updated folder in GWTInput because must be drawn
                GWTFolder folder = new GWTFolder();
                folder.setPath(textBox.getText());
                ((GWTInput) formElement).setFolder(folder);
            }
        } else if (formElement instanceof GWTSuggestBox) {
            HorizontalPanel hPanel = (HorizontalPanel) hWidgetProperties.get(formElement.getName());
            HTML hiddenKey = (HTML) hPanel.getWidget(1);
            GWTSuggestBox suggestBox = (GWTSuggestBox) formElement;
            suggestBox.setValue(hiddenKey.getHTML());
            updateSuggestBoxTextValue(suggestBox);
        } else if (formElement instanceof GWTCheckBox) {
            CheckBox checkbox = (CheckBox) hWidgetProperties.get(formElement.getName());
            ((GWTCheckBox) formElement).setValue(checkbox.getValue());
        } else if (formElement instanceof GWTSelect) {
            GWTSelect gwtSelect = (GWTSelect) formElement;

            if (gwtSelect.getType().equals(GWTSelect.TYPE_SIMPLE)) {
                HorizontalPanel hPanel = (HorizontalPanel) hWidgetProperties.get(formElement.getName());
                ListBox listBox = (ListBox) hPanel.getWidget(0);
                String selectedValue = "";

                if (listBox.getSelectedIndex() > 0) {
                    selectedValue = listBox.getValue(listBox.getSelectedIndex());
                }

                for (Iterator<GWTOption> itOptions = gwtSelect.getOptions().iterator(); itOptions.hasNext();) {
                    GWTOption option = itOptions.next();
                    if (option.getValue().equals(selectedValue)) {
                        option.setSelected(true);
                    } else {
                        option.setSelected(false);
                    }
                }
            } else if (gwtSelect.getType().equals(GWTSelect.TYPE_MULTIPLE)) {
                HorizontalPanel hPanel = (HorizontalPanel) hWidgetProperties.get(formElement.getName());
                FlexTable tableMulti = (FlexTable) hPanel.getWidget(0);

                // Disables all options
                for (Iterator<GWTOption> itOptions = gwtSelect.getOptions().iterator(); itOptions.hasNext();) {
                    itOptions.next().setSelected(false);
                }

                // Enables options
                if (tableMulti.getRowCount() > 0) {
                    for (int i = 0; i < tableMulti.getRowCount(); i++) {
                        String selectedValue = tableMulti.getText(i, 0);
                        for (Iterator<GWTOption> itOptions = gwtSelect.getOptions().iterator(); itOptions
                                .hasNext();) {
                            GWTOption option = itOptions.next();
                            if (option.getValue().equals(selectedValue)) {
                                option.setSelected(true);
                            }
                        }
                    }
                }
            }
        } else if (formElement instanceof GWTUpload) {
            // Nothing to be done here, upload files are updated in file upload widget
        } else if (formElement instanceof GWTText) {
            // Nothing to be done here
        } else if (formElement instanceof GWTSeparator) {
            // Nothing to be done here
        } else if (formElement instanceof GWTDownload) {
            // Nothing to be done here
        } else if (formElement instanceof GWTPrint) {
            // Nothing to be done here
        }
    }

    return formElementList;
}

From source file:com.sciencegadgets.client.algebra.transformations.specification.NumberQuiz.java

License:Open Source License

public NumberQuiz(String question, final BigDecimal totalValue) {

    HTML questionDisplay = new HTML(question + " = ");
    questionDisplay.addStyleName(CSS.LAYOUT_ROW + " " + CSS.DOUBLE_FONT_SIZE);
    add(questionDisplay);/*w ww .j a  v  a 2s . co  m*/

    display.addStyleName(CSS.LAYOUT_ROW + " " + CSS.DOUBLE_FONT_SIZE);
    display.setWidth("3em");

    add(display);
    add(keyPad);

    final HTML incorrectResponse = new HTML("<b>Incorrect</b>");

    addOkHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            try {
                BigDecimal inputValue = new BigDecimal(display.getText());

                // acceptable error
                BigDecimal error;
                if (totalValue.compareTo(new BigDecimal(0)) == same) {
                    error = totalValue.subtract(inputValue).abs();
                } else {
                    error = inputValue.divide(totalValue, MathContext.DECIMAL32).subtract(new BigDecimal("1"))
                            .abs();
                }

                if (error.compareTo(ACCEPTABLE_ERROR) == lessThan) {
                    // correct
                    disappear();
                    onCorrect();
                } else {
                    // incorrect
                    incorrectResponse.setHTML(incorrectResponse.getHTML() + "<br/>" + inputValue);
                    add(incorrectResponse);
                    keyPad.displaySelect();
                    onIncorrect();
                }
            } catch (NumberFormatException e) {
                if ("".equals(display.getText())) {
                    disappear();
                } else {
                    incorrectResponse.setHTML(incorrectResponse.getHTML() + "<br/>Not a number");
                    add(incorrectResponse);
                    keyPad.displaySelect();
                }
            }
        }
    });
}

From source file:com.sensia.tools.client.swetools.editors.sensorml.panels.widgets.swe.position.AbstractSWESensorPositionByWidget.java

License:Open Source License

/**
 * Builds the coordinates panel.//from w ww .  j  a  va2  s  .c o  m
 *
 * @param widget the widget
 * @param locationHtmlLabel the location html label
 * @return the panel
 */
protected Panel buildCoordinatesPanel(ISensorWidget widget, HTML locationHtmlLabel) {
    //build inner content
    List<ISensorWidget> coordinates = findWidgets(widget, "coordinate", TAG_DEF.SWE, TAG_TYPE.ELEMENT);

    Panel vInnerPanel = new VerticalPanel();
    for (ISensorWidget coordinate : coordinates) {
        String value = coordinate.getValue("value", true);
        locationHtmlLabel.setHTML(locationHtmlLabel.getHTML() + SensorConstants.HTML_SPACE
                + SensorConstants.HTML_SPACE + value + SensorConstants.HTML_SPACE);
        vInnerPanel.add(coordinate.getPanel());
    }

    //add styles
    vInnerPanel.addStyleName("swe-dataRecord-vertical-panel");

    //add to result panel
    return vInnerPanel;
}

From source file:com.sensia.tools.client.swetools.editors.sensorml.panels.widgets.swe.SWESensorAllowedValuesWidget.java

License:Open Source License

@Override
protected void addSensorWidget(ISensorWidget widget) {
    if (widget.getName().equals("value") && widget.getType() == TAG_TYPE.ELEMENT) {
        //if a single value is found
        String value = widget.getElements().get(0).getName();
        if (valuesPanel == null) {
            valuesPanel = new HorizontalPanel();
            values = new HTML(value);
            values.addStyleName("constraint-values");
            valuesPanel.add(values);/*from  ww  w  . j  a  v  a2 s.  c o  m*/
            innerContainer.add(valuesPanel);
        } else {
            values.setHTML(values.getHTML() + " / " + value);
        }

    } else if (widget.getName().equals("interval") && widget.getType() == TAG_TYPE.ELEMENT) {
        //if an interval of values is found
        String interval = widget.getElements().get(0).getName();
        String[] spaceSplit = interval.split(" ");
        if (intervalPanel == null) {
            intervalPanel = new HorizontalPanel();
            innerContainer.add(intervalPanel);
        }
        HTML values = new HTML(spaceSplit[0] + ";" + spaceSplit[1]);
        values.addStyleName("constraint-values");
        intervalPanel.add(values);
    }
}

From source file:com.sun.labs.aura.music.wsitm.client.ui.Popup.java

License:Open Source License

private static HTML formatStack(Throwable t) {
    String s = t.toString() + "<br />" + WebLib.traceToString(t);
    s.replaceAll("\n", "<br />");

    if (t.getCause() != null) {
        HTML cause = formatStack(t.getCause());
        s += "<br />---- Caused by ----<br />" + cause.getHTML();
    }/*from   www.  j  av  a  2 s. co m*/

    return new HTML(s);
}

From source file:custgwttbl.client.CustGwtItem.java

License:Apache License

/**
 * Gets the content of the item For image it is image Url
 * //from w w  w  .j a va2  s  .  co m
 * @return item content
 */
public String getText() {

    String returnText = "";
    if (this.getSpecifier() == CustGwtItem.EDITABLE) {
        TextBox tBox = (TextBox) vPanel.getWidget(0);
        returnText = tBox.getText();
    } else if (this.getSpecifier() == CustGwtItem.NON_EDITABLE) {
        Label label = (Label) vPanel.getWidget(0);
        returnText = label.getText();
    } else if (this.getSpecifier() == CustGwtItem.NON_EDITABLE_HTML) {
        HTML htmlWid = (HTML) vPanel.getWidget(0);
        returnText = htmlWid.getHTML();
    } else if (this.getSpecifier() == CustGwtItem.IMAGE) {
        if (image != null) {
            returnText = CustGwtUtil.stringNoNull(image.getUrl());
        }
    }
    return returnText;
}