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

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

Introduction

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

Prototype

public HTML() 

Source Link

Document

Creates an empty HTML widget.

Usage

From source file:ar.com.kyol.jet.client.JetViewTableHelper.java

License:Open Source License

@SuppressWarnings("rawtypes")
public Wrapper createWrapperWidget(ObjectSetter objSetter, JetColumn jetColumn, int column, int row) {
    if (objSetter != null) {
        objSetter.setReadOnlyCondition(ReadOnlyCondition.ALWAYS);
    }//from w  ww  . j a  v  a2  s  .c  om

    Wrapper wrapper = jetColumn.getWrapper(objSetter);

    if (objSetter == null && wrapper == null) { //for jetColumns trying to show inner attributes from null objects
        return new NullWrapper(true);
    }
    boolean hasClickHandler = false;
    HTML html = new HTML();
    ClickHandler clickHandler = jetColumn.getClickHandler();
    if (jetColumn.getJetClickHandlerGenerator() != null) {
        clickHandler = jetColumn.getJetClickHandlerGenerator().generate();
    }

    if (clickHandler != null) {
        if (clickHandler instanceof JetClickHandler) {
            ((JetClickHandler) clickHandler).setRow(row);
            if (((JetClickHandler) clickHandler).compareTo(objSetter.getValue())) {
                html.addClickHandler(clickHandler);
                hasClickHandler = true;
            }
        } else {
            html.addClickHandler(clickHandler);
            hasClickHandler = true;
        }
    }

    //TODO change everything labelWrapper   wrapper = new LabelWrapper("");
    if (wrapper != null) {
        //continue
    } else if (objSetter.isOfType(Date.class)) {
        wrapper = new HTMLWrapper(objSetter, html);
    } else if (objSetter.isOfType(java.sql.Date.class)) {
        wrapper = new HTMLWrapper(objSetter, html);
    } else if (objSetter.isOfType(Boolean.class)
            || objSetter.isOfType(PrimitiveTypeImpl.BOOLEAN.getQualifiedSourceName())) {
        String value = Jet.constants.n();
        if (objSetter.getValue() == null) {
            value = Jet.constants.nullBoolean();
        } else {
            if ((Boolean) objSetter.getValue()) {
                value = Jet.constants.y();
            }
        }
        objSetter.setValue(value);
        wrapper = new HTMLWrapper(objSetter, html);
    } else if (objSetter.isOfType(String.class)) {
        wrapper = new HTMLWrapper(objSetter, html);
    } else if (objSetter.isOfType(Integer.class)
            || objSetter.isOfType(PrimitiveTypeImpl.INT.getQualifiedSourceName())) {
        wrapper = new HTMLWrapper(objSetter, html);
    } else if (objSetter.isOfType(Float.class)
            || objSetter.isOfType(PrimitiveTypeImpl.FLOAT.getQualifiedSourceName())) {
        wrapper = new HTMLWrapper(objSetter, html);
    } else if (objSetter.getValue() == null) {
        wrapper = new HTMLWrapper(objSetter, html);
    } else
        wrapper = new HTMLWrapper(objSetter, html);

    wrapper.setColumn(new Integer(column));
    wrapper.setRow(new Integer(row));

    wrapper.initWrapper(objSetter);

    if (jetColumn.getContentStyle() != null && !jetColumn.getContentStyle().equals("")) {
        wrapper.addStyleName(jetColumn.getContentStyle());
        if (hasClickHandler) {
            wrapper.addStyleName(jetColumn.getContentStyle() + "-clickHandler");
        }
    }

    if (jetColumn.getColumnWidth() != null) {
        wrapper.setWidth(jetColumn.getColumnWidth());
    }

    return wrapper;
}

From source file:ar.com.kyol.jet.client.wrappers.HTMLWrapper.java

License:Open Source License

/**
 * Instantiates a new hTML wrapper.
 *
 * @param objSetter the obj setter
 */
public HTMLWrapper(ObjectSetter objSetter) {
    this(objSetter, new HTML());
}

From source file:asquare.gwt.tk.client.ui.DropDownPanel.java

License:Apache License

/**
 * Sets the text in the header DIV. Creates the header if necessary. 
 * Removes the header if null;//from w  w  w  .  j  a  v a  2 s  .c  o m
 * 
 * @param text the text to be associated with it, or null to remove the header
 * @param asHTML <code>true</code> to treat the specified text as HTML
 */
public void setHeaderText(String text, boolean asHTML) {
    if (text == null) {
        if (m_header != null) {
            super.remove(m_header);
        }
    } else {
        if (m_header == null) {
            m_header = new HTML();
            m_header.setStyleName("tk-DropDownPanelHeader");
            CWrapper headerWrapper = new CWrapper(m_header, createHeaderControllers());
            insert(headerWrapper, getElement(), 0, true);
        }
        if (asHTML) {
            m_header.setHTML(text);
        } else {
            m_header.setText(text);
        }
    }
}

From source file:au.com.gworks.gwt.petstore.client.WelcomeView.java

License:Apache License

public WelcomeView() {
    container = new VerticalPanel();
    initWidget(container);//from  w  w w.  j  av a  2s  .co  m

    groupBarContainer = new EastWestHorizPanels();
    container.add(groupBarContainer);
    groupBarContainer.setStyleName("ps-ewp-mainGroupSections");

    Label title = new Label("Welcome");
    groupBarContainer.getWest().add(title);
    title.setStyleName("ps-ewp-mainGroupSections-txt");

    welcomeLabel = new Label("gwt-Petstore");
    welcomeLabel.setStyleName("ps-text-large");
    container.add(welcomeLabel);

    authorLabel = new Label("by Ashin Wimalajeewa & Dimax Pradi");
    authorLabel.setStyleName("ps-text-medium");
    container.add(authorLabel);

    descLabel = new HTML();
    container.add(descLabel);

    poweredByLabel = new Label("Powered by");
    poweredByLabel.setStyleName("ps-text-large");
    container.add(poweredByLabel);

    gwtLibs = new HorizontalPanel();
    container.add(gwtLibs);
    Label gems = new Label("javaongems");
    gems.setStyleName("ps-text-large");
    Label gwtSl = new Label("gwt-widgets Server Library");
    gwtSl.setStyleName("ps-text-large");
    gwtLibs.add(gems);
    gwtLibs.add(gwtSl);

    mainLibs = new HorizontalPanel();
    mainLibs.setVisible(false);
    container.add(mainLibs);
    gwtImg = new Image();
    mainLibs.add(gwtImg);
    gwtImg.setUrl("powerByGwt.png");

    springImg = new Image();
    mainLibs.add(springImg);
    springImg.setUrl("poweredBySpring.gif");

    ibatisImg = new Image();
    mainLibs.add(ibatisImg);
    ibatisImg.setUrl("poweredByIBatis.gif");
}

From source file:bingo.client.Bingo.java

License:Open Source License

private void initAdminGrid(final String userId, final BingoGrid bingoGrid, final boolean hasFinished) {
    final Timer timer = new Timer() {
        int totalParticipants = 0;

        @Override/*from   w w w  .j  a  v  a2 s  . c om*/
        public void run() {
            bingoService.getTotalParticipants(userId, new AsyncCallback<Integer>() {
                @Override
                public void onFailure(Throwable caught) {
                }

                @Override
                public void onSuccess(Integer result) {
                    totalParticipants = result.intValue();
                }
            });

            bingoService.getVotes(userId, new AsyncCallback<int[][]>() {
                @Override
                public void onFailure(Throwable caught) {
                    message.setText(caught.getMessage());
                }

                @Override
                public void onSuccess(int[][] result) {
                    if (result == null) {
                        result = new int[BingoGrid.ROW][BingoGrid.COL];
                        for (int i = 0; i < BingoGrid.ROW; i++)
                            for (int j = 0; j < BingoGrid.COL; j++)
                                result[i][j] = 0;
                    }

                    for (int row = 0; row < BingoGrid.ROW; ++row)
                        for (int col = 0; col < BingoGrid.COL; ++col) {
                            bingoGrid.setVoteString(row, col, String.valueOf(result[row][col]),
                                    String.valueOf(totalParticipants));
                        }
                }
            });
        }
    };

    // If the game is not finished, repeat; if so, run once
    if (!hasFinished)
        timer.scheduleRepeating(ADMIN_TIMER);
    else
        timer.run();

    HorizontalPanel panel = new HorizontalPanel();
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    final Button finishButton = new Button();

    // If the game is not finished, allow finishing it; if so, allow download data
    if (!hasFinished)
        finishButton.setText(strings.finishBingo());
    else
        finishButton.setText(strings.download());

    finishButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (!hasFinished)
                bingoService.finishBingo(userId, new AsyncCallback<Void>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        message.setText(caught.getMessage());
                    }

                    @Override
                    public void onSuccess(Void result) {
                        message.setText(strings.finishedBingo());
                        finishButton.setText(strings.download());
                        timer.cancel();
                    }
                });

            bingoService.getVotes(userId, new AsyncCallback<int[][]>() {
                @Override
                public void onFailure(Throwable caught) {
                    message.setText(caught.getMessage());
                }

                @Override
                public void onSuccess(int[][] result) {
                    // Create a popup dialog box
                    final DialogBox box = new DialogBox();
                    box.setText(strings.info());
                    box.setAnimationEnabled(true);

                    final Button boxAcceptButton = new Button(strings.accept());
                    boxAcceptButton.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                            box.hide();
                        }
                    });

                    Label boxLabel = new Label();
                    boxLabel.setText(strings.finishMessage());
                    HTML voteData = new HTML();
                    if (result == null) {
                        result = new int[BingoGrid.ROW][BingoGrid.COL];
                        for (int i = 0; i < BingoGrid.ROW; i++)
                            for (int j = 0; j < BingoGrid.COL; j++)
                                result[i][j] = 0;
                    }

                    String cellKey = "";
                    String cellString = "";
                    String voteDataString = "";
                    for (int row = 0; row < BingoGrid.ROW; ++row)
                        for (int col = 0; col < BingoGrid.COL; ++col) {
                            cellKey = "cell" + row + col;
                            cellString = strings.map().get(cellKey);
                            voteDataString += "&nbsp;&nbsp;&nbsp;" + cellString + " = " + result[row][col]
                                    + "<br>";
                        }
                    voteData.setHTML(voteDataString);
                    voteData.addStyleName("boxData");

                    VerticalPanel boxPanel = new VerticalPanel();
                    boxPanel.addStyleName("boxPanel");
                    boxPanel.add(boxLabel);
                    boxPanel.add(voteData);

                    HorizontalPanel buttonsPanel = new HorizontalPanel();
                    buttonsPanel.add(boxAcceptButton);
                    boxPanel.add(buttonsPanel);
                    boxPanel.setCellHorizontalAlignment(buttonsPanel, HasHorizontalAlignment.ALIGN_CENTER);

                    box.setWidget(boxPanel);
                    box.center();
                }
            });
        }
    });
    panel.add(finishButton);

    final Button terminateButton = new Button(strings.terminateButton());
    terminateButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // Create a popup dialog box
            final DialogBox box = new DialogBox();
            box.setText(strings.warning());
            box.setAnimationEnabled(true);

            final Button boxCancelButton = new Button(strings.cancel());
            boxCancelButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    box.hide();
                }
            });
            final Button boxAcceptButton = new Button(strings.accept());
            boxAcceptButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    bingoService.terminateBingo(userId, new AsyncCallback<Void>() {
                        @Override
                        public void onFailure(Throwable caught) {
                            message.setText(caught.getMessage());
                        }

                        @Override
                        public void onSuccess(Void result) {
                            message.setText(strings.terminatedBingo());
                            timer.cancel();
                        }

                    });
                    box.hide();
                }
            });

            final Label boxLabel = new Label();
            boxLabel.setText(strings.terminateMessage());

            VerticalPanel boxPanel = new VerticalPanel();

            boxPanel.addStyleName("boxPanel");
            boxPanel.add(boxLabel);

            HorizontalPanel buttonsPanel = new HorizontalPanel();
            buttonsPanel.add(boxCancelButton);
            buttonsPanel.add(boxAcceptButton);
            boxPanel.add(buttonsPanel);

            box.setWidget(boxPanel);
            box.center();
        }
    });
    panel.add(terminateButton);

    RootPanel.get("buttons").clear();
    RootPanel.get("buttons").add(panel);
}

From source file:burrito.client.sitelet.SiteletDraggableWidgetCreator.java

License:Apache License

@Override
public Widget createWidget(final SiteletDescription modelObj) {
    SimplePanel wrapper = new SimplePanel();
    wrapper.addStyleName("k5-SiteLetDraggableWidget-Wrapper");

    FlowPanel inner = new FlowPanel();

    String headerText = CrudLabelHelper.getString(modelObj.getEntityName().replace('.', '_'));
    Label header = new Label(headerText);
    header.addStyleName("k5-SiteLetDraggableWidget-Header");
    inner.add(header);//from w w  w .  ja v a  2  s. c  o m

    Label desc = new Label(modelObj.getDescription());
    desc.addStyleName("k5-SiteLetDraggableWidget-Desc");
    inner.add(desc);

    FlowPanel actionsPanel = new FlowPanel();
    actionsPanel.addStyleName("k5-SiteLetDraggableWidget-Actions");

    Hyperlink editAnchor = new Hyperlink(labels.edit(), String.valueOf(modelObj.getEntityId()));
    editAnchor.addStyleName("k5-SiteLetDraggableWidget-EditAnchor");
    editAnchor.addStyleName("k5-SiteLetDraggableWidget-Action");

    final Anchor deleteAnchor = new Anchor(labels.delete());
    final Label progress = new Label(labels.deleting());
    deleteAnchor.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            List<Long> idList = new ArrayList<Long>();
            idList.add(modelObj.getEntityId());
            if (!Window.confirm(labels.confirmDeleteSitelet())) {
                return;
            }
            progress.setVisible(true);
            deleteAnchor.setVisible(false);
            service.deleteSitelets(containerName, idList, new AsyncCallback<Void>() {

                @Override
                public void onSuccess(Void result) {
                    progress.setVisible(false);
                    deleteAnchor.setVisible(true);
                    deleteCallback.onSuccess(modelObj);
                }

                @Override
                public void onFailure(Throwable caught) {
                    progress.setVisible(false);
                    deleteAnchor.setVisible(true);
                    deleteCallback.onFailure(caught);
                    throw new RuntimeException("Failed when trying to delete sitelet with id "
                            + modelObj.getEntityId() + " from container " + containerName, caught);
                }
            });
            event.preventDefault();
        }
    });
    progress.addStyleName("k5-SiteLetDraggableWidget-Action");
    progress.addStyleName("burrito-progress-text");
    deleteAnchor.addStyleName("k5-SiteLetDraggableWidget-DeleteAnchor");
    deleteAnchor.addStyleName("k5-SiteLetDraggableWidget-Action");

    actionsPanel.add(editAnchor);
    actionsPanel.add(deleteAnchor);
    progress.setVisible(false);
    actionsPanel.add(progress);

    inner.add(actionsPanel);
    HTML clearFloats = new HTML();
    clearFloats.addStyleName("burrito-clear-floats");
    inner.add(clearFloats);
    wrapper.setWidget(inner);
    return wrapper;
}

From source file:cc.alcina.framework.gwt.client.ide.widget.ActionProgress.java

License:Apache License

public ActionProgress(final String id, AsyncCallback<JobTracker> completionCallback) {
    this.id = id;
    this.completionCallback = completionCallback;
    this.fp = new FlowPanel();
    fp.setStyleName("alcina-ActionProgress");
    grid = new Grid(4, 2);
    jobName = new InlineLabel();
    FlowPanel jobNCancel = new FlowPanel();
    jobNCancel.add(jobName);/*from  w  w  w .j a va  2 s .co m*/
    jobName.setStyleName("pad-right-5");
    this.cancelLink = new Link("(Cancel)", new ClickHandler() {
        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            cancelJob();
        }
    });
    jobNCancel.add(cancelLink);
    cancellingStatusMessage = new InlineLabel();
    cancellingStatusMessage.setVisible(false);
    jobNCancel.add(cancellingStatusMessage);
    addToGrid("Job", jobNCancel);
    times = new HTML();
    addToGrid("Time", times);
    message = new Label();
    message.setStyleName("message");
    addToGrid("Status", message);
    progress = new FlowPanel();
    progress.setStyleName("progress");
    bar = new FlowPanel();
    bar.setStyleName("bar");
    bar.add(progress);
    addToGrid("Progress", bar);
    grid.setCellSpacing(2);
    fp.add(grid);
    initWidget(fp);
    updateProgress();
    timer = new Timer() {
        boolean checking = false;

        @Override
        public void run() {
            AsyncCallback<JobTracker> callback = new AsyncCallback<JobTracker>() {
                public void onFailure(Throwable caught) {
                    checking = false;
                    if (maxConnectionFailure-- <= 0) {
                        stopTimer();
                        if (ActionProgress.this.completionCallback != null) {
                            ActionProgress.this.completionCallback.onFailure(caught);
                        }
                        throw new WrappedRuntimeException(caught);
                    }
                }

                public void onSuccess(JobTracker info) {
                    checking = false;
                    if (info == null) {
                        info = new JobTrackerImpl();
                        info.setJobName("Unknown job");
                        info.setComplete(true);
                        info.setProgressMessage("---");
                    }
                    if (info.isComplete()) {
                        stopTimer();
                        if (ActionProgress.this.completionCallback != null) {
                            ActionProgress.this.completionCallback.onSuccess(info);
                        }
                    }
                    setJobInfo(info);
                    fireNullPropertyChange("Updated");
                }
            };
            if (!checking) {
                ClientBase.getCommonRemoteServiceAsyncInstance().pollJobStatus(id, false, callback);
                checking = true;
            }
        }
    };
}

From source file:cc.kune.core.client.notify.confirm.UserConfirmPanel.java

License:GNU Affero Public License

/**
 * Instantiates a new user confirm panel.
 * //w  w  w. j ava2 s .c o m
 * @param i18n
 *          the i18n
 */
@Inject
public UserConfirmPanel(final I18nTranslationService i18n) {
    dialog = new BasicTopDialog.Builder(DIALOG_ID, false, true, i18n.getDirection()).autoscroll(false)
            .firstButtonId(OK_ID).sndButtonId(CANCEL_ID).tabIndexStart(1).build();
    askLabel = new HTML();
    askLabel.addStyleName("k-userconfirm-label");
    dialog.getInnerPanel().add(askLabel);
}

From source file:cc.kune.gspace.client.licensewizard.pages.LicenseWizardFirstForm.java

License:GNU Affero Public License

/**
 * Instantiates a new license wizard first form.
 * /*  w ww. j a v  a2 s  .  c o  m*/
 * @param i18n
 *          the i18n
 */
@Inject
public LicenseWizardFirstForm(final I18nTranslationService i18n) {
    super.setFrame(true);
    super.setPadding(10);
    super.setAutoHeight(true);
    // super.setHeight(LicenseWizardView.HEIGHT);

    final Label intro = new Label();
    intro.setText(
            i18n.t("Select the license you prefer using for sharing your group contents with other people:"));
    intro.addStyleName("kune-Margin-10-b");
    final FieldSet fieldSet = new FieldSet();
    // fieldSet.setTitle(i18n.t("license recommended"));
    fieldSet.addStyleName("margin-left: 105px");
    fieldSet.setWidth(250);
    copyleftRadio = DefaultFormUtils.createRadio(fieldSet, i18n.t("Use a copyleft license (recommended)"),
            RADIO_FIELD_NAME, null, RADIO_COPYLEFT_ID);
    anotherLicenseRadio = DefaultFormUtils.createRadio(fieldSet,
            i18n.t("Use another kind of license (advanced)"), RADIO_FIELD_NAME, null, RADIO_ANOTHER_ID);

    final RadioGroup radioGroup = new RadioGroup();
    radioGroup.add(copyleftRadio);
    radioGroup.add(anotherLicenseRadio);
    radioGroup.setOrientation(Orientation.VERTICAL);
    radioGroup.setHideLabel(true);
    radioGroup.addListener(Events.Change, new Listener<BaseEvent>() {
        @Override
        public void handleEvent(final BaseEvent be) {
            onChange.onCallback();
        }
    });

    final FieldSet infoFS = new FieldSet();
    infoFS.setHeadingHtml("Info");
    // infoFS.setFrame(false);
    // infoFS.setIcon("k-info-icon");
    infoFS.setCollapsible(false);
    infoFS.setAutoHeight(true);

    final HTML recommendCopyleft = new HTML();
    final HTML whyALicense = new HTML();
    final HTML youCanChangeTheLicenseLater = new HTML();
    recommendCopyleft.setHTML(POINT + i18n.t("We recommend [%s] licenses, specially for practical works",
            TextUtils.generateHtmlLink("http://en.wikipedia.org/wiki/Copyleft", i18n.t("copyleft"))));
    whyALicense.setHTML(POINT + TextUtils.generateHtmlLink("http://mirrors.creativecommons.org/getcreative/",
            i18n.t("Why do we need a license?")));
    youCanChangeTheLicenseLater.setHTML(POINT + i18n.t("You can change this license later"));

    infoFS.addStyleName("kune-Margin-20-t");
    add(intro);
    add(radioGroup);
    infoFS.add(recommendCopyleft);
    infoFS.add(whyALicense);
    infoFS.add(youCanChangeTheLicenseLater);
    add(infoFS);
}

From source file:ch.amaba.client.ResponseView.java

License:Apache License

@Inject
public ResponseView() {
    closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    textToServerLabel = new Label();
    serverResponseLabel = new HTML();

    // Add the nameField and sendButton to the RootPanel
    // Use RootPanel.get() to get the entire body element
    panel.add(closeButton, "closeButton");
    panel.add(textToServerLabel, "textToServerContainer");
    panel.add(serverResponseLabel, "serverResponseContainer");
}