Java Code Examples for com.google.gwt.event.dom.client.ChangeHandler

The following are top voted examples for showing how to use com.google.gwt.event.dom.client.ChangeHandler. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: appformer   File: FileInputButton.java   Source Code and License 7 votes vote down vote up
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);
}
 
Example 2
Project: x-cure-chat   File: FontSelectorPanelUI.java   Source Code and License 6 votes vote down vote up
/**
 * 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();
		}
	});
}
 
Example 3
Project: ephesoft   File: ReportingView.java   Source Code and License 6 votes vote down vote up
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());
		}
	});
}
 
Example 4
Project: ephesoft   File: FolderSelectionWidget.java   Source Code and License 6 votes vote down vote up
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());
	}
}
 
Example 5
Project: teiid-webui   File: TableSelectorWidget.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 6
Project: listmaker   File: EnumListBox.java   Source Code and License 6 votes vote down vote up
@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());
}
 
Example 7
Project: listmaker   File: SelectOneListBox.java   Source Code and License 6 votes vote down vote up
@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());
}
 
Example 8
Project: shifts-solver   File: ShiftsLimitTextBox.java   Source Code and License 6 votes vote down vote up
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
			}
		}
	});
}
 
Example 9
Project: che   File: OrionEditorWidget.java   Source Code and License 6 votes vote down vote up
@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());
}
 
Example 10
Project: firefly   File: CatddPanel.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 11
Project: firefly   File: CatddEnhancedPanel.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 12
Project: firefly   File: ListBoxInputField.java   Source Code and License 6 votes vote down vote up
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
}
 
Example 13
Project: gerrit   File: DownloadBox.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 14
Project: appformer   File: ComboField.java   Source Code and License 6 votes vote down vote up
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());
                                     }
                                 }
                             }

    );
}
 
Example 15
Project: appformer   File: WiresGridsDemoPresenter.java   Source Code and License 6 votes vote down vote up
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);
        }
    });
}
 
Example 16
Project: appformer   File: RepositoryConfigurationViewImpl.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 17
Project: platypus-js   File: JsUi.java   Source Code and License 6 votes vote down vote up
public static void selectFile(final Callback<JavaScriptObject, String> aCallback, String aFileTypes) {
	final FileUpload fu = new FileUpload();
	fu.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
	fu.setWidth("10px");
	fu.setHeight("10px");
	fu.getElement().getStyle().setLeft(-100, Style.Unit.PX);
	fu.getElement().getStyle().setTop(-100, Style.Unit.PX);
	fu.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			Utils.JsObject jsFu = fu.getElement().cast();
			JavaScriptObject oFiles = jsFu.getJs("files");
			if (oFiles != null) {
				JsArray<JavaScriptObject> jsFiles = oFiles.cast();
				for (int i = 0; i < jsFiles.length(); i++) {
					try {
						aCallback.onSuccess(jsFiles.get(i));
					} catch (Exception ex) {
						Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex);
					}
				}
			}
			fu.removeFromParent();
		}
	});
	RootPanel.get().add(fu, -100, -100);
	fu.click();
	Scheduler.get().scheduleFixedDelay(new Scheduler.RepeatingCommand() {
		@Override
		public boolean execute() {
			fu.removeFromParent();
			return false;
		}
	}, 1000 * 60 * 1);// 1 min
}
 
Example 18
Project: platypus-js   File: StyledListBox.java   Source Code and License 6 votes vote down vote up
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);
				}
			}
		}

	});
}
 
Example 19
Project: plugin-editor-codemirror   File: CodeMirrorEditorWidget.java   Source Code and License 6 votes vote down vote up
@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());
}
 
Example 20
Project: test-analytics-ng   File: DataRequestViewImpl.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 21
Project: iambookmaster   File: QuickNPCEditor.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 22
Project: iambookmaster   File: ParametersCalculationWidget.java   Source Code and License 6 votes vote down vote up
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);
		}
	}
 
Example 23
Project: swcv   File: SettingsPanel.java   Source Code and 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 24
Project: swcv   File: SettingsPanel.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 25
Project: swcv   File: SettingsPanel.java   Source Code and 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 26
Project: swcv   File: SettingsPanel.java   Source Code and 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 27
Project: swcv   File: SettingsPanel.java   Source Code and 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 28
Project: swcv   File: SettingsPanel.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 29
Project: swcv   File: SettingsPanel.java   Source Code and 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 30
Project: swcv   File: SettingsPanel.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 31
Project: hexa.tools   File: Application.java   Source Code and License 6 votes vote down vote up
@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 );
}
 
Example 32
Project: hexa.tools   File: ListBox.java   Source Code and License 6 votes vote down vote up
@Override
public HandlerRegistration addValueChangeHandler( ValueChangeHandler<T> handler )
{
	if( !registered )
	{
		registered = true;
		list.addChangeHandler( new ChangeHandler()
		{
			@Override
			public void onChange( ChangeEvent event )
			{
				ValueChangeEvent.fire( ListBox.this, getValue() );
			}
		} );
	}
	return addHandler( handler, ValueChangeEvent.getType() );
}
 
Example 33
Project: rva   File: DefaultResolutionWidget.java   Source Code and License 6 votes vote down vote up
private void initResolutionDropdown() {
	defaultResolutions.addItem("Custom", "");
	defaultResolutions.addItem("1280 x 720 (wide)", "1280x720");
	defaultResolutions.addItem("1280 x 768 (wide)", "1280x768");
	defaultResolutions.addItem("1360 x 768 (wide)", "1360x768");
	defaultResolutions.addItem("1366 x 768 (wide)", "1366x768");
	defaultResolutions.addItem("1440 x 900 (wide)", "1440x900");
	defaultResolutions.addItem("1680 x 1050 (wide)", "1680x1050");
	defaultResolutions.addItem("1920 x 1080 (wide)", "1920x1080");
	defaultResolutions.addItem("1024 x 768", "1024x768");
	defaultResolutions.addItem("1280 x 1024", "1280x1024");
	defaultResolutions.addItem("1600 x 1200", "1600x1200");
	defaultResolutions.addItem("720 x 1280 (portrait)", "720x1280");
       defaultResolutions.addItem("768 x 1280 (portrait)", "768x1280");
	defaultResolutions.addItem("768 x 1360 (portrait)", "768x1360");
	defaultResolutions.addItem("768 x 1366 (portrait)", "768x1366");
	defaultResolutions.addItem("1080 x 1920 (portrait)", "1080x1920");
	
	defaultResolutions.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			selectedValueChanged();
		}
	});
}
 
Example 34
Project: kaa   File: MultiValueListBox.java   Source Code and License 6 votes vote down vote up
/**
 * Instantiates a new MultiValueListBox.
 */
public MultiValueListBox(Renderer<T> renderer, ProvidesKey<T> keyProvider) {
  this.keyProvider = keyProvider;
  this.renderer = renderer;
  ListBox listBox = new ListBox();
  listBox.setMultipleSelect(true);
  initWidget(listBox);
  getListBox().addChangeHandler(new ChangeHandler() {
    public void onChange(ChangeEvent event) {
      List<T> newValue = new ArrayList<>();
      for (int i = 0; i < values.size(); i++) {
        if (getListBox().isItemSelected(i)) {
          newValue.add(values.get(i));
        }
      }
      setValue(newValue, true);
    }
  });
}
 
Example 35
Project: RedQueryBuilder   File: ValueMultiListBox.java   Source Code and License 6 votes vote down vote up
public ValueMultiListBox(Renderer<T> renderer2, ProvidesKey<T> keyProvider2) {
    this.keyProvider = keyProvider2;
    this.renderer = renderer2;
    initWidget(new ListBox(true));
    getListBox().setVisibleItemCount(2);

    getListBox().addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            ListBox lb = getListBox();
            Collection<T> newValue = new ArrayList<T>();
            for (int i = 0; i < values.size(); i++) {
                if (lb.isItemSelected(i)) {
                    newValue.add(values.get(i));
                }
            }

            setValue(newValue, true);
        }
    });
}
 
Example 36
Project: RedQueryBuilder   File: GwtTestDom.java   Source Code and License 6 votes vote down vote up
@Test
public void testTextBox() throws Exception {
    TextBox tb = new TextBox();
    RootPanel.get().add(tb);
    final List events = new ArrayList();
    tb.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            events.add(event);
        }
    });

    DomEvent.fireNativeEvent(Document.get().createChangeEvent(), tb);

    assertEquals(1, events.size());
}
 
Example 37
Project: gwtbootstrap3   File: FormLabel.java   Source Code and License 6 votes vote down vote up
/**
 * Constructor.
 */
public FormLabel() {
    super(Document.get().createLabelElement());
    setStyleName(Styles.CONTROL_LABEL);
    addHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            if (iconElement != null) {
                iconElement.removeFromParent();
            }
            String html = getHTML();
            if (showRequiredIndicator && html != null && !"".equals(html)) {
                iconElement = createIconElement();
                getElement().appendChild(iconElement);
            }
        }
    }, ChangeEvent.getType());
}
 
Example 38
Project: gwtbootstrap3   File: HelpBlock.java   Source Code and License 6 votes vote down vote up
/**
 * Constructor.
 */
public HelpBlock() {
    super(Document.get().createSpanElement());
    setStyleName(Styles.HELP_BLOCK);
    addHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            if (iconElement != null) {
                iconElement.removeFromParent();
            }
            if (error && iconType != null) {
                iconElement = createIconElement();
                getElement().insertFirst(iconElement);
            }
        }
    }, ChangeEvent.getType());
}
 
Example 39
Project: PortlandStateJava   File: DeckPanelExample.java   Source Code and License 6 votes vote down vote up
public DeckPanelExample() {
  super("Deck Panel");

  DockPanel dock = new DockPanel();
  final DeckPanel deck = new DeckPanel();
  final ListBox list = new ListBox();
  list.addChangeHandler(new ChangeHandler() {
      public void onChange( ChangeEvent changeEvent )
      {
          int index = list.getSelectedIndex();
          deck.showWidget(index);
      }
  });

  for (String label : new String[] { "One", "Two", "Three", "Four"}) {
    list.addItem(label);
    deck.add(new Button(label));
  }
  deck.showWidget(0);

  dock.add(list, DockPanel.NORTH);
  dock.add(deck, DockPanel.CENTER);
  add(dock);
}
 
Example 40
Project: drools-wb   File: GuidedScoreCardEditor.java   Source Code and License 6 votes vote down vote up
private ListBox booleanEditor(final String currentValue) {
    final ListBox listBox = listBoxEditor(booleanOperators,
                                          currentValue,
                                          false);
    listBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(final ChangeEvent event) {
            final int selectedIndex = listBox.getSelectedIndex();
            final String selectedValue = listBox.getItemText(selectedIndex);
            final boolean enabled = "true".equalsIgnoreCase(selectedValue);
            ddReasonCodeAlgorithm.setEnabled(enabled);
            tbBaselineScore.setEnabled(enabled);
            ddReasonCodeField.setEnabled(enabled);
            for (final FlexTable cGrid : characteristicsTables) {
                //baseline score for each characteristic
                ((TextBox) cGrid.getWidget(2, 2)).setEnabled(enabled);
                //reason code for each characteristic
                ((TextBox) cGrid.getWidget(2, 3)).setEnabled(enabled);
            }
        }
    });
    return listBox;
}
 
Example 41
Project: drools-wb   File: DSLSentenceWidget.java   Source Code and License 6 votes vote down vote up
public FieldEditor() {
    box = new TextBox();
    box.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            TextBox otherBox = (TextBox) event.getSource();

            if (!regex.equals("") && !otherBox.getText().matches(regex)) {
                Window.alert(GuidedRuleEditorResources.CONSTANTS.TheValue0IsNotValidForThisField(otherBox.getText()));
                box.setText(oldValue);
            } else {
                oldValue = otherBox.getText();
                updateSentence();
            }
        }
    });

    //Wrap widget within a HorizontalPanel to add a space before and after the Widget
    HorizontalPanel hp = new HorizontalPanel();
    hp.add(new HTML("&nbsp;"));
    hp.add(box);
    hp.add(new HTML("&nbsp;"));

    initWidget(hp);
}
 
Example 42
Project: kie-wb-common   File: AddImportPopup.java   Source Code and License 6 votes vote down vote up
public AddImportPopup() {
    setTitle(ImportConstants.INSTANCE.addImportPopupTitle());

    add(new ModalBody() {{
        add(uiBinder.createAndBindUi(AddImportPopup.this));
    }});
    add(footer);

    importTypeListBox.getElement().getStyle().setWidth(100.0,
                                                       Style.Unit.PCT);
    importTypeListBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            final boolean enable = importTypeListBox.getSelectedIndex() > 0;
            footer.enableOkButton(enable);
        }
    });
}
 
Example 43
Project: plugin-datasource   File: UploadSslTrustCertDialogViewImpl.java   Source Code and License 6 votes vote down vote up
@Override
public void showDialog() {
    uploadFormVPanel.clear();
    certFile = new FileUpload();
    certFile.setHeight("22px");
    certFile.setWidth("100%");
    certFile.setName("certFile");
    certFile.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            delegate.onFileNameChanged();
        }
    });
    uploadFormVPanel.add(certFile);

    this.show();
}
 
Example 44
Project: jcommerce   File: AttributePanel.java   Source Code and License 6 votes vote down vote up
private void init() {
    lstTypes.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent arg0) {
            updateType(lstTypes);
        }
    });

    new ListService().listBeans(ModelNames.GOODSTYPE, new ListService.Listener() {
        public void onSuccess(List<BeanObject> beans) {
            for (BeanObject obj : beans) {
                String id = obj.getString(IGoodsType.ID);
                lstTypes.addItem(obj.getString(IGoodsType.NAME), id);
                types.put(id, obj);
            }
            
            updateType(lstTypes);
        }
    });
    add(lstTypes);
    add(contentPanel);              
}
 
Example 45
Project: EasyML   File: ETLPopPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Init etl program widget' right grid panel
 */
public void init_rightGrid(){
	Label table = new Label("table");
	Label column = new Label("column");
	Label format = new Label("format");
	rightGrid = new Grid(3,2);
	rightGrid.setWidget(1,0,table);
	tableLB = new DescListBox();
	tableLB.setVisibleItemCount(1);
	tableLB.setStyleName("bda-etlpanel-listbox");
	rightGrid.setWidget(1,1,tableLB);

	rightGrid.setWidget(2,0,column);
	columnLB = new DescListBox();
	columnLB.setMultipleSelect(true);
	columnLB.setVisibleItemCount(2);
	columnLB.setStyleName("bda-etlpanel-Multilistbox");
	rightGrid.setWidget(2,1,columnLB);

	rightGrid.setWidget(0,0,format);
	formatLB = new DescListBox();
	formatLB.addItem("json");
	formatLB.addItem("tsv");
	formatLB.addItem("csv");
	formatLB.addItem("parquet");
	formatLB.setVisibleItemCount(1);
	formatLB.setStyleName("bda-etlpanel-listbox");
	rightGrid.setWidget(0,1,formatLB);
	mid_westPanel.add(rightGrid);

	tableLB.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent changeEvent) {
			getColumn();
		}
	});
}
 
Example 46
Project: unitimes   File: ClassificationsEdit.java   Source Code and License 5 votes vote down vote up
public MyCell(CurriculumInterface curriculum, CurriculumClassificationInterface classification) {
	iCurriculum	= curriculum;
	iClasf = classification;
	
	iPanel = new HorizontalPanel();
	
	iTextBox = new UniTimeTextBox(6, ValueBoxBase.TextAlignment.RIGHT);
	iTextBox.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			try {
				if (iTextBox.getText().isEmpty()) {
					iClasf.setExpected(null);
				} else {
					iClasf.setExpected(Integer.valueOf(iTextBox.getText()));
				}
			} catch (Exception e) {
				iClasf.setExpected(null);
			}
			update();
			for (MySumCell sum: iSums)
				sum.update();
		}
	});
	
	iRearLabel = new HTML("", false);
	iRearLabel.setWidth("50px");
	iRearLabel.setStyleName("unitime-Label");
	iRearLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	
	iPanel.add(iTextBox);
	iPanel.setCellVerticalAlignment(iTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
	
	iPanel.add(iRearLabel);
	iPanel.setCellVerticalAlignment(iRearLabel, HasVerticalAlignment.ALIGN_MIDDLE);

	initWidget(iPanel);	
	
	update();
}
 
Example 47
Project: unitimes   File: CurriculaCourses.java   Source Code and License 5 votes vote down vote up
public ShareTextBox(int column, Float share, Float defaultShare) {
	super(6, ValueBoxBase.TextAlignment.RIGHT);
	iColumn = column;
	iShare = share;
	iDefaultShare = defaultShare;
	addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			try {
				if (getText().isEmpty()) {
					iShare = null;
				} else if (getText().endsWith("%")) {
					iShare = (float)NF.parse(getText().substring(0, getText().length() - 1)) / 100.0f;
					if (iShare > 1.0f) iShare = 1.0f;
					if (iShare <= 0.0f) iShare = 0.0f;
				} else {
					Integer exp = iClassifications.getExpected(iColumn);
					if (exp == null || exp == 0)
						iShare = (float)NF.parse(getText()) / 100.0f;
					else
						iShare = (float)NF.parse(getText()) / iClassifications.getExpected(iColumn);
					if (iShare > 1.0f) iShare = 1.0f;
					if (iShare < 0.0f) iShare = 0.0f;
				}
			} catch (Exception e) {
				iShare = null;
			}
			update();
		}
	});
	update();
}
 
Example 48
Project: sig-seguimiento-vehiculos   File: GeoDataImportDialog.java   Source Code and License 5 votes vote down vote up
private FormPanel getFilePanel() {
	VerticalLayoutContainer layoutContainer = new VerticalLayoutContainer();

	file = new FileUploadField();

	file.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			setAutoFormat(file.getValue());
			String name = file.getValue().substring(0, file.getValue().lastIndexOf("."));
			name = name.substring(file.getValue().lastIndexOf("\\") +1);
			layerName.setText(name);
		}
	});

	file.setName(UIMessages.INSTANCE.gdidFileUploadFieldText());
	file.setAllowBlank(false);

	layoutContainer.add(new FieldLabel(file, UIMessages.INSTANCE.file()),
			new VerticalLayoutData(-18, -1));
	layoutContainer.add(new Label(UIMessages.INSTANCE.maxFileSizeText()),
			new VerticalLayoutData(-18, -1));

	uploadPanel = new FormPanel();
	uploadPanel.setMethod(Method.POST);
	uploadPanel.setEncoding(Encoding.MULTIPART);
	uploadPanel.setAction("fileupload.do");
	uploadPanel.setWidget(layoutContainer);

	return uploadPanel;
}
 
Example 49
Project: appinventor-extensions   File: TemplateUploadWizard.java   Source Code and License 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 50
Project: LAS   File: AnalysisWidget.java   Source Code and License 5 votes vote down vote up
public AnalysisWidget(String width) {

        mainPanel.setTitle("Select a statistic to compute and the space and time dimensions over which to compute it");
        layoutPanel.resize(2, 2);
        layoutPanel.setTitle("Optional Analysis Controls");
        // layoutPanel.setWidget(0, 0, apply);
        layoutPanel.setWidget(0, 0, new Label("Compute:"));
        analysisType.addChangeHandler(new ChangeHandler() {
            @Override
            public void onChange(ChangeEvent event) {
                fireAnalysisTypeChangeEvent(event);
                eventBus.fireEventFromSource(new WidgetSelectionChangeEvent(false, false), AnalysisWidget.this);
            }
        });
        analysisAxis.addChangeHandler(new ChangeHandler(){@Override
            public void onChange(ChangeEvent arg0) {
            eventBus.fireEventFromSource(new WidgetSelectionChangeEvent(false, false), AnalysisWidget.this);
        }
        });
        analysisType.addItem("None");
        analysisType.addItem("Average");
        analysisType.addItem("Minimum");
        analysisType.addItem("Maximum");
        analysisType.addItem("Sum");
        analysisType.addItem("Variance");
        analysisType.setSelectedIndex(0);
        layoutPanel.setWidget(0, 1, analysisType);
        layoutPanel.setWidget(1, 0, new Label("over:"));
        layoutPanel.setWidget(1, 1, analysisAxis);

        mainPanel.add(layoutPanel);

        initWidget(mainPanel);

    }
 
Example 51
Project: gwt-cs   File: Labels.java   Source Code and License 5 votes vote down vote up
@Override
public void buildPanel() {
    csVPanel = new ViewerPanel();
    addLabel();

    ListBox labelsLBox = new ListBox();
    labelsLBox.addItem("Add label", "0");
    labelsLBox.addItem("Set font", "1");
    labelsLBox.addItem("Set properties", "2");
    labelsLBox.addItem("Offset label by distance", "3");
    labelsLBox.addItem("Fade label by distance", "4");
    labelsLBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            ListBox source = (ListBox) event.getSource();
            reset();
            switch (source.getSelectedValue()) {
                case "0": addLabel(); break;
                case "1": setFont(); break;
                case "2": setProperties(); break;
                case "3": offsetByDistance(); break;
                case "4": fadeByDistance(); break;
                default: break;
            }
        }
    });

    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(labelsLBox, 20, 20);

    contentPanel.add(new HTML("<p>Create Labels</p>"));
    contentPanel.add(aPanel);

    initWidget(contentPanel);
}
 
Example 52
Project: gwt-uploader   File: Uploader.java   Source Code and License 5 votes vote down vote up
private FileUpload createFileUpload() {
  fileUpload = new FileUpload();
  fileUpload.getElement().getStyle().setDisplay(Style.Display.NONE);

  if (fileTypes != null) {
    // Convert the format that the SWFUpload/Flash parameter expects to the W3C DOM standard
    // See: http://dev.w3.org/html5/spec/states-of-the-type-attribute.html#attr-input-accept
    fileUpload.getElement()
        .setAttribute("accept", this.fileTypes.replaceAll("\\;", ",").replaceAll("\\*\\.", "."));

    // TODO(jake): Need to consider validation of this in the file queued handler as well,
    // as the browsers don't appear to consistently support the "accept" attribute
  }

  final AbsolutePanel panel = this;

  fileUpload.addChangeHandler(new ChangeHandler() {
    public void onChange(ChangeEvent event) {

      JsArray<?> selectedFiles = nativeGetSelectedFiles(fileUpload.getElement());

      // Every time a file is selected replace the FileUpload component running in the DOM so that
      // the user can continue to attempt uploading the same file multiple times (otherwise the
      // "ChangeHandler" never fires)
      panel.remove(fileUpload);
      panel.add(createFileUpload());

      addFilesToQueue(selectedFiles);

    }
  });
  return fileUpload;
}
 
Example 53
Project: x-cure-chat   File: UserStatusWidget.java   Source Code and License 5 votes vote down vote up
/**
 * The simple constructor
 */
public UserStatusWidget() {
	//Set the alignment
	mainHPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE );
	//Set the user label style
	userNameLabel.addStyleName( CommonResourcesContainer.USER_NAME_LABEL_STYLE );
	//Construct the widget components
	mainHPanel.add( userNameLabel );
	mainHPanel.add( new HTML("&nbsp;") );
	//Add the status image to the panel
	userStatusImage.setStyleName( CommonResourcesContainer.USER_STATUS_IMAGE_STYLE_NAME );
	statusImagePanel.add( userStatusImage );
	mainHPanel.add( statusImagePanel );
	userStatusesBox.setEnabled( true );
	//Fill out the status list box
	Iterator<String> iter = UserStatusHelper.getStatusStringToStatusID().keySet().iterator();
	while( iter.hasNext() ) {
		String statusString = iter.next();
		userStatusesBox.addItem( statusString, statusString );
	}
	//Add the change handler
	userStatusesBox.addChangeHandler( new ChangeHandler(){
		public void onChange(ChangeEvent e){
			//Get the selected user status and set it on the server and here
			UserStatusManager.getUserStatusQueue().setCurrentUserStatus( getNewlySelectedUserStatus() );
		}
	});
	//Add the status list box to the panel
	userStatusesBox.setStyleName( CommonResourcesContainer.USER_STATUS_LIST_BOX_STYLE_NAME );
	mainHPanel.add( userStatusesBox );
			
	//Initialize the widget
	initWidget( mainHPanel );
}
 
Example 54
Project: gwt-formlayout   File: ListBoxField.java   Source Code and License 5 votes vote down vote up
public ListBoxField() {
  listBox.addStyleName(style.ListBoxField());
  listBox.addChangeHandler(new ChangeHandler() {

    @Override
    public void onChange(ChangeEvent event) {
      ValueChangeEvent.fire(ListBoxField.this, null);
    }
  });
}
 
Example 55
Project: che   File: UploadFolderFromZipViewImpl.java   Source Code and License 5 votes vote down vote up
private void addFileUploadForm() {
  file = new FileUpload();
  file.setHeight("22px");
  file.setWidth("100%");
  file.setName("file");
  file.ensureDebugId("file-uploadFile-ChooseFile");
  file.addChangeHandler(
      new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
          delegate.onFileNameChanged();
        }
      });
  uploadPanel.insert(file, 0);
}
 
Example 56
Project: che   File: UploadFileViewImpl.java   Source Code and License 5 votes vote down vote up
private void addFile() {
  file = new FileUpload();
  file.setHeight("22px");
  file.setWidth("100%");
  file.setName("file");
  file.ensureDebugId("file-uploadFile-ChooseFile");
  file.addChangeHandler(
      new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
          delegate.onFileNameChanged();
        }
      });
  uploadPanel.insert(file, 0);
}
 
Example 57
Project: che   File: ContributePartViewImpl.java   Source Code and License 5 votes vote down vote up
@Override
public void addBranchChangedHandler(final TextChangedHandler changeHandler) {
  contributionBranchName.addChangeHandler(
      new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
          changeHandler.onTextChanged(contributionBranchName.getSelectedItemText());
        }
      });
}
 
Example 58
Project: geowe-core   File: GeoDataImportDialog.java   Source Code and License 5 votes vote down vote up
private FormPanel getFilePanel() {
	VerticalLayoutContainer layoutContainer = new VerticalLayoutContainer();

	file = new FileUploadField();

	file.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			setAutoFormat(file.getValue());
			String name = file.getValue().substring(0, file.getValue().lastIndexOf("."));
			name = name.substring(file.getValue().lastIndexOf("\\") +1);
			layerName.setText(name);
		}
	});

	file.setName(UIMessages.INSTANCE.gdidFileUploadFieldText());
	file.setAllowBlank(false);

	layoutContainer.add(new FieldLabel(file, UIMessages.INSTANCE.file()),
			new VerticalLayoutData(-18, -1));
	layoutContainer.add(new Label(UIMessages.INSTANCE.maxFileSizeText()),
			new VerticalLayoutData(-18, -1));

	uploadPanel = new FormPanel();
	uploadPanel.setMethod(Method.POST);
	uploadPanel.setEncoding(Encoding.MULTIPART);
	uploadPanel.setAction("fileupload.do");
	uploadPanel.setWidget(layoutContainer);

	return uploadPanel;
}
 
Example 59
Project: r01fb   File: GWTWidgets.java   Source Code and License 5 votes vote down vote up
/**
 * Sets the Change() event handler in many widgets
 * @param handler the handler
 * @param widgets the widgets
 */
public static void addChangeHandler(final ChangeHandler handler,final HasChangeHandlers... widgets) {
	if (handler != null && widgets != null && widgets.length > 0) {
		for (HasChangeHandlers w : widgets) {
			if (w != null) w.addChangeHandler(handler);
		}
	}
}
 
Example 60
Project: firefly   File: TableFilterSupport.java   Source Code and License 5 votes vote down vote up
public HandlerRegistration addChangeHandler(ChangeHandler handler) {
    chandler = handler;
    HandlerRegistration hr = new HandlerRegistration() {
                public void removeHandler() {
                    chandler = null;
                }
            };
    return hr;
}