Example usage for com.google.gwt.user.client.ui HTMLPanel getWidget

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

Introduction

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

Prototype

public Widget getWidget(int index) 

Source Link

Usage

From source file:com.agnie.gwt.common.client.mvp.AppController.java

License:Open Source License

protected boolean checkIfWeCanProceed() {
    HTMLPanel contentPanel = getMainContentRootPanel();
    if (contentPanel != null) {
        for (int index = 0; index < contentPanel.getWidgetCount(); index++) {
            Widget widget = contentPanel.getWidget(index);
            if (widget instanceof MainView) {
                MainView priviousDisplay = (MainView) widget;
                boolean resp = priviousDisplay.shouldWeProceed();
                if (!resp)
                    return false;
            }//from   w ww. j a  v a 2s  . c  o  m
        }
    }
    return true;
}

From source file:com.gwtmobile.phonegap.kitchensink.client.KitchenSink.java

License:Apache License

protected void emulateClickOnBackButton() {
    HTMLPanel current = (HTMLPanel) PageHistory.current().getWidget();
    HeaderPanel header = (HeaderPanel) current.getWidget(0);
    Button left = header.getLeftButton();
    NativeEvent event = Document.get().createClickEvent(1, 1, 1, 1, 1, false, false, false, false);
    left.getElement().dispatchEvent(event);
}

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

License:Open Source License

public void removeSelectedOption(HTMLPanel questionAnswerChoiceContainer,
        AddQuestionAnswerChoice selectedAnswerChoice) {
    for (int i = 0; i < questionAnswerChoiceContainer.getWidgetCount(); i++) {
        AddQuestionAnswerChoice addQuestionAnswerChoice = (AddQuestionAnswerChoice) questionAnswerChoiceContainer
                .getWidget(i);//from   ww w . ja  va2  s .  c o  m
        removeStyleToBody(addQuestionAnswerChoice);
        if (selectedAnswerChoice != null
                && addQuestionAnswerChoice.optionSelectedButton.getStyleName()
                        .equals(addWebResourceStyle.answerSelected())
                && selectedAnswerChoice.optionSelectedButton.getStyleName()
                        .equals(addWebResourceStyle.answerSelected())) {

        } else {
            addQuestionAnswerChoice.optionSelectedButton.setStyleName(addWebResourceStyle.answerDeselected());
        }

    }
}

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

License:Open Source License

private boolean isAnswerChoiceSelected(HTMLPanel questionAnswerChoiceContainer) {

    boolean isAnswerChoiceSelected = false;
    for (int i = 0; i < questionAnswerChoiceContainer.getWidgetCount(); i++) {
        AddQuestionAnswerChoice addQuestionAnswerChoice = (AddQuestionAnswerChoice) questionAnswerChoiceContainer
                .getWidget(i);/*  ww w  . ja  va  2s  .  co m*/
        if (addQuestionAnswerChoice.optionSelectedButton.getStyleName()
                .equals(addWebResourceStyle.answerSelected())) {
            isAnswerChoiceSelected = true;
        }

    }

    return isAnswerChoiceSelected;

}

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

License:Open Source License

public boolean isAnswerChoiceEmpty(HTMLPanel questionAnswerChoiceContainer) {
    profanityList = new ArrayList<ProfanityCheckDo>();
    for (int i = 0; i < questionAnswerChoiceContainer.getWidgetCount(); i++) {
        final AddQuestionAnswerChoice addQuestionAnswerChoice = (AddQuestionAnswerChoice) questionAnswerChoiceContainer
                .getWidget(i);//from www. j  a  va  2  s.  co m
        String answerChoiceValue = null;
        addQuestionAnswerChoice.errorMessageforAnswerChoice.setText("");
        if (getQuestionType().equalsIgnoreCase("T/F")) {
            answerChoiceValue = addQuestionAnswerChoice.fieldValue;
        } else if (getQuestionType().equalsIgnoreCase("MC") || getQuestionType().equalsIgnoreCase("MA")) {
            answerChoiceValue = addQuestionAnswerChoice.answerTextBox.getContent().replaceAll("\\<.*?>", "");
        }
        ProfanityCheckDo profanitymodel = new ProfanityCheckDo();
        if (answerChoiceValue == null || answerChoiceValue.trim().equalsIgnoreCase("")) {
            isAnswerChoiceSelected = true;
            addQuestionAnswerChoice.errorMessageforAnswerChoice.setText(ERROR_MSG_ANSWER);
            profanitymodel.setQuestionID(Integer.toString(i));
            profanityList.add(profanitymodel);
            addQuestionAnswerChoice.errorMessageforAnswerChoice.getElement().setAttribute("style",
                    "display:block");
        } else {
            if (answerChoiceValue.trim().length() > ANSWER_CHOICE_HINTS_TEXT_LENGTH) {
                isAnswerChoiceSelected = true;
                Document.get().getElementById(addQuestionAnswerChoice.answerTextBox.getID() + "_message")
                        .setInnerText("");
                addQuestionAnswerChoice.errorMessageforAnswerChoice.setText(ERROR_MSG_ANSWER_LENGTH);
            } else {
                isAnswerChoiceSelected = false;
                profanitymodel.setQuestionID(Integer.toString(i));
                profanitymodel.setQuestionText(answerChoiceValue);
                profanityList.add(profanitymodel);
            }
        }
    }
    return isAnswerChoiceSelected;
}

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

License:Open Source License

public boolean isHintsAdded(HTMLPanel hintsContainer) {
    boolean hintsAdded = false;
    hintsListForProfanity = new ArrayList<ProfanityCheckDo>();
    if (hintsContainer.getWidgetCount() >= 1) {
        for (int i = 0; i < hintsContainer.getWidgetCount(); i++) {
            final AddHintsView addHints = (AddHintsView) hintsContainer.getWidget(i);
            ProfanityCheckDo profanitymodel = new ProfanityCheckDo();
            profanitymodel.setQuestionID(Integer.toString(i));
            if (addHints.hintTextBox.getContent() != null
                    || !addHints.hintTextBox.getContent().trim().equals("")) {
                String hintsText = addHints.hintTextBox.getContent().replaceAll("\\<.*?>", "");
                if (hintsText.trim().length() > ANSWER_CHOICE_HINTS_TEXT_LENGTH) {
                    Document.get().getElementById(addHints.hintTextBox.getID() + "_message").setInnerText("");
                    addHints.errorMessageforHints.setText(ERROR_MSG_HINTS_LENGTH);
                    hintsAdded = true;/*from  ww w.  j av  a 2  s . c  om*/
                    isAddBtnClicked = true;
                }
                profanitymodel.setQuestionText(addHints.hintTextBox.getContent());
            }
            hintsListForProfanity.add(profanitymodel);
        }
    }

    return hintsAdded;
}