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

The following are top voted examples for showing how to use com.google.gwt.event.dom.client.ChangeEvent. 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: LAS   File: UI.java   View source code 6 votes vote down vote up
@Override
public void onChange(ChangeEvent event) {
    Object source = event.getSource();
    if ((source != null) && (source instanceof AnalysisWidget)) {
        AnalysisWidget analysis = (AnalysisWidget) source;
        applyButton.addStyleDependentName("APPLY-NEEDED");
        // String v = xAnalysisWidget.getAnalysisAxis();
        if (analysis.isActive()) {
            tOperationsMenu.setCorrelationButtonEnabled(false);
            String v = analysis.getAnalysisAxis();
            setAnalysisAxes(v);
            for (Iterator panelIt = xPanels.iterator(); panelIt.hasNext();) {
            	OutputPanel p = (OutputPanel) panelIt.next();
            	p.setAnalysis(analysis.getAnalysisSerializable());
            }
        } else {
            turnOffAnalysis();
        }
    }
}
 
Example 2
Project: gwt-cs   File: AtmosphereColor.java   View source code 6 votes vote down vote up
@Override
public void onChange(ChangeEvent changeEvent) {
    TextBox source = (TextBox)changeEvent.getSource();
    double value = Double.parseDouble(source.getValue());
    if (source == _hueShiftTBox) {
        _csVPanel.getViewer().scene().skyAtmosphere.hueShift = (float)value;
        _hueShiftSlider.setValue((int)(value * 100));
    }
    else if (source == _saturationShiftTBox) {
        _csVPanel.getViewer().scene().skyAtmosphere.saturationShift = (float)value;
        _saturationShiftSlider.setValue((int)(value * 100));
    }
    else if (source == _brightnessShiftTBox) {
        _csVPanel.getViewer().scene().skyAtmosphere.brightnessShift = (float)value;
        _brightnessShiftSlider.setValue((int)(value * 100));
    }
}
 
Example 3
Project: gwt-cs   File: Models3DColoring.java   View source code 6 votes vote down vote up
@Override
public void onChange(ChangeEvent event) {
    TextBox source = (TextBox) event.getSource();
    float value = Float.parseFloat(source.getValue());
    if (source == alphaTBox) {
        alphaSlider.setValue((int) (value * 100));
        alpha = value;
        csVPanel.getViewer().trackedEntity.model.color = new ConstantProperty<>(getColor(colorStr, alpha));
    } else if (source == mixTBox) {
        mixSlider.setValue((int) (value * 100));
        colorBlendAmount = value;
        csVPanel.getViewer().trackedEntity.model.colorBlendAmount = new ConstantProperty<>(colorBlendAmount);
    } else if (source == silhouetteAlphaTBox) {
        silhouetteAlphaSlider.setValue((int) (value * 100));
        silhouetteAlpha = value;
        csVPanel.getViewer().trackedEntity.model.silhouetteColor = new ConstantProperty<>(getColor(silhouetteColorStr, silhouetteAlpha));
    } else if (source == silhouetteSizeTBox) {
        silhouetteSizeSlider.setValue((int) (value * 100));
        silhouetteSize = value;
        csVPanel.getViewer().trackedEntity.model.silhouetteSize = new ConstantProperty<>(silhouetteSize);
    }
}
 
Example 4
Project: gwt-cs   File: ImageryAdjustment.java   View source code 6 votes vote down vote up
@Override
public void onChange(ChangeEvent changeEvent) {
    TextBox source = (TextBox) changeEvent.getSource();
    float value = Float.parseFloat(source.getText());
    if (source.equals(brightnessTBox)) {
        brightnessSlider.setValue((int)(value * 100));
    }
    else if (source.equals(contrastTBox)) {
        contrastSlider.setValue((int)(value * 100));
    }
    else if (source.equals(hueTBox)) {
        hueSlider.setValue((int)(value * 100));
    }
    else if (source.equals(saturationTBox)) {
        saturationSlider.setValue((int)(value * 100));
    }
    else if (source.equals(gammaTBox)) {
        gammaSlider.setValue((int)(value * 100));
    }
}
 
Example 5
Project: Wiab.pro   File: EventDispatcherPanel.java   View source code 6 votes vote down vote up
@Override
boolean dispatch(ChangeEvent event, Element context, WaveChangeHandler handler) {
  Timer timer = null;
  if (Timing.isEnabled()) {
    Timing.enterScope();
    timer = Timing.start("Mouse event dispatch");
  }
  try {
    return handler.onChange(event, context);
  } finally {
    if (timer != null) {
      Timing.stop(timer);
      Timing.exitScope();
    }
  }
}
 
Example 6
Project: x-cure-chat   File: FontSelectorPanelUI.java   View source code 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 7
Project: ephesoft   File: ReportingView.java   View source code 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 8
Project: ephesoft   File: FolderSelectionWidget.java   View source code 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 9
Project: teiid-webui   File: TableSelectorWidget.java   View source code 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 10
Project: appformer   File: RepositoryConfigurationViewImpl.java   View source code 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 11
Project: aggregate   File: FilterNavigationTable.java   View source code 6 votes vote down vote up
@Override
public void onChange(ChangeEvent event) {
  AggregateUI.getUI().getTimer().restartTimer();
  FormSummary form = formsBox.getSelectedForm();
  if (form != null) {
    if (selectedForm == null || !selectedForm.equals(form)) {
      selectedForm = form;
      // update filter list based on new form
      // NOTE: the filter list MUST be updated BEFORE the selected
      // updateSelectedFormNFilter() is called
      updateFilterList();
    }
    // otherwise no-op (form unchanged)...
  } else {
    // no selected form...
    selectedForm = null;
    updateFilterList();
  }
}
 
Example 12
Project: listmaker   File: EnumListBox.java   View source code 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 13
Project: listmaker   File: SelectOneListBox.java   View source code 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 14
Project: appformer   File: ComboField.java   View source code 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: shifts-solver   File: ShiftsLimitTextBox.java   View source code 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 16
Project: firefly   File: CatddPanel.java   View source code 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 17
Project: firefly   File: CatddEnhancedPanel.java   View source code 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 18
Project: firefly   File: ListBoxInputField.java   View source code 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 19
Project: gerrit   File: PreferencesBox.java   View source code 6 votes vote down vote up
@UiHandler("mode")
void onMode(@SuppressWarnings("unused") ChangeEvent e) {
  String mode = getSelectedMode();
  prefs.syntaxHighlighting(true);
  syntaxHighlighting.setValue(true, false);
  new ModeInjector()
      .add(mode)
      .inject(
          new GerritCallback<Void>() {
            @Override
            public void onSuccess(Void result) {
              if (prefs.syntaxHighlighting()
                  && Objects.equals(mode, getSelectedMode())
                  && view.isAttached()) {
                view.operation(
                    () -> {
                      view.getCmFromSide(DisplaySide.A).setOption("mode", mode);
                      view.getCmFromSide(DisplaySide.B).setOption("mode", mode);
                    });
              }
            }
          });
}
 
Example 20
Project: gerrit   File: PreferencesBox.java   View source code 6 votes vote down vote up
@UiHandler("theme")
void onTheme(@SuppressWarnings("unused") ChangeEvent e) {
  Theme newTheme = getSelectedTheme();
  prefs.theme(newTheme);
  if (view != null) {
    ThemeLoader.loadTheme(
        newTheme,
        new GerritCallback<Void>() {
          @Override
          public void onSuccess(Void result) {
            view.operation(
                () -> {
                  if (getSelectedTheme() == newTheme && isAttached()) {
                    String t = newTheme.name().toLowerCase();
                    view.getCmFromSide(DisplaySide.A).setOption("theme", t);
                    view.getCmFromSide(DisplaySide.B).setOption("theme", t);
                    view.setThemeStyles(newTheme.isDark());
                  }
                });
          }
        });
  }
}
 
Example 21
Project: gerrit   File: DownloadBox.java   View source code 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 22
Project: EasyML   File: ETLPopPanel.java   View source code 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 23
Project: unitimes   File: ClassificationsEdit.java   View source code 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 24
Project: unitimes   File: CurriculaCourses.java   View source code 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 25
Project: sig-seguimiento-vehiculos   File: GeoDataImportDialog.java   View source code 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 26
Project: appinventor-extensions   File: TemplateUploadWizard.java   View source code 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 27
Project: LAS   File: VariableSelectorImpl.java   View source code 5 votes vote down vote up
@Override
public void removeListBox(UserListBox oldListBox) {
	int oldItemCount = itemCount;
	boolean removed = remove(oldListBox);
	if (removed) {
		this.itemCount--;
		if (listener != null)
			listener.itemCountUpdated(oldItemCount, itemCount, this);
		// Show the latest remaining list box's remove button
		UserListBox latestListBox = getLatestListBox();
		if (itemCount == 1) {
			latestListBox.addVectors();
		}
		if (latestListBox != null) {
			latestListBox.setRemoveButtonVisible(itemCount > 1);
			List<VariableSerializable> variables = latestListBox
					.getVariables();
			if (variables != null) {
				latestListBox
						.setAddButtonVisible(variables.size() > itemCount);
			}
			final VariableSelector view = this;
			listener.onChange(new ChangeEvent() {
			}, view);
		}
	} else {
		logger.severe("FAILED to remove oldListBox:");
		try {
			logger.severe(oldListBox.getName(oldListBox.getSelectedIndex()));
		} catch (Exception e) {
			logger.log(Level.WARNING, e.getLocalizedMessage(), e);
			e.printStackTrace();
		}
	}
}
 
Example 28
Project: LAS   File: AnalysisWidget.java   View source code 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 29
Project: LAS   File: UI.java   View source code 5 votes vote down vote up
@Override
public void onChange(ChangeEvent event) {
    if (xAnalysisWidget.isActive()) {
        eventBus.fireEventFromSource(new WidgetSelectionChangeEvent(false), event.getSource());
        ListBox analysisAxis = (ListBox) event.getSource();
        String v = analysisAxis.getValue(analysisAxis.getSelectedIndex());
        setAnalysisAxes(v);
    }
}
 
Example 30
Project: LAS   File: Correlation.java   View source code 5 votes vote down vote up
@Override
public void onChange(ChangeEvent event) {
	TextBox w = (TextBox) event.getSource();
	Widget wp = w.getParent();
	Widget gp = wp.getParent();
	if (gp instanceof VariableConstraintWidget) {
		VariableConstraintWidget vcw = (VariableConstraintWidget) gp;
		vcw.setApply(true);
	}
	setConstraints();
}
 
Example 31
Project: LAS   File: SimplePropPropViewer.java   View source code 5 votes vote down vote up
@Override
public void onChange(ChangeEvent event) {
    TextBox w = (TextBox) event.getSource();
    Widget wp = w.getParent();
    Widget gp = wp.getParent();
    if (gp instanceof VariableConstraintWidget) {
        VariableConstraintWidget vcw = (VariableConstraintWidget) gp;
        vcw.setApply(true);
    }
    setConstraints();
}
 
Example 32
Project: gwt-cs   File: Clustering.java   View source code 5 votes vote down vote up
@Override
public void onChange(ChangeEvent changeEvent) {
    TextBox source = (TextBox) changeEvent.getSource();
    int value = Integer.parseInt(source.getText());
    if (source.equals(pixelRangeTBox)) {
        pixelRangeSlider.setValue(value);
    }
    else if (source.equals(minimumClusterSizeTBox)) {
        minimumClusterSizeSlider.setValue(value);
    }
}
 
Example 33
Project: gwt-cs   File: Labels.java   View source code 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 34
Project: gwt-uploader   File: Uploader.java   View source code 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 35
Project: Wiab.pro   File: SearchWidget.java   View source code 5 votes vote down vote up
@Override
public void onChange(ChangeEvent event) {
  if (queryTextBox.getValue() == null || queryTextBox.getValue().isEmpty()) {
    queryTextBox.setText(DEFAULT_QUERY);
  }
  onQuery();
}
 
Example 36
Project: Wiab.pro   File: WebClient.java   View source code 5 votes vote down vote up
private void setupLocaleSelect() {
  final SelectElement select = (SelectElement) Document.get().getElementById(LANG_ELEMENT_ID);
  String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName();
  String[] localeNames = LocaleInfo.getAvailableLocaleNames();
  for (String locale : localeNames) {
    if (!DEFAULT_LOCALE.equals(locale)) {
      String displayName = LocaleInfo.getLocaleNativeDisplayName(locale);
      OptionElement option = Document.get().createOptionElement();
      option.setValue(locale);
      option.setText(displayName);
      select.add(option, null);
      if (locale.equals(currentLocale)) {
        select.setSelectedIndex(select.getLength() - 1);
      }
    }
  }

  EventDispatcherPanel.of(select).registerChangeHandler(null, new WaveChangeHandler() {

    @Override
    public boolean onChange(ChangeEvent event, Element context) {
      UrlBuilder builder = Location.createUrlBuilder().setParameter(
          LOCALE_URLBUILDER_PARAMETER, select.getValue());
      Window.Location.replace(builder.buildString());
      localeService.storeLocale(select.getValue());
      return true;
    }
  });
}
 
Example 37
Project: x-cure-chat   File: UserStatusWidget.java   View source code 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 38
Project: ontobrowser   File: AddSynonymPopup.java   View source code 5 votes vote down vote up
@Override
public void onChange(ChangeEvent event) {
	if(sourceDropBox.getSelectedIndex() > 0) {
		referenceIdField.setEnabled(true);
	} else {
		referenceIdField.setEnabled(false);
		referenceIdField.setValue(null);
	}
}
 
Example 39
Project: ontobrowser   File: CreateChildTermPopup.java   View source code 5 votes vote down vote up
@Override
public void onChange(ChangeEvent event) {
	if(sourceDropBox.getSelectedIndex() > 0) {
		referenceIdField.setEnabled(true);
	} else {
		referenceIdField.setEnabled(false);
		referenceIdField.setValue(null);
	}
}
 
Example 40
Project: gwt-formlayout   File: ListBoxField.java   View source code 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);
    }
  });
}