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

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

Introduction

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

Prototype

public void setText(String text) 

Source Link

Document

Sets the label's content to the given text.

Usage

From source file:org.primaresearch.web.gwt.client.ui.page.tool.DeleteContentObjectTool.java

License:Apache License

private static void showConfiramtionDialog(Panel parent, UIObject showRelativeTo, final PageLayoutC layout,
        final ContentObjectC object, final PageSyncManager syncManager,
        final SelectionManager selectionManager) {
    final DialogBox confirmationDialog = new DialogBox();

    final VerticalPanel vertPanel = new VerticalPanel();
    confirmationDialog.add(vertPanel);//from   w  w w  .j  a  v a  2 s  . co m

    Label confirmLabel = new Label();
    vertPanel.add(confirmLabel);

    final HorizontalPanel horPanel = new HorizontalPanel();
    horPanel.setWidth("100%");
    horPanel.setSpacing(5);
    horPanel.setHorizontalAlignment(HorizontalAlignmentConstant.endOf(Direction.LTR));
    vertPanel.add(horPanel);

    Button buttonCancel = new Button("Cancel");
    horPanel.add(buttonCancel);
    buttonCancel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            confirmationDialog.hide();
        }
    });

    Button buttonDelete = new Button("Delete");
    horPanel.add(buttonDelete);
    buttonDelete.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            syncManager.deleteContentObject(object);
            layout.remove(object);
            selectionManager.clearSelection();
            confirmationDialog.hide();
        }
    });

    String text = "Delete selected ";
    if (object.getType() instanceof RegionType)
        text += "region";
    else if (LowLevelTextType.TextLine.equals(object.getType()))
        text += "text line";
    else if (LowLevelTextType.Word.equals(object.getType()))
        text += "word";
    else if (LowLevelTextType.Glyph.equals(object.getType()))
        text += "glyph";
    text += "?";
    confirmLabel.setText(text);

    parent.add(confirmationDialog);
    if (showRelativeTo != null)
        confirmationDialog.showRelativeTo(showRelativeTo);
    else
        confirmationDialog.show();

}

From source file:org.qualipso.factory.ui.service.oslc.client.view.CreateOSLCCheckerView.java

License:Open Source License

public void showErrorPopupPanel(String message) {
    PopupPanel errorPopup = new PopupPanel();
    errorPopup.setAnimationEnabled(true);
    errorPopup.setGlassEnabled(true);/*  w  ww.  j ava2 s .c o m*/
    errorPopup.setTitle("An error occured");
    Label label = new Label();
    label.setText(message);
    errorPopup.setWidget(label);
    errorPopup.show();
}

From source file:org.rhq.coregui.client.bundle.deploy.DeployStep.java

License:Open Source License

public Canvas getCanvas() {
    if (canvas == null) {
        canvas = new EnhancedVLayout();
        canvas.setWidth100();/*from www .  j a  v a2 s  . c om*/
        canvas.setHeight100();
        canvas.setAlign(Alignment.CENTER);

        final Img deployingImage = new Img(ImageManager.getLoadingIcon());
        deployingImage.setLayoutAlign(Alignment.CENTER);
        deployingImage.setWidth(50);
        deployingImage.setHeight(15);

        final Label deployingMessage = new Label(MSG.view_bundle_deployWizard_deploying());
        deployingMessage.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

        canvas.addMember(deployingImage);
        canvas.addMember(deployingMessage);

        bundleServer.createBundleDeployment(wizard.getBundleVersion().getId(), wizard.getDestination().getId(),
                wizard.getNewDeploymentDescription(), wizard.getNewDeploymentConfig(), false, -1, false, //
                new AsyncCallback<BundleDeployment>() {
                    public void onSuccess(BundleDeployment result) {
                        deployingImage.setSrc(ImageManager.getStatusComplete());
                        deployingMessage.setText(MSG.view_bundle_deployWizard_deploymentCreated());
                        CoreGUI.getMessageCenter()
                                .notify(new Message(
                                        MSG.view_bundle_deployWizard_deploymentCreatedDetail_concise(
                                                result.getName()),
                                        MSG.view_bundle_deployWizard_deploymentCreatedDetail(result.getName(),
                                                result.getDescription()),
                                        Severity.Info));
                        wizard.setNewDeployment(result);

                        bundleServer.scheduleBundleDeployment(wizard.getNewDeployment().getId(),
                                wizard.isCleanDeployment(), //
                                new AsyncCallback<BundleDeployment>() {
                                    public void onSuccess(BundleDeployment result) {
                                        deployingImage.setSrc(ImageManager.getStatusComplete());
                                        deployingMessage
                                                .setText(MSG.view_bundle_deployWizard_deploymentScheduled());
                                        CoreGUI.getMessageCenter().notify(new Message(MSG
                                                .view_bundle_deployWizard_deploymentScheduledDetail_concise(),
                                                MSG.view_bundle_deployWizard_deploymentScheduledDetail(
                                                        result.getName(),
                                                        result.getDestination().getGroup().getName()),
                                                Severity.Info));
                                        wizard.getView().hideMessage();
                                        CoreGUI.refresh();
                                        wizard.setNewDeployment(result);
                                    }

                                    public void onFailure(Throwable caught) {
                                        deployingImage.setSrc(ImageManager.getStatusError());
                                        deployingMessage.setText(MSG.view_bundle_deployWizard_error_3());
                                        String errMsg = MSG.view_bundle_deployWizard_error_4(
                                                ErrorHandler.getAllMessages(caught));
                                        wizard.getView().showMessage(errMsg);
                                        Message msg = new Message(MSG.view_bundle_deployWizard_error_3(),
                                                errMsg, Severity.Error);
                                        CoreGUI.getMessageCenter().notify(msg);
                                    }
                                });
                    }

                    public void onFailure(Throwable caught) {
                        deployingImage.setSrc(ImageManager.getStatusError());
                        deployingMessage.setText(MSG.view_bundle_deployWizard_error_5());
                        String errMsg = MSG
                                .view_bundle_deployWizard_error_6(ErrorHandler.getAllMessages(caught));
                        wizard.getView().showMessage(errMsg);
                        Message msg = new Message(MSG.view_bundle_deployWizard_error_5(), errMsg,
                                Severity.Error);
                        CoreGUI.getMessageCenter().notify(msg);
                    }
                });
    }

    return canvas;
}

From source file:org.rhq.coregui.client.bundle.revert.RevertStep.java

License:Open Source License

public Canvas getCanvas() {
    if (canvas == null) {
        canvas = new EnhancedVLayout();
        canvas.setWidth100();/*from   www  .  jav  a2s. c  o m*/
        canvas.setHeight100();
        canvas.setAlign(Alignment.CENTER);

        final Img deployingImage = new Img(ImageManager.getLoadingIcon());
        deployingImage.setLayoutAlign(Alignment.CENTER);
        deployingImage.setWidth(50);
        deployingImage.setHeight(15);

        final Label deployingMessage = new Label(MSG.view_bundle_revertWizard_revertStep_reverting());
        deployingMessage.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

        canvas.addMember(deployingImage);
        canvas.addMember(deployingMessage);

        bundleServer.scheduleRevertBundleDeployment(this.wizard.getDestination().getId(),
                this.wizard.getDeploymentDescription(), this.wizard.isCleanDeployment(), //
                new AsyncCallback<BundleDeployment>() {
                    public void onSuccess(BundleDeployment result) {
                        deployingImage.setSrc(ImageManager.getStatusComplete());
                        deployingMessage.setText(MSG.view_bundle_revertWizard_revertStep_scheduled());
                        CoreGUI.getMessageCenter()
                                .notify(new Message(
                                        MSG.view_bundle_revertWizard_revertStep_scheduledDetails(
                                                result.getName(), result.getDestination().getGroup().getName()),
                                        Severity.Info));
                        CoreGUI.refresh();
                        wizard.setDeployment(result);
                    }

                    public void onFailure(Throwable caught) {
                        deployingImage.setSrc(ImageManager.getStatusError());
                        deployingMessage.setText(MSG.view_bundle_revertWizard_revertStep_scheduledFailure());
                        CoreGUI.getErrorHandler().handleError(
                                MSG.view_bundle_revertWizard_revertStep_scheduledFailure(), caught);
                    }
                });
    }

    return canvas;
}

From source file:org.rhq.enterprise.gui.coregui.client.bundle.deploy.DeployStep.java

License:Open Source License

public Canvas getCanvas(Locatable parent) {
    if (canvas == null) {
        if (parent != null) {
            canvas = new LocatableVLayout(parent.extendLocatorId("BundleDeployDeploy"));
        } else {/*from w w  w  .  j a  va  2s. c om*/
            canvas = new LocatableVLayout("BundleDeployDeploy");
        }
        canvas.setWidth100();
        canvas.setHeight100();
        canvas.setAlign(Alignment.CENTER);

        final Img deployingImage = new Img(ImageManager.getLoadingIcon());
        deployingImage.setLayoutAlign(Alignment.CENTER);
        deployingImage.setWidth(50);
        deployingImage.setHeight(15);

        final Label deployingMessage = new Label(MSG.view_bundle_deployWizard_deploying());
        deployingMessage.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

        canvas.addMember(deployingImage);
        canvas.addMember(deployingMessage);

        bundleServer.createBundleDeployment(wizard.getBundleVersion().getId(), wizard.getDestination().getId(),
                wizard.getNewDeploymentDescription(), wizard.getNewDeploymentConfig(), false, -1, false, //
                new AsyncCallback<BundleDeployment>() {
                    public void onSuccess(BundleDeployment result) {
                        deployingImage.setSrc("/images/status_complete.gif");
                        deployingMessage.setText(MSG.view_bundle_deployWizard_deploymentCreated());
                        CoreGUI.getMessageCenter()
                                .notify(new Message(
                                        MSG.view_bundle_deployWizard_deploymentCreatedDetail_concise(
                                                result.getName()),
                                        MSG.view_bundle_deployWizard_deploymentCreatedDetail(result.getName(),
                                                result.getDescription()),
                                        Severity.Info));
                        wizard.setNewDeployment(result);

                        bundleServer.scheduleBundleDeployment(wizard.getNewDeployment().getId(),
                                wizard.isCleanDeployment(), //
                                new AsyncCallback<BundleDeployment>() {
                                    public void onSuccess(BundleDeployment result) {
                                        deployingImage.setSrc("/images/status_complete.gif");
                                        deployingMessage
                                                .setText(MSG.view_bundle_deployWizard_deploymentScheduled());
                                        CoreGUI.getMessageCenter().notify(new Message(MSG
                                                .view_bundle_deployWizard_deploymentScheduledDetail_concise(),
                                                MSG.view_bundle_deployWizard_deploymentScheduledDetail(
                                                        result.getName(),
                                                        result.getDestination().getGroup().getName()),
                                                Severity.Info));
                                        wizard.getView().hideMessage();
                                        CoreGUI.refresh();
                                        wizard.setNewDeployment(result);
                                    }

                                    public void onFailure(Throwable caught) {
                                        deployingImage.setSrc("/images/status_error.gif");
                                        deployingMessage.setText(MSG.view_bundle_deployWizard_error_3());
                                        String errMsg = MSG.view_bundle_deployWizard_error_4(
                                                ErrorHandler.getAllMessages(caught));
                                        wizard.getView().showMessage(errMsg);
                                        Message msg = new Message(MSG.view_bundle_deployWizard_error_3(),
                                                errMsg, Severity.Error);
                                        CoreGUI.getMessageCenter().notify(msg);
                                    }
                                });
                    }

                    public void onFailure(Throwable caught) {
                        deployingImage.setSrc("/images/status_error.gif");
                        deployingMessage.setText(MSG.view_bundle_deployWizard_error_5());
                        String errMsg = MSG
                                .view_bundle_deployWizard_error_6(ErrorHandler.getAllMessages(caught));
                        wizard.getView().showMessage(errMsg);
                        Message msg = new Message(MSG.view_bundle_deployWizard_error_5(), errMsg,
                                Severity.Error);
                        CoreGUI.getMessageCenter().notify(msg);
                    }
                });
    }

    return canvas;
}

From source file:org.rhq.enterprise.gui.coregui.client.bundle.revert.RevertStep.java

License:Open Source License

public Canvas getCanvas(Locatable parent) {
    if (canvas == null) {
        if (parent != null) {
            canvas = new LocatableVLayout(parent.extendLocatorId("BundleRevertRevert"));
        } else {//  w w  w  . j a va 2 s. c  o  m
            canvas = new LocatableVLayout("BundleRevertRevert");
        }
        canvas.setWidth100();
        canvas.setHeight100();
        canvas.setAlign(Alignment.CENTER);

        final Img deployingImage = new Img("/images/status-bar.gif");
        deployingImage.setLayoutAlign(Alignment.CENTER);
        deployingImage.setWidth(50);
        deployingImage.setHeight(15);

        final Label deployingMessage = new Label(MSG.view_bundle_revertWizard_revertStep_reverting());
        deployingMessage.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

        canvas.addMember(deployingImage);
        canvas.addMember(deployingMessage);

        bundleServer.scheduleRevertBundleDeployment(this.wizard.getDestination().getId(),
                this.wizard.getDeploymentDescription(), this.wizard.isCleanDeployment(), //
                new AsyncCallback<BundleDeployment>() {
                    public void onSuccess(BundleDeployment result) {
                        deployingImage.setSrc("/images/status_complete.gif");
                        deployingMessage.setText(MSG.view_bundle_revertWizard_revertStep_scheduled());
                        CoreGUI.getMessageCenter()
                                .notify(new Message(
                                        MSG.view_bundle_revertWizard_revertStep_scheduledDetails(
                                                result.getName(), result.getDestination().getGroup().getName()),
                                        Severity.Info));
                        CoreGUI.refresh();
                        wizard.setDeployment(result);
                    }

                    public void onFailure(Throwable caught) {
                        deployingImage.setSrc("/images/status_error.gif");
                        deployingMessage.setText(MSG.view_bundle_revertWizard_revertStep_scheduledFailure());
                        CoreGUI.getErrorHandler().handleError(
                                MSG.view_bundle_revertWizard_revertStep_scheduledFailure(), caught);
                    }
                });
    }

    return canvas;
}

From source file:org.roda.wui.client.common.utils.HtmlSnippetUtils.java

public static void addRiskIncidenceObjectLinks(RiskIncidence incidence, final Label objectLabel,
        final Anchor objectLink) {
    if (AIP.class.getSimpleName().equals(incidence.getObjectClass())) {
        objectLabel.setText(messages.showAIPExtended());
        objectLink.setHref(HistoryUtils.createHistoryHashLink(BrowseAIP.RESOLVER, incidence.getAipId()));
        objectLink.setText(incidence.getAipId());

    } else if (Representation.class.getSimpleName().equals(incidence.getObjectClass())) {
        objectLabel.setText(messages.showRepresentationExtended());
        objectLink.setHref(HistoryUtils.createHistoryHashLink(BrowseRepresentation.RESOLVER,
                incidence.getAipId(), incidence.getRepresentationId()));
        objectLink.setText(incidence.getRepresentationId());

    } else if (File.class.getSimpleName().equals(incidence.getObjectClass())) {
        objectLabel.setText(messages.showFileExtended());
        objectLink//  w w  w.  j ava  2s.c  o  m
                .setHref(HistoryUtils.createHistoryHashLink(HistoryUtils.getHistoryBrowse(incidence.getAipId(),
                        incidence.getRepresentationId(), incidence.getFilePath(), incidence.getFileId())));
        objectLink.setText(incidence.getFileId());
    }
}

From source file:org.roda.wui.client.ingest.process.PluginParameterPanel.java

private void createSelectAipLayout() {
    Label parameterName = new Label(parameter.getName());
    final HorizontalPanel editPanel = new HorizontalPanel();
    final FlowPanel aipPanel = new FlowPanel();
    final Button button = new Button(messages.pluginAipIdButton());
    final FlowPanel buttonsPanel = new FlowPanel();
    final Anchor editButton = new Anchor(SafeHtmlUtils.fromSafeConstant("<i class=\"fa fa-edit\"></i>"));
    final Anchor removeButton = new Anchor(SafeHtmlUtils.fromSafeConstant("<i class=\"fa fa-remove\"></i>"));

    buttonsPanel.add(editButton);/* w w w  . ja  v  a2 s . com*/
    buttonsPanel.add(removeButton);

    ClickHandler editClickHandler = new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            SelectAipDialog selectAipDialog = new SelectAipDialog(parameter.getName(), false);
            selectAipDialog.setSingleSelectionMode();
            selectAipDialog.showAndCenter();
            selectAipDialog.addValueChangeHandler(new ValueChangeHandler<IndexedAIP>() {

                @Override
                public void onValueChange(ValueChangeEvent<IndexedAIP> event) {
                    IndexedAIP aip = event.getValue();

                    Label itemTitle = new Label();
                    HTMLPanel itemIconHtmlPanel = DescriptionLevelUtils
                            .getElementLevelIconHTMLPanel(aip.getLevel());
                    itemIconHtmlPanel.addStyleName("itemIcon");
                    itemTitle.setText(aip.getTitle() != null ? aip.getTitle() : aip.getId());
                    itemTitle.addStyleName("itemText");

                    aipPanel.clear();
                    aipPanel.add(itemIconHtmlPanel);
                    aipPanel.add(itemTitle);

                    editPanel.add(aipPanel);
                    editPanel.add(buttonsPanel);

                    editPanel.setCellWidth(aipPanel, "100%");

                    editPanel.setVisible(true);
                    button.setVisible(false);

                    value = aip.getId();
                }
            });
        }
    };

    ClickHandler removeClickHandler = new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editPanel.setVisible(false);
            button.setVisible(true);

            value = null;
        }
    };

    button.addClickHandler(editClickHandler);
    editButton.addClickHandler(editClickHandler);
    removeButton.addClickHandler(removeClickHandler);

    layout.add(parameterName);
    layout.add(button);
    layout.add(editPanel);

    parameterName.addStyleName("form-label");
    aipPanel.addStyleName("itemPanel");
    button.addStyleName("form-button btn btn-play");
    buttonsPanel.addStyleName("itemButtonsPanel");
    editButton.addStyleName("toolbarLink toolbarLinkSmall");
    removeButton.addStyleName("toolbarLink toolbarLinkSmall");
}

From source file:org.roda.wui.client.ingest.process.ShowJob.java

private void showActionSourceObjects(final SelectedItems<?> selected) {
    if (selected != null) {
        final boolean selectable = false;
        final boolean justActive = true;
        selectedList.clear();//www. ja v  a2 s.c  o  m

        if (selected instanceof SelectedItemsList) {
            BrowserService.Util.getInstance().getListThreshold(new AsyncCallback<Integer>() {

                @Override
                public void onFailure(Throwable caught) {
                    AsyncCallbackUtils.defaultFailureTreatment(caught);
                }

                @Override
                public void onSuccess(Integer threshold) {
                    List<String> ids = ((SelectedItemsList<?>) selected).getIds();

                    if (ids.isEmpty()) {
                        selectedListPanel.setVisible(false);
                    } else if (ids.size() > threshold) {
                        Label thresholdLabel = new Label(messages.thresholdExceeded(ids.size(), threshold));
                        selectedList.add(thresholdLabel);
                    } else {
                        Filter filter = new Filter(new OneOfManyFilterParameter(RodaConstants.INDEX_UUID, ids));
                        if (IndexedAIP.class.getName().equals(selected.getSelectedClass())) {
                            AIPList list = new AIPList(filter, justActive, null, messages.aipsTitle(),
                                    selectable, 10, 10);
                            selectedList.add(list);
                        } else if (IndexedRepresentation.class.getName().equals(selected.getSelectedClass())) {
                            RepresentationList list = new RepresentationList(filter, justActive, null,
                                    messages.representationsTitle(), selectable, 10, 10);
                            selectedList.add(list);
                        } else if (IndexedFile.class.getName().equals(selected.getSelectedClass())) {
                            SimpleFileList list = new SimpleFileList(filter, justActive, null,
                                    messages.filesTitle(), selectable, 10, 10);
                            selectedList.add(list);
                        }
                    }
                }
            });

        } else if (selected instanceof SelectedItemsFilter) {
            Filter filter = ((SelectedItemsFilter<?>) selected).getFilter();

            if (IndexedAIP.class.getName().equals(selected.getSelectedClass())) {
                AIPList list = new AIPList(filter, justActive, null, messages.aipsTitle(), selectable, 10, 10);
                selectedList.add(list);
            } else if (IndexedRepresentation.class.getName().equals(selected.getSelectedClass())) {
                RepresentationList list = new RepresentationList(filter, justActive, null,
                        messages.representationsTitle(), selectable, 10, 10);
                selectedList.add(list);
            } else if (IndexedFile.class.getName().equals(selected.getSelectedClass())) {
                SimpleFileList list = new SimpleFileList(filter, justActive, null, messages.filesTitle(),
                        selectable, 10, 10);
                selectedList.add(list);
            }

        } else if (selected instanceof SelectedItemsAll || selected instanceof SelectedItemsNone) {
            Label objectLabel = new Label();
            objectLabel.addStyleName("value");

            if (AIP.class.getName().equals(selected.getSelectedClass())
                    || IndexedAIP.class.getName().equals(selected.getSelectedClass())) {
                objectLabel.setText(messages.allIntellectualEntities());
            } else if (Representation.class.getName().equals(selected.getSelectedClass())
                    || IndexedRepresentation.class.getName().equals(selected.getSelectedClass())) {
                objectLabel.setText(messages.allRepresentations());
            } else if (File.class.getName().equals(selected.getSelectedClass())
                    || IndexedFile.class.getName().equals(selected.getSelectedClass())) {
                objectLabel.setText(messages.allFiles());
            }

            selectedList.add(objectLabel);
        } else {
            selectedListPanel.setVisible(false);
        }
    }
}

From source file:org.roda.wui.client.ingest.process.ShowJob.java

private void createSelectAipLayout(PluginParameter parameter) {
    Label parameterName = new Label(parameter.getName());
    final FlowPanel aipPanel = new FlowPanel();
    final String value = job.getPluginParameters().containsKey(parameter.getId())
            ? job.getPluginParameters().get(parameter.getId())
            : parameter.getDefaultValue();

    if (value != null && !value.isEmpty()) {
        BrowserService.Util.getInstance().retrieve(IndexedAIP.class.getName(), value, aipFieldsToReturn,
                new AsyncCallback<IndexedAIP>() {

                    @Override/*  w w  w  .  j  av a2 s . c o  m*/
                    public void onFailure(Throwable caught) {
                        if (caught instanceof NotFoundException) {
                            Label itemTitle = new Label(value);
                            itemTitle.addStyleName("itemText");
                            aipPanel.clear();
                            aipPanel.add(itemTitle);
                        } else {
                            AsyncCallbackUtils.defaultFailureTreatment(caught);
                        }
                    }

                    @Override
                    public void onSuccess(IndexedAIP aip) {
                        Label itemTitle = new Label();
                        HTMLPanel itemIconHtmlPanel = DescriptionLevelUtils
                                .getElementLevelIconHTMLPanel(aip.getLevel());
                        itemIconHtmlPanel.addStyleName("itemIcon");
                        itemTitle.setText(aip.getTitle() != null ? aip.getTitle() : aip.getId());
                        itemTitle.addStyleName("itemText");

                        aipPanel.clear();
                        aipPanel.add(itemIconHtmlPanel);
                        aipPanel.add(itemTitle);
                    }
                });
    } else {
        HTMLPanel itemIconHtmlPanel = DescriptionLevelUtils.getTopIconHTMLPanel();
        aipPanel.clear();
        aipPanel.add(itemIconHtmlPanel);
    }

    pluginOptions.add(parameterName);
    pluginOptions.add(aipPanel);

    parameterName.addStyleName("form-label itemLabel");
    aipPanel.addStyleName("itemPanel itemPanelShow");
}