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.ednovo.gooru.client.mvp.play.resource.add.AddResourceCollectionView.java

License:Open Source License

public void changeButtonText() {
    showSuccessWidget(false);//from   www  .  j a  v  a  2s.  c o m
    addingLabel.setVisible(false);
    errorMessage.setVisible(false);
    addResourceToCollectionButton.setVisible(true);
    addResourceToCollectionButton.setText(GL0590);
    addCollectionContainer.clear();
    Label colletionIsteadButton = getAddCollectionViewButton();
    colletionIsteadButton.getElement().getStyle().clearMarginRight();
    colletionIsteadButton.getElement().getStyle().clearMarginTop();
    colletionIsteadButton.setText(GL0664);
    addCollectionContainer.add(colletionIsteadButton);
}

From source file:org.ednovo.gooru.client.mvp.rating.RatingUserWidgetView.java

License:Open Source License

@UiHandler("deleteReview")
public void onClickDeleteReview(ClickEvent event) {

    AppClientFactory.getInjector().getPlayerAppService().deleteRating(starRatingsDo.getDeleteRatingGooruOid(),
            new SimpleAsyncCallback<Void>() {

                @Override//from ww  w .  ja  v  a  2 s.  co  m
                public void onSuccess(Void result) {
                    reviewContainer.clear();
                    reviewContainer.addStyleName(style.deletePanel());
                    if (!starRatingsDo.getFreeText().equals("") && starRatingsDo.getFreeText() != null) {
                        AppClientFactory
                                .fireEvent(new DeletePlayerStarReviewEvent(starRatingsDo.getAssocGooruOid()));
                    } else {
                        AppClientFactory.fireEvent(new DeletePlayerStarRatingsEvent());
                    }

                    final HTMLPanel deletePanel = new HTMLPanel("");
                    Label deleteMsg = new Label();
                    deleteMsg.setText(i18n.GL1853());
                    deleteMsg.getElement().setAttribute("alt", i18n.GL1853());
                    deleteMsg.getElement().setAttribute("title", i18n.GL1853());
                    deleteMsg.setStyleName(style.lbldeleteMsg());
                    deletePanel.add(deleteMsg);
                    reviewContainer.add(deletePanel);
                    new FadeInAndOut(deletePanel.getElement(), 1000);
                    Timer timer = new Timer() {
                        @Override
                        public void run() {
                            int deleteIndex = reviewContainer.getWidgetIndex(deletePanel);
                            reviewContainer.remove(deleteIndex);
                            reviewContainer.setVisible(false);
                            AppClientFactory.fireEvent(new UpdateRatingOnDeleteEvent(true));
                            AppClientFactory
                                    .fireEvent(new UpdateRatingsGraphEvent(starRatingsDo.getAssocGooruOid()));

                        }
                    };
                    timer.schedule(1000);
                }
            });
}

From source file:org.ednovo.gooru.client.mvp.search.TagsTabView.java

License:Open Source License

/**
 * Sets tags related to the resources.//from www  .java2s  .c o m
 * (non-Javadoc)
 * @see org.ednovo.gooru.client.mvp.search.IsTagsTabView#getResourceTags(java.util.List)
 */
@Override
public void setResourceTags(SearchResourcesTagsDo searchResourcesTagsDo, boolean isTagsClear) {

    setTotCount(searchResourcesTagsDo.getTotalHitCount());
    setCurrentTagsDispalyCount(getCurrentTagsDispalyCount() + searchResourcesTagsDo.getSearchResults().size());
    clearTagsContainer(isTagsClear);
    if (getTotCount() == 0) {
        Label emptyTagsLbl = new Label();
        emptyTagsLbl.getElement().getStyle().setTextAlign(TextAlign.CENTER);
        emptyTagsLbl.getElement().getStyle().setMarginTop(40, Unit.PX);
        emptyTagsLbl.setText(i18n.GL3049());
        tagsContainer.add(emptyTagsLbl);

    }
    if (isTagsAdded) {
        isTagsAdded = false;
        tagsLbl.setText(i18n.GL3048() + " " + i18n.GL_SPL_OPEN_SMALL_BRACKET() + getTotCount()
                + i18n.GL_SPL_CLOSE_SMALL_BRACKET());
        //         AppClientFactory.fireEvent( new ResourceTagsCountUpdateEvent(getTotCount()));
    }

    for (int i = 0; i < searchResourcesTagsDo.getSearchResults().size(); i++) {
        ProfileUserTagWidget profileUserTagWidget = new ProfileUserTagWidget(
                searchResourcesTagsDo.getSearchResults().get(i));
        profileUserTagWidget.setSearchTabTagLblStyleName(searchTagsTabStyle.searchTabTagLbl());
        profileUserTagWidget.setSearchTabTagRightStyleName(searchTagsTabStyle.searchTabTagRight());
        profileUserTagWidget.setSearchTagsBgStyleName(searchTagsTabStyle.searchTagsBg());
        tagsContainer.add(profileUserTagWidget);
    }
    loadingImageLabel.setVisible(false);
}

From source file:org.ednovo.gooru.client.mvp.settings.UserSettingsView.java

License:Open Source License

@Override
public void setProfileData(ProfileDo profileDo) {
    uploadProfileImage.setUrl(profileDo.getUser().getProfileImageUrl() + "?p=" + Math.random());
    setGradeList(profileDo.getGrade(), profileDo);
    Set<ProfileCodeDo> codeDo = profileDo.getCourses();
    coursesPanel.clear();/*from w ww.  java2 s .  c  o m*/

    collectionCourseDefaultLstPanel.clear();
    for (ProfileCodeDo code : codeDo) {
        coursesPanel.add(createCourseLabel(code.getCode().getLabel(), code.getCode().getCodeId() + ""));
        //collectionCourseDefaultLstPanel.add(createCourseLabel(code.getCode().getLabel(), code.getCode().getCodeId() + ""));
        defaultCoursePanel = new HTML(code.getCode().getLabel());
        collectionCourseDefaultLstPanel.add(defaultCoursePanel);
        defaultCoursePanel.setStyleName(Settings.deafaultCourse());

    }
    if (profileDo.getCourses().size() == 0) {
        Label defaultCourseLabel = new Label();
        defaultCourseLabel.setStyleName(Settings.defaultTextcss());
        defaultCourseLabel.getElement().setAttribute("style", "margin-left: 0px !important");
        defaultCourseLabel.setText(NONE_ADDED);
        collectionCourseDefaultLstPanel.add(defaultCourseLabel);
    }

}

From source file:org.ednovo.gooru.client.mvp.settings.UserSettingsView.java

License:Open Source License

/**
 * separate the view according to grade level of the user
 *//*  www  . j a va  2s  . com*/
public void setGradeList(String grades, ProfileDo profileDo) {

    if (grades != null) {
        DefaultGardeContainer.clear();
        //For short
        List<Integer> listI = new ArrayList<Integer>();
        List<String> listS = new ArrayList<String>();

        List<Object> listO = new ArrayList<Object>();
        String[] newst = grades.split(",");

        for (int i = 0; i < newst.length; i++) {
            try {
                int k = Integer.parseInt(newst[i]);
                listI.add(k);
            } catch (Exception e) {
                listS.add(newst[i]);
            }
        }
        Collections.sort(listS, Collections.reverseOrder());

        Collections.sort(listI);
        if (listS.contains("Kindergarten") && listS.contains("Higher Education")) {
            listO.add("Kindergarten");
            listO.addAll(listI);
            listO.add("Higher Education");
        } else if (listS.contains("Kindergarten")) {
            listO.add("Kindergarten");
            listO.addAll(listI);
        } else if (listS.contains("Higher Education")) {
            listO.addAll(listI);
            listO.add("Higher Education");
        } else {
            listO.addAll(listI);
        }

        StringBuilder sortedGrade = new StringBuilder();
        for (Object obj : listO) {

            sortedGrade.append(obj.toString());
            Label gradeLabel = new Label(obj.toString());
            gradeLabel.setStyleName(CollectionCBundle.INSTANCE.css().settingPageDefaultGrade());
            gradeLabel.getElement().setAttribute("selected", "selected");
            DefaultGardeContainer.add(gradeLabel);
        }
    } else {
        DefaultGardeContainer.clear();
        Label defaulTextLabel = new Label();
        defaulTextLabel.setStyleName(Settings.defaultTextcss());
        defaulTextLabel.setText(NONE_ADDED);
        DefaultGardeContainer.add(defaulTextLabel);

    }

    KinderGarten.clear();
    higherEducation.clear();
    gradeTopList.clear();
    gradeMiddleList.clear();

    KinderGarten.add(new ProfilePageGradeLabel(GL0850, profileDo));
    higherEducation.add(new ProfilePageGradeLabel(GL0169, profileDo));
    for (int i = 1; i <= 12; i++) {
        if (i <= 6) {
            gradeTopList.add(new ProfilePageGradeLabel(i + "", profileDo));

        }
        if (i >= 7) {
            gradeMiddleList.add(new ProfilePageGradeLabel(i + "", profileDo));

        }
    }
}

From source file:org.ednovo.gooru.client.mvp.shelf.collection.tab.resource.add.drive.DriveView.java

License:Open Source License

public void showErrorMessage(String errorHeading, String errorSubHeading) {
    FlowPanel errorContainer = new FlowPanel();
    errorContainer.setStyleName(driveStyle.pannelError());
    Label lblErrorHeading = new Label();
    lblErrorHeading.setStyleName(driveStyle.errorHeading());
    lblErrorHeading.setText(errorHeading);
    lblErrorHeading.getElement().setAttribute("alt", errorHeading);
    lblErrorHeading.getElement().setAttribute("title", errorHeading);
    Label lblErrorSubHeading = new Label();
    lblErrorSubHeading.setStyleName("");
    lblErrorSubHeading.setText(errorSubHeading);
    lblErrorSubHeading.getElement().setAttribute("alt", errorSubHeading);
    lblErrorSubHeading.getElement().setAttribute("title", errorSubHeading);
    errorContainer.add(lblErrorHeading);
    errorContainer.add(lblErrorSubHeading);
    panelFileList.add(errorContainer);// www  .  ja v  a  2 s.  c om
}

From source file:org.emftools.samples.school.webdemo.client.WebDemoEntryPoint.java

License:Open Source License

/**
 * This method is invoked when to the OCL textareas change.
 * //from ww  w  .j  a v a 2 s  . com
 * <p>
 * The method's boy invokes the OCL validation service provided by the
 * server and reports the errors when required in the specified status
 * label.
 * 
 * @param eClassName
 *            the OCL expression context.
 * @param oclTextArea
 *            The text area containing the OCL expression.
 * @param statusLabel
 *            The label that accepts the parsing errors.
 */
private void oclExpressionHasChanged(final String eClassName, final TextArea oclTextArea,
        final Label statusLabel) {
    service.validate(eClassName, oclTextArea.getText(), new AsyncCallback<String>() {
        public void onFailure(Throwable caught) {
            Window.alert("Unexpected error : " + caught.getMessage());
        }

        public void onSuccess(String result) {
            if (result == null) {
                oclTextArea.setStyleName(defaultTexteAreaStyleName);
                statusLabel.setText(" ");
                updateDiagram();
            } else {
                statusLabel.setText(result);
                oclTextArea.setStyleName("badvalue");
            }
        }
    });
}

From source file:org.eobjects.datacleaner.monitor.scheduling.widgets.SchedulingOverviewPanel.java

License:Open Source License

private Label createLabel(String text, String styleName) {
    final Label label = new Label();
    label.setText(text);
    label.setStyleName(styleName);/* w  w  w  .  j  av a2  s .  c  o  m*/
    return label;
}

From source file:org.errai.samples.asyncdemo.client.local.AsyncClient.java

License:Apache License

public void onModuleLoad() {
    final HorizontalPanel hPanel = new HorizontalPanel();
    final Label messagesReceived = new Label("Messaged Received: ");
    final Label messagesReceivedVal = new Label();

    class Counter {
        int count = 0;

        public void increment() {
            messagesReceivedVal.setText(String.valueOf(++count));
        }/*from   w ww . j  a  va  2  s . c o  m*/
    }

    final Counter counter = new Counter();

    for (int i = 0; i < 7; i++) {
        final VerticalPanel panel = new VerticalPanel();

        final Button startStopButton = new Button("Start" + i);
        final TextBox resultBox = new TextBox();
        resultBox.setEnabled(false);

        final String receiverName = "RandomNumberReceiver" + i;

        final Style resultStyle = resultBox.getElement().getStyle();

        /**
         * Create a callback receiver to receive the data from the server.
         */
        final MessageCallback receiver = new MessageCallback() {
            public void callback(Message message) {
                counter.increment();
                Double value = message.get(Double.class, "Data");
                resultBox.setText(String.valueOf(value));

                if (value > 0.5d) {
                    resultStyle.setProperty("backgroundColor", "green");
                } else {
                    resultStyle.setProperty("backgroundColor", "red");
                }
            }
        };

        /**
         * Subscribe to the receiver using the recevierName.
         */
        ErraiBus.get().subscribe(receiverName, receiver);

        final int num = i;

        startStopButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                /**
                 * Send a message to Start/Stop the task on the server.
                 */
                MessageBuilder.createMessage().toSubject("AsyncService").command(startStopButton.getText())
                        .with(MessageParts.ReplyTo, receiverName).noErrorHandling().sendNowWith(ErraiBus.get());

                /**
                 * Flip-flop the value of the button every time it's pushed between 'Start' and 'Stop'
                 */
                startStopButton.setText(
                        ("Start" + num).equals(startStopButton.getText()) ? "Stop" + num : "Start" + num);
            }
        });

        panel.add(startStopButton);
        panel.add(resultBox);

        hPanel.add(panel);
    }

    final VerticalPanel outerPanel = new VerticalPanel();
    outerPanel.add(hPanel);

    final HorizontalPanel messageCounter = new HorizontalPanel();
    messageCounter.add(messagesReceived);
    messageCounter.add(messagesReceivedVal);

    outerPanel.add(messageCounter);

    RootPanel.get().add(outerPanel);
}

From source file:org.errai.samples.broadcastservice.client.local.BroadcastClient.java

License:Apache License

public void onModuleLoad() {
    final VerticalPanel panel = new VerticalPanel();
    final TextBox inputBox = new TextBox();
    final Button sendBroadcast = new Button("Broadcast!");

    sendBroadcast.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            /**/*from  w  w  w.  j a va  2 s.c o  m*/
             * Send a message to the BroadcastService with the contents of the
             * inputBox as the "BroadcastText" field.
             */
            MessageBuilder.createMessage().toSubject("BroadcastService")
                    .with("BroadcastText", inputBox.getText()).noErrorHandling().sendNowWith(bus);
        }
    });

    final Label broadcastReceive = new Label();

    /**
     * Declare a local service to receive messages on the subject
     * "BroadCastReceiver".
     */
    bus.subscribe("BroadcastReceiver", new MessageCallback() {
        public void callback(Message message) {
            /**
             * When a message arrives, extract the "BroadcastText" field and
             * update the broadcastReceive Label widget with the contents.
             */
            String broadcastText = message.get(String.class, "BroadcastText");
            broadcastReceive.setText(broadcastText);
        }
    });

    panel.add(inputBox);
    panel.add(sendBroadcast);
    panel.add(broadcastReceive);

    RootPanel.get().add(panel);
}