java类com.google.gwt.event.dom.client.ChangeHandler的实例源码

FontSelectorPanelUI.java 文件源码 项目:x-cure-chat 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Initializes the list box that allows to select styles
 * @param listBox the list box to initialize
 * @param dataToName the mapping from the style ID to the human readable name of the style
 * @param dataToStyleName the mapping from the style ID to the CSS style name
 * @param defaultValue the default style ID that should be set as selected
 */
public void initializeListBox( final ListBox listBox, final Map<Integer, String> dataToName,
                               final Map<Integer, String> dataToStyleName, final int defaultValue) {
    //Initialize the list box with data
    Iterator< Entry<Integer,String> > entrySetIter = dataToName.entrySet().iterator();
    while( entrySetIter.hasNext() ) {
        Entry<Integer, String> entry = entrySetIter.next();
        listBox.addItem( entry.getValue(), dataToStyleName.get( entry.getKey() ) );
    }
    listBox.setVisibleItemCount( 1 );

    //Set the default value as being selected
    setListBoxStyleID( listBox, defaultValue, dataToStyleName );

    //Add the change listener
    listBox.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent e) {
            //Update the sample view
            updateSampleViewStyles();
        }
    });
}
ReportingView.java 文件源码 项目:ephesoft 阅读 22 收藏 0 点赞 0 评论 0
private final void addIntervalChangeHandler() {
    intervalListBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            String divisor = intervalListBox.getValue(intervalListBox.getSelectedIndex());
            String headerName = getSelectedRadioValue();
            if (!(headerName.equalsIgnoreCase(ReportingConstants.MODULE) || headerName.equalsIgnoreCase(ReportingConstants.PLUGIN))) {
                headerName = ReportingConstants.MODULE;
            }
            List<Record> recordList = createTableData(reportList, Integer.parseInt(divisor));
            reportingListView.updateHeaders(headerName, intervalListBox.getItemText(intervalListBox.getSelectedIndex()));
            reportingListView.listView.updateRecords(recordList, presenter.getStartIndex(), presenter.getTotalCount());
        }
    });
}
FolderSelectionWidget.java 文件源码 项目:ephesoft 阅读 20 收藏 0 点赞 0 评论 0
public FolderSelectionWidget(final Map<String, String> batchClassesNameMap, final HandlerManager eventBus) {
    super();
    initWidget(BINDER.createAndBindUi(this));
    mainPanel.addStyleName(FolderManagementConstants.OPTIONS_BOX);
    batchClassSelectionListBox.setWidth(_150PX);
    batchClassSelectionListBox.addStyleName(FolderManagementConstants.CUSTOM_LIST_BOX);
    if (null != batchClassesNameMap && !batchClassesNameMap.isEmpty()) {
        Set<Entry<String, String>> entrySet = batchClassesNameMap.entrySet();
        for (Entry<String, String> entry : entrySet) {
            batchClassSelectionListBox.addItem(entry.getKey());
        }
        fireEventForFolderSelection(batchClassesNameMap, eventBus);
        batchClassSelectionListBox.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                fireEventForFolderSelection(batchClassesNameMap, eventBus);
            }
        });
    } else {
        eventBus.fireEvent(new BatchClassChangeEvent());
    }
}
TableSelectorWidget.java 文件源码 项目:teiid-webui 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Called after construction.
 */
@PostConstruct
protected void postConstruct() {
    sourceTablesTable.clear();

    // Change Listener for Available sources ListBox
    listboxSources.addChangeHandler(new ChangeHandler()
    {
        // Changing the updates status
        public void onChange(ChangeEvent event)
        {
            sourceTablesTable.clear();
            String srcName = getSelectedSource();
            if (srcName != null) {
                doGetTablesAndProcs(srcName);
            }
        }
    });

    sourceTablesTable.setOwner(this.getClass().getName());
    sourceTablesTable.setShowHeader(false);
}
EnumListBox.java 文件源码 项目:listmaker 阅读 19 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler)
{
    // Initialization code
    if (!valueChangeHandlerInitialized)
    {
        valueChangeHandlerInitialized = true;
        super.addChangeHandler(new ChangeHandler()
        {
            public void onChange(ChangeEvent event)
            {
                ValueChangeEvent.fire(EnumListBox.this, getValue());
            }
        });
    }
    return addHandler(handler, ValueChangeEvent.getType());
}
SelectOneListBox.java 文件源码 项目:listmaker 阅读 22 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler)
{
    // Initialization code
    if (!valueChangeHandlerInitialized)
    {
        valueChangeHandlerInitialized = true;
        super.addChangeHandler(new ChangeHandler()
        {
            public void onChange(ChangeEvent event)
            {
                ValueChangeEvent.fire(SelectOneListBox.this, getValue());
            }
        });
    }
    return addHandler(handler, ValueChangeEvent.getType());
}
ShiftsLimitTextBox.java 文件源码 项目:shifts-solver 阅读 23 收藏 0 点赞 0 评论 0
public ShiftsLimitTextBox(final RiaContext ctx, final EmployeePreferences employeePreferences) {
    shiftLimit=employeePreferences.getShiftsLimit();

    setStyleName("s2-preferencesJobsTextBox");
    setTitle(ctx.getI18n().job());
    setText(""+shiftLimit);

    addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            try {
                shiftLimit=(Integer.parseInt(getText()));
                ctx.getStatusLine().showInfo("Shift limit set to "+getText()); // TODO i18n
            } catch(Exception e) {
                ctx.getStatusLine().showError(getText()+" is not valid shift limit number"); // TODO i18n
            }
        }
    });
}
OrionEditorWidget.java 文件源码 项目:che 阅读 26 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addChangeHandler(final ChangeHandler handler) {
  if (!changeHandlerAdded) {
    changeHandlerAdded = true;
    final OrionTextViewOverlay textView = this.editorOverlay.getTextView();
    textView.addEventListener(
        OrionEventConstants.MODEL_CHANGED_EVENT,
        new OrionTextViewOverlay.EventHandlerNoParameter() {

          @Override
          public void onEvent() {
            fireChangeEvent();
          }
        });
  }
  return addHandler(handler, ChangeEvent.getType());
}
CatddPanel.java 文件源码 项目:firefly 阅读 19 收藏 0 点赞 0 评论 0
private ListBox createListBox() {
    List<EnumFieldDef.Item> listItems = new ArrayList<EnumFieldDef.Item>();
    listItems.add(new EnumFieldDef.Item("short", "Short Form"));
    listItems.add(new EnumFieldDef.Item("long", "Long Form"));
    EnumFieldDef list = new EnumFieldDef("Lists");
    list.addItems(listItems);
    list.setNullAllow(false);
    list.setErrMsg("This field is required. Select one from list");
    lists = GwtUtil.createComboBox(list);
    lists.addChangeHandler((new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            formToSelect = lists.getValue(lists.getSelectedIndex());
            changePanel(formToSelect);
        }
    }));


    return lists;
}
CatddEnhancedPanel.java 文件源码 项目:firefly 阅读 20 收藏 0 点赞 0 评论 0
private ListBox createListBox() {
    List<EnumFieldDef.Item> listItems = new ArrayList<EnumFieldDef.Item>();
    listItems.add(new EnumFieldDef.Item("short", "Short Form"));
    listItems.add(new EnumFieldDef.Item("long", "Long Form"));
    EnumFieldDef list = new EnumFieldDef("Lists");
    list.addItems(listItems);
    list.setNullAllow(false);
    list.setErrMsg("This field is required. Select one from list");
    lists = GwtUtil.createComboBox(list);
    lists.addChangeHandler((new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            formToSelect = lists.getValue(lists.getSelectedIndex());
            changePanel(formToSelect);
        }
    }));


    return lists;
}
ListBoxInputField.java 文件源码 项目:firefly 阅读 20 收藏 0 点赞 0 评论 0
public ListBoxInputField(EnumFieldDef fieldDef) {
    _fieldDef= fieldDef;
    initWidget(_listBox);

    //list box setup
    _items= ((EnumFieldDef)_fieldDef).getEnumValues();
    for(EnumFieldDef.Item item : _items) {
        _listBox.addItem(item.getTitle());
    }
    _listBox.setTitle(_fieldDef.getShortDesc());
    reset();

    _listBox.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            _selectedIdx= _listBox.getSelectedIndex();
            ValueChangeEvent.fire(ListBoxInputField.this,_selectedIdx+"");
            updatePref();
        }
    });

   // label setup
}
DownloadBox.java 文件源码 项目:gerrit 阅读 20 收藏 0 点赞 0 评论 0
DownloadBox(ChangeInfo change, String revision, PatchSet.Id psId) {
  this.change = change;
  this.revision = revision;
  this.psId = psId;
  this.commandTable = new FlexTable();
  this.scheme = new ListBox();
  this.scheme.addChangeHandler(
      new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
          renderCommands();
          if (Gerrit.isSignedIn()) {
            saveScheme();
          }
        }
      });

  setStyleName(Gerrit.RESOURCES.css().downloadBox());
  commandTable.setStyleName(Gerrit.RESOURCES.css().downloadBoxTable());
  scheme.setStyleName(Gerrit.RESOURCES.css().downloadBoxScheme());
  add(commandTable);
}
ComboField.java 文件源码 项目:appformer 阅读 25 收藏 0 点赞 0 评论 0
private void addChangeHandler(final PropertyEditorFieldInfo property,
                              final PropertyEditorComboBox listBox) {
    listBox.addChangeHandler(new ChangeHandler() {
                                 @Override
                                 public void onChange(ChangeEvent event) {
                                     int selectedIndex = listBox.getSelectedIndex();
                                     if (validate(property,
                                                  listBox.getItemText(selectedIndex))) {
                                         listBox.clearOldValidationErrors();
                                         property.setCurrentStringValue(listBox.getItemText(selectedIndex));
                                         propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property,
                                                                                                           listBox.getItemText(selectedIndex)));
                                     } else {
                                         listBox.setValidationError(getValidatorErrorMessage(property,
                                                                                             listBox.getItemText(selectedIndex)));
                                         listBox.setSelectItemByText(property.getCurrentStringValue());
                                     }
                                 }
                             }

    );
}
FileInputButton.java 文件源码 项目:appformer 阅读 24 收藏 0 点赞 0 评论 0
public FileInputButton() {
    wrapper = new Span();
    wrapper.addStyleName(Styles.BTN);
    upload = new FileUpload();

    upload.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            fireChanged();
        }
    });

    wrapper.add(upload);
    wrapper.addStyleName("btn-file");
    initWidget(wrapper);
}
WiresGridsDemoPresenter.java 文件源码 项目:appformer 阅读 21 收藏 0 点赞 0 评论 0
private void setupZoomChangeHandler() {
    view.addZoomChangeHandler(new ChangeHandler() {

        private int m_currentZoom = 100;

        @Override
        public void onChange(final ChangeEvent event) {
            final int pct = view.getSelectedZoomLevel();
            if (m_currentZoom == pct) {
                return;
            }
            m_currentZoom = pct;
            view.setZoom(pct);
        }
    });
}
RepositoryConfigurationViewImpl.java 文件源码 项目:appformer 阅读 21 收藏 0 点赞 0 评论 0
@Override
public void init(final RepositoryConfigurationPresenter presenter) {
    this.presenter = presenter;

    configureButton.setText(constants.Configure_Repository());
    sourceBranchText.setText("master");
    devBranchText.setText("dev");
    releaseBranchText.setText("release");
    currentVersionText.setReadOnly(true);
    chooseRepositoryBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            String value = chooseRepositoryBox.getSelectedValue();
            GWT.log(value);

            presenter.loadRepositoryStructure(value);
        }
    });
    presenter.loadRepositories();
}
StyledListBox.java 文件源码 项目:platypus-js 阅读 25 收藏 0 点赞 0 评论 0
public StyledListBox(boolean isMultipleSelect) {
    super();
    setStyleName("form-control");
    setMultipleSelect(isMultipleSelect);
    addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            if (!isMultipleSelect()) {
                int selected = getSelectedIndex();
                if (selected == -1) {
                    setValue(null, true);
                } else {
                    setValue(associatedValues.get(selected), true);
                }
            }
        }

    });
}
CodeMirrorEditorWidget.java 文件源码 项目:plugin-editor-codemirror 阅读 19 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addChangeHandler(final ChangeHandler handler) {
    if (!changeHandlerAdded) {
        changeHandlerAdded = true;
        this.codeMirror.on(this.editorOverlay, CHANGE, new EventHandlers.EventHandlerOneParameter<CMChangeEventOverlay>() {

            @Override
            public void onEvent(final CMChangeEventOverlay param) {
                LOG.fine("Change event - state clean=" + editorOverlay.getDoc().isClean(getGenerationMarker())
                         + " (generation=" + getGenerationMarker() + ").");
                fireChangeEvent();
            }
        });
    }
    return addHandler(handler, ChangeEvent.getType());
}
DataRequestViewImpl.java 文件源码 项目:test-analytics-ng 阅读 19 收藏 0 点赞 0 评论 0
private DataRequestParameterWidget createRequestWidget(String name, String value) {
  final DataRequestParameterWidget param;
  if (parameterKeyConstraint != null) {
    param = new ConstrainedParameterWidget(parameterKeyConstraint, name, value);
  } else {
    param = new CustomParameterWidget(name, value);
  }
  param.addChangeHandler(new ChangeHandler() {
      @Override
      public void onChange(ChangeEvent arg0) {
        Widget w = (Widget) param;
        dataRequestParameters.remove(w);
      }
    });
  return param;
}
QuickNPCEditor.java 文件源码 项目:iambookmaster 阅读 19 收藏 0 点赞 0 评论 0
@Override
public Widget getTail() {
    ChangeHandler changeHandler = new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            npc.setGenitiveName(genitiveName.getText());
            updateParameter(event.getSource());
        }
    };
    genitiveName = new TextBox();
    genitiveName.setWidth("100%");
    genitiveName.addChangeHandler(changeHandler);
    genitiveName.setTitle(appConstants.quickNPCGenativeNameTitle());
    addWidgetToGrid(genitiveName, appConstants.quickNPCGenativeName());

    parametersPanel = new FlexTable();
    parametersPanel.setSize("100%", "100%");
    parametersPanel.getColumnFormatter().setWidth(0, "99%");
    parametersPanel.getColumnFormatter().setWidth(1, "1%");
    return parametersPanel;
}
ParametersCalculationWidget.java 文件源码 项目:iambookmaster 阅读 19 收藏 0 点赞 0 评论 0
public void apply(ParametersCalculation calc) {
        flowPanel.clear();
        this.calculation = calc;
        SpanLabel label = new SpanLabel(name+" = ");
        label.setStyleName(Styles.BOLD);
        flowPanel.add(label);
        constant = new DiceValueWidget(flowPanel);
        constant.apply(calculation.getConstant());
        constant.addChangeHandler(new ChangeHandler(){
            public void onChange(ChangeEvent event) {
                for (ChangeHandler handler : handlers) {
                    handler.onChange(null);
                }
            }
        });
        if (overflowControl != null) {
            overflowControl.setValue(calc.isOverflowControl());
        }
//      add(constant);
        //parameters
        for (Parameter parameter : calculation.getParameters().keySet()) {
            addParameterToPanel(parameter);
        }
    }
SettingsPanel.java 文件源码 项目:swcv 阅读 30 收藏 0 点赞 0 评论 0
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;
}
SettingsPanel.java 文件源码 项目:swcv 阅读 32 收藏 0 点赞 0 评论 0
private Widget createLayoutListBox()
{
    final GroupedListBox box = new GroupedListBox();
    for (WCLayoutAlgo algo : WCLayoutAlgoRegistry.list())
        box.addItem(algo.getType() + " | " + algo.getDescription(), algo.getId());

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

    box.addChangeHandler(new ChangeHandler()
    {
        public void onChange(ChangeEvent event)
        {
            WCLayoutAlgo value = WCLayoutAlgoRegistry.getById(box.getValue(box.getSelectedIndex()));
            setting.setLayoutAlgorithm(value);
        }
    });

    box.setTitle("Layout method for the word cloud");
    return box;
}
SettingsPanel.java 文件源码 项目:swcv 阅读 33 收藏 0 点赞 0 评论 0
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;
}
SettingsPanel.java 文件源码 项目:swcv 阅读 32 收藏 0 点赞 0 评论 0
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;
}
SettingsPanel.java 文件源码 项目:swcv 阅读 37 收藏 0 点赞 0 评论 0
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;
}
SettingsPanel.java 文件源码 项目:swcv 阅读 29 收藏 0 点赞 0 评论 0
private Widget createColorListBox()
{
    final GroupedListBox box = new GroupedListBox();
    for (WCColorScheme scheme : WCColorSchemeRegistry.list())
        box.addItem(scheme.getType() + " | " + scheme.getDescription(), scheme.getName());

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

    box.addChangeHandler(new ChangeHandler()
    {
        public void onChange(ChangeEvent event)
        {
            WCColorScheme value = WCColorSchemeRegistry.getByName(box.getValue(box.getSelectedIndex()));
            setting.setColorScheme(value);
        }
    });

    box.setTitle("Color theme of the words");
    return box;
}
SettingsPanel.java 文件源码 项目:swcv 阅读 34 收藏 0 点赞 0 评论 0
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;
}
SettingsPanel.java 文件源码 项目:swcv 阅读 29 收藏 0 点赞 0 评论 0
private Widget createMinLengthField()
{
    final IntegerBox box = new IntegerBox();
    box.setValue(setting.getMinWordLength());
    box.setMaxLength(2);
    box.setWidth("15px");

    box.addChangeHandler(new ChangeHandler()
    {
        @Override
        public void onChange(ChangeEvent event)
        {
            setting.setMinWordLength(box.getValue());
        }
    });

    box.setTitle("Specify the minimum number of characters in a word");
    return box;
}
Application.java 文件源码 项目:hexa.tools 阅读 25 收藏 0 点赞 0 评论 0
@Override
public void onModuleLoad()
{
    MyCss css = GWT.create( MyCss.class );

    final ListBox listBox = new ListBox();
    listBox.addItem( "theme-1" );
    listBox.addItem( "theme-2" );
    listBox.addItem( "theme-3" );
    listBox.addChangeHandler( new ChangeHandler()
    {
        @Override
        public void onChange( ChangeEvent event )
        {
            ThemeManager.get().setTheme( listBox.getSelectedValue() );
        }
    } );

    Label label = new Label("This is the application, you can change theme with the list box above");
    label.addStyleName( css.panel() );

    RootPanel.get().add( listBox );
    RootPanel.get().add( label );
}


问题


面经


文章

微信
公众号

扫码关注公众号