Java Code Examples for com.google.gwt.user.client.ui.ListBox#addChangeHandler()

The following examples show how to use com.google.gwt.user.client.ui.ListBox#addChangeHandler() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChangeGradeModesDialog.java    From unitime with Apache License 2.0 6 votes vote down vote up
public GradeModeChange(ClassAssignmentInterface.ClassAssignment ca, SpecialRegistrationGradeModeChanges gradeMode) {
	super(null);
	iList = new ListBox();
	iList.addStyleName("grade-mode-list");
	iClasses = new ArrayList<ClassAssignmentInterface.ClassAssignment>();
	iClasses.add(ca);
	iGradeMode = new ArrayList<SpecialRegistrationGradeModeChanges>();
	iGradeMode.add(gradeMode);
	iList.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			formChanged();
		}
	});
	setup();
}
 
Example 2
Source File: ChangeGradeModesDialog.java    From unitime with Apache License 2.0 6 votes vote down vote up
public GradeModeLabel(GradeModeChange change, SpecialRegistrationGradeModeChanges gradeMode) {
	super(null);
	iGradeMode = gradeMode;
	iLabel = new Label();
	iLabel.addStyleName("grade-mode-label");
	iLabel.setText(iGradeMode.getCurrentGradeMode() == null ? "" : iGradeMode.getCurrentGradeMode().getLabel());
	final ListBox box = (ListBox)change.getWidget(); 
	box.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			if (box.getSelectedIndex() <= 0) {
				iLabel.setText(iGradeMode.getCurrentGradeMode() == null ? "" : iGradeMode.getCurrentGradeMode().getLabel());
			} else {
				SpecialRegistrationGradeMode m = iGradeMode.getAvailableChange(box.getValue(box.getSelectedIndex()));
				if (m == null) {
					iLabel.setText(iGradeMode.getCurrentGradeMode() == null ? "" : iGradeMode.getCurrentGradeMode().getLabel());
				} else {
					iLabel.setText(m.getLabel());
				}
			}
		}
	});
}
 
Example 3
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private Widget createAspectRatioListBox()
{
    final ListBox box = new ListBox();
    for (WCAspectRatio algo : WCAspectRatioRegistry.list())
        box.addItem(algo.getDescription(), algo.getId());

    box.setSelectedIndex(findIndex(box, setting.getAspectRatio().getId()));

    box.addChangeHandler(new ChangeHandler()
    {
        public void onChange(ChangeEvent event)
        {
            WCAspectRatio value = WCAspectRatioRegistry.getById(box.getValue(box.getSelectedIndex()));
            setting.setAspectRatio(value);
        }
    });

    box.setTitle("Desired aspect ratio of the drawing");

    return box;
}
 
Example 4
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private ListBox createNumberListBox()
{
    final ListBox box = new ListBox();
    List<String> values = Arrays.asList("10", "20", "30", "40", "50", "75", "100", "125", "150", "200", "250", "300");

    for (int i = 0; i < values.size(); i++)
        box.addItem(values.get(i));

    box.setSelectedIndex(findIndex(box, String.valueOf(setting.getWordCount())));

    box.addChangeHandler(new ChangeHandler()
    {
        public void onChange(ChangeEvent event)
        {
            int value = Integer.parseInt(box.getValue(box.getSelectedIndex()));
            setting.setWordCount(value);
        }
    });

    box.setTitle("Number of words to include in the word cloud");

    return box;
}
 
Example 5
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private ListBox createFontListBox()
{
    final ListBox box = new ListBox();
    for (WCFont font : WCFontRegistry.list())
        box.addItem(font.getDescription(), font.getName());

    box.setSelectedIndex(findIndex(box, setting.getFont().getName()));

    box.addChangeHandler(new ChangeHandler()
    {
        public void onChange(ChangeEvent event)
        {
            WCFont value = WCFontRegistry.getByName(box.getValue(box.getSelectedIndex()));
            setting.setFont(value);
        }
    });

    box.setTitle("Font family of the words");
    return box;
}
 
Example 6
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private ListBox createRankingListBox()
{
    final ListBox box = new ListBox();
    for (WCRankingAlgo algo : WCRankingAlgoRegistry.list())
        box.addItem(algo.getDescription(), algo.getId());

    box.setSelectedIndex(findIndex(box, setting.getRankingAlgorithm().getId()));

    box.addChangeHandler(new ChangeHandler()
    {
        public void onChange(ChangeEvent event)
        {
            WCRankingAlgo value = WCRankingAlgoRegistry.getById(box.getValue(box.getSelectedIndex()));
            setting.setRankingAlgorithm(value);
        }
    });

    box.setTitle("Ranking method for computing word importance, which determines font size of each word");
    return box;
}
 
Example 7
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private Widget createSimilarityListBox()
{
    final ListBox box = new ListBox();
    for (WCSimilarityAlgo font : WCSimilarityAlgoRegistry.list())
        box.addItem(font.getDescription(), font.getId());

    box.setSelectedIndex(findIndex(box, setting.getSimilarityAlgorithm().getId()));

    box.addChangeHandler(new ChangeHandler()
    {
        public void onChange(ChangeEvent event)
        {
            WCSimilarityAlgo value = WCSimilarityAlgoRegistry.getById(box.getValue(box.getSelectedIndex()));
            setting.setSimilarityAlgorithm(value);
        }
    });

    box.setTitle("Similarity method for computing relatedness between words; similar words tend to be placed together");
    return box;
}
 
Example 8
Source File: TemplateUploadWizard.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a drop down menu for selecting Template repositories.
 * @return the drop down menu of repository Urls.
 */
private ListBox makeTemplatesMenu() {
  final ListBox templatesMenu = new ListBox();
  templatesMenu.addItem(MESSAGES.templateUploadNewUrlCaption());
  templatesMenu.addItem(MIT_TEMPLATES);

  for (int k = 0; k < dynamicTemplateUrls.size(); k++) { // Dynamically added Urls
    templatesMenu.addItem(dynamicTemplateUrls.get(k));
  }
  templatesMenu.setSelectedIndex(MIT_TEMPLATES_INDEX);
  templatesMenu.addChangeHandler(new ChangeHandler() {
      public void onChange(ChangeEvent event) {
        int selectedIndex = templatesMenu.getSelectedIndex();

        if (selectedIndex == 0) {
          templatesMenu.setSelectedIndex(lastSelectedIndex);
          usingExternalTemplate = true; // MIT templates at index 1
          removeButton.setVisible(false);
          new InputTemplateUrlWizard(instance).center();     // This will do a callback
        } else if (selectedIndex == 1) {
          removeButton.setVisible(false);          lastSelectedIndex = selectedIndex;
          usingExternalTemplate = false; // MIT templates at index 1
          templateHostUrl = "";
          retrieveSelectedTemplates(templatesMenu.getValue(selectedIndex));  // may do callback
        } else {
          removeButton.setVisible(true);         lastSelectedIndex = selectedIndex;
          usingExternalTemplate = true; // MIT templates at index 1
          templateHostUrl = templatesMenu.getValue(selectedIndex);
          retrieveSelectedTemplates(templatesMenu.getValue(selectedIndex));  // may do callback
        }
      }
    });
  templatesMenu.setVisibleItemCount(1);  // Turns menu into a drop-down list).
  return templatesMenu;
}
 
Example 9
Source File: SuggestPopup.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected void createChoiceList() {
	choiceList = new ListBox();
	choiceList.setStyleName("list");
	choiceList.addKeyDownHandler(this);
	choiceList.addDoubleClickHandler(this);
	choiceList.addChangeHandler(this);
	choiceList.setStylePrimaryName("aceeditor-suggestpopup-list");
	setWidget(choiceList);
}
 
Example 10
Source File: ChangeGradeModesDialog.java    From unitime with Apache License 2.0 5 votes vote down vote up
public VariableCreditChange(ClassAssignmentInterface.ClassAssignment ca, SpecialRegistrationVariableCreditChange vcc) {
	super(null);
	iList = new ListBox();
	iList.addStyleName("variable-credit-list");
	iClass = ca;
	iVarCredit = vcc;
	iList.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			formChanged();
		}
	});
	setup();
}
 
Example 11
Source File: SettingsPanel.java    From swcv with MIT License 5 votes vote down vote up
private ListBox createLanguageListBox()
{
    final ListBox box = new ListBox();
    box.addItem("Arabic", "ar");
    box.addItem("Czech", "cs");
    box.addItem("Danish", "da");
    box.addItem("Dutch", "nl");
    box.addItem("English", "en");
    box.addItem("Finnish", "fi");
    box.addItem("French", "fr");
    box.addItem("German", "de");
    box.addItem("Greek", "el");
    box.addItem("Hungarian", "hu");
    box.addItem("Italian", "it");
    box.addItem("Japanese", "ja");
    box.addItem("Norwegian", "no");
    box.addItem("Polish", "pl");
    box.addItem("Portuguese", "pt");
    box.addItem("Russian", "ru");
    box.addItem("Spanish", "es");
    box.addItem("Swedish", "sv");
    box.addItem("Turkish", "tr");

    box.setSelectedIndex(findIndex(box, setting.getLanguage()));
    setNonEnglishText("en".equals(setting.getLanguage()));

    box.addChangeHandler(new ChangeHandler()
    {
        public void onChange(ChangeEvent event)
        {
            String value = box.getValue(box.getSelectedIndex());
            setting.setLanguage(value);
            setNonEnglishText("en".equals(value));
        }
    });

    box.setTitle("Language of text");

    return box;
}
 
Example 12
Source File: ConnectorOverview.java    From core with GNU Lesser General Public License v2.1 2 votes vote down vote up
Widget asWidget() {

        LayoutPanel layout = new LayoutPanel();

        VerticalPanel panel = new VerticalPanel();
        panel.setStyleName("rhs-content-panel");

        ScrollPanel scroll = new ScrollPanel(panel);
        layout.add(scroll);

        layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

        serverName = new HTML("Replace me");
        serverName.setStyleName("content-header-label");

        HorizontalPanel header = new HorizontalPanel();
        header.setStyleName("fill-layout-width");
        header.add(serverName);

        final DeckPanel deck = new DeckPanel();
        deck.addStyleName("fill-layout");

        final ListBox selector = new ListBox();

        selector.addItem("Type: Remote");
        selector.addItem("Type: In-VM");
        selector.addItem("Type: Generic");

        selector.addChangeHandler(changeEvent -> deck.showWidget(selector.getSelectedIndex()));

        header.add(selector);
        selector.getElement().getParentElement().setAttribute("align", "right");

        panel.add(header);
        panel.add(new ContentDescription(Console.CONSTANTS.jmsConnectorDescription()));

        genericConnectors = new ConnectorList(presenter, ConnectorType.GENERIC);
        remoteConnectors = new ConnectorList(presenter, ConnectorType.REMOTE);
        invmConnectors = new ConnectorList(presenter, ConnectorType.INVM);

        deck.add(remoteConnectors.asWidget());
        deck.add(invmConnectors.asWidget());
        deck.add(genericConnectors.asWidget());

        deck.showWidget(0);

        panel.add(deck);

        return layout;
    }
 
Example 13
Source File: AcceptorOverview.java    From core with GNU Lesser General Public License v2.1 2 votes vote down vote up
Widget asWidget() {
    LayoutPanel layout = new LayoutPanel();

    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("rhs-content-panel");

    ScrollPanel scroll = new ScrollPanel(panel);
    layout.add(scroll);

    layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

    serverName = new HTML(Console.CONSTANTS.replace_me());
    serverName.setStyleName("content-header-label");

    HorizontalPanel header = new HorizontalPanel();
    header.setStyleName("fill-layout-width");
    header.add(serverName);

    final DeckPanel deck = new DeckPanel();
    deck.addStyleName("fill-layout");

    final ListBox selector = new ListBox();

    selector.addItem("Type: Remote");
    selector.addItem("Type: In-VM");
    selector.addItem("Type: Generic");

    selector.addChangeHandler(changeEvent -> deck.showWidget(selector.getSelectedIndex()));

    header.add(selector);
    selector.getElement().getParentElement().setAttribute("align", "right");

    panel.add(header);
    panel.add(new ContentDescription(Console.CONSTANTS.hornetq_acceptor_type_desc()));

    genericAcceptors = new AcceptorList(presenter, AcceptorType.GENERIC);
    remoteAcceptors = new AcceptorList(presenter, AcceptorType.REMOTE);
    invmAcceptors = new AcceptorList(presenter, AcceptorType.INVM);

    deck.add(remoteAcceptors.asWidget());
    deck.add(invmAcceptors.asWidget());
    deck.add(genericAcceptors.asWidget());

    deck.showWidget(0);

    panel.add(deck);

    return layout;
}
 
Example 14
Source File: ConnectorOverview.java    From core with GNU Lesser General Public License v2.1 2 votes vote down vote up
Widget asWidget() {

        LayoutPanel layout = new LayoutPanel();

        VerticalPanel panel = new VerticalPanel();
        panel.setStyleName("rhs-content-panel");

        ScrollPanel scroll = new ScrollPanel(panel);
        layout.add(scroll);

        layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

        // ---

        serverName = new HTML("Replace me");
        serverName.setStyleName("content-header-label");


        HorizontalPanel header = new HorizontalPanel();
        header.setStyleName("fill-layout-width");
        header.add(serverName);

        // ----

        final DeckPanel deck = new DeckPanel();
        deck.addStyleName("fill-layout");

        final ListBox selector = new ListBox();

        selector.addItem("Type: Remote");
        selector.addItem("Type: In-VM");
        selector.addItem("Type: Generic");

        selector.addChangeHandler(new ChangeHandler() {
            @Override
            public void onChange(ChangeEvent changeEvent) {
                deck.showWidget(selector.getSelectedIndex());
            }
        });

        header.add(selector);
        selector.getElement().getParentElement().setAttribute("align", "right");


        panel.add(header);
        panel.add(new ContentDescription(Console.CONSTANTS.jmsConnectorDescription()));

        genericConnectors = new ConnectorList(presenter, ConnectorType.GENERIC);
        remoteConnectors = new ConnectorList(presenter, ConnectorType.REMOTE);
        invmConnectors = new ConnectorList(presenter, ConnectorType.INVM);

        deck.add(remoteConnectors.asWidget());
        deck.add(invmConnectors.asWidget());
        deck.add(genericConnectors.asWidget());

        deck.showWidget(0);

        panel.add(deck);

        return layout;
    }
 
Example 15
Source File: AcceptorOverview.java    From core with GNU Lesser General Public License v2.1 2 votes vote down vote up
Widget asWidget() {

        LayoutPanel layout = new LayoutPanel();

        VerticalPanel panel = new VerticalPanel();
        panel.setStyleName("rhs-content-panel");

        ScrollPanel scroll = new ScrollPanel(panel);
        layout.add(scroll);

        layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

        // ---

        serverName = new HTML(Console.CONSTANTS.replace_me());
        serverName.setStyleName("content-header-label");


        HorizontalPanel header = new HorizontalPanel();
        header.setStyleName("fill-layout-width");
        header.add(serverName);

        // ----

        final DeckPanel deck = new DeckPanel();
        deck.addStyleName("fill-layout");

        final ListBox selector = new ListBox();

        selector.addItem("Type: Remote");
        selector.addItem("Type: In-VM");
        selector.addItem("Type: Generic");

        selector.addChangeHandler(new ChangeHandler() {
            @Override
            public void onChange(ChangeEvent changeEvent) {
                deck.showWidget(selector.getSelectedIndex());
            }
        });

        header.add(selector);
        selector.getElement().getParentElement().setAttribute("align", "right");


        panel.add(header);
        panel.add(new ContentDescription(Console.CONSTANTS.hornetq_acceptor_type_desc()));

        genericAcceptors = new AcceptorList(presenter, AcceptorType.GENERIC);
        remoteAcceptors = new AcceptorList(presenter, AcceptorType.REMOTE);
        invmAcceptors = new AcceptorList(presenter, AcceptorType.INVM);

        deck.add(remoteAcceptors.asWidget());
        deck.add(invmAcceptors.asWidget());
        deck.add(genericAcceptors.asWidget());

        deck.showWidget(0);

        panel.add(deck);

        return layout;
    }