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

The following examples show how to use com.google.gwt.event.dom.client.ChangeHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChangeGradeModesDialog.java    From unitime with Apache License 2.0 6 votes vote down vote up
public GradeModeChange(ClassAssignmentInterface.ClassAssignment ca, SpecialRegistrationGradeModeChanges gradeMode) {
	super(null);
	iList = new ListBox();
	iList.addStyleName("grade-mode-list");
	iClasses = new ArrayList<ClassAssignmentInterface.ClassAssignment>();
	iClasses.add(ca);
	iGradeMode = new ArrayList<SpecialRegistrationGradeModeChanges>();
	iGradeMode.add(gradeMode);
	iList.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			formChanged();
		}
	});
	setup();
}
 
Example #2
Source File: SettingsPanel.java    From swcv with MIT 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 #3
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private Widget createSimilarityListBox()
{
    final ListBox box = new ListBox();
    for (WCSimilarityAlgo font : WCSimilarityAlgoRegistry.list())
        box.addItem(font.getDescription(), font.getId());

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

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

    box.setTitle("Similarity method for computing relatedness between words; similar words tend to be placed together");
    return box;
}
 
Example #4
Source File: SettingsPanel.java    From swcv with MIT 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 #5
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private ListBox createRankingListBox()
{
    final ListBox box = new ListBox();
    for (WCRankingAlgo algo : WCRankingAlgoRegistry.list())
        box.addItem(algo.getDescription(), algo.getId());

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

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

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

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

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

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

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

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

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

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

    return box;
}
 
Example #8
Source File: SettingsPanel.java    From swcv with MIT 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 #9
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private Widget createAspectRatioListBox()
{
    final ListBox box = new ListBox();
    for (WCAspectRatio algo : WCAspectRatioRegistry.list())
        box.addItem(algo.getDescription(), algo.getId());

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

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

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

    return box;
}
 
Example #10
Source File: ChangeGradeModesDialog.java    From unitime with Apache License 2.0 6 votes vote down vote up
public GradeModeLabel(GradeModeChange change, SpecialRegistrationGradeModeChanges gradeMode) {
	super(null);
	iGradeMode = gradeMode;
	iLabel = new Label();
	iLabel.addStyleName("grade-mode-label");
	iLabel.setText(iGradeMode.getCurrentGradeMode() == null ? "" : iGradeMode.getCurrentGradeMode().getLabel());
	final ListBox box = (ListBox)change.getWidget(); 
	box.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			if (box.getSelectedIndex() <= 0) {
				iLabel.setText(iGradeMode.getCurrentGradeMode() == null ? "" : iGradeMode.getCurrentGradeMode().getLabel());
			} else {
				SpecialRegistrationGradeMode m = iGradeMode.getAvailableChange(box.getValue(box.getSelectedIndex()));
				if (m == null) {
					iLabel.setText(iGradeMode.getCurrentGradeMode() == null ? "" : iGradeMode.getCurrentGradeMode().getLabel());
				} else {
					iLabel.setText(m.getLabel());
				}
			}
		}
	});
}
 
Example #11
Source File: ClassificationsEdit.java    From unitime with Apache License 2.0 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 #12
Source File: CurriculaCourses.java    From unitime with Apache License 2.0 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 #13
Source File: GeoDataImportDialog.java    From geowe-core with GNU General Public License v3.0 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 #14
Source File: ChangeGradeModesDialog.java    From unitime with Apache License 2.0 5 votes vote down vote up
public VariableCreditChange(ClassAssignmentInterface.ClassAssignment ca, SpecialRegistrationVariableCreditChange vcc) {
	super(null);
	iList = new ListBox();
	iList.addStyleName("variable-credit-list");
	iClass = ca;
	iVarCredit = vcc;
	iList.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			formChanged();
		}
	});
	setup();
}
 
Example #15
Source File: SettingsPanel.java    From swcv with MIT License 5 votes vote down vote up
private ListBox createLanguageListBox()
{
    final ListBox box = new ListBox();
    box.addItem("Arabic", "ar");
    box.addItem("Czech", "cs");
    box.addItem("Danish", "da");
    box.addItem("Dutch", "nl");
    box.addItem("English", "en");
    box.addItem("Finnish", "fi");
    box.addItem("French", "fr");
    box.addItem("German", "de");
    box.addItem("Greek", "el");
    box.addItem("Hungarian", "hu");
    box.addItem("Italian", "it");
    box.addItem("Japanese", "ja");
    box.addItem("Norwegian", "no");
    box.addItem("Polish", "pl");
    box.addItem("Portuguese", "pt");
    box.addItem("Russian", "ru");
    box.addItem("Spanish", "es");
    box.addItem("Swedish", "sv");
    box.addItem("Turkish", "tr");

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

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

    box.setTitle("Language of text");

    return box;
}
 
Example #16
Source File: SingleListBox.java    From gwt-traction with Apache License 2.0 5 votes vote down vote up
protected SingleListBox(boolean addMissingValue, boolean isMultipleSelect) {
super(isMultipleSelect);
setAddMissingValue(addMissingValue);

// Listen to our own change events and broadcast as
// ValueChangeEvent<String>
addChangeHandler(new ChangeHandler() {
           @Override
           public void onChange(ChangeEvent event) {
               ValueChangeEvent.fire(SingleListBox.this, getValue());
           }
});        
   }
 
Example #17
Source File: RendererSelectorListBoxView.java    From dashbuilder with Apache License 2.0 5 votes vote down vote up
@Override
public void init(final RendererSelector presenter) {
    this.presenter = presenter;
    initWidget(uiBinder.createAndBindUi(this));

    listBox.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            presenter.onRendererSelected();
        }
    });
}
 
Example #18
Source File: SelectorDisplayerView.java    From dashbuilder with Apache License 2.0 5 votes vote down vote up
@Override
public void setFilterEnabled(boolean enabled) {
    if (enabled) {
        listBox.addChangeHandler(new ChangeHandler() {
            public void onChange(ChangeEvent event) {
                getPresenter().onItemSelected();
            }
        });
    }
}
 
Example #19
Source File: InputFile.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
UploadForm() {
	this.formPanel.getElement().getStyle().setHeight(0, Unit.PX);
	this.formPanel.getElement().getStyle().setWidth(0, Unit.PX);
	this.formPanel.getElement().getStyle().setOverflow(Overflow.HIDDEN);
	this.formPanel.add(this.fileUpload);

	this.fileUpload.setName("data");

	this.handlerRegistrations.add(this.fileUpload.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			uploadData(fileUpload.getElement());
		}
	}));
}
 
Example #20
Source File: TemplateUploadWizard.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a drop down menu for selecting Template repositories.
 * @return the drop down menu of repository Urls.
 */
private ListBox makeTemplatesMenu() {
  final ListBox templatesMenu = new ListBox();
  templatesMenu.addItem(MESSAGES.templateUploadNewUrlCaption());
  templatesMenu.addItem(MIT_TEMPLATES);

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

        if (selectedIndex == 0) {
          templatesMenu.setSelectedIndex(lastSelectedIndex);
          usingExternalTemplate = true; // MIT templates at index 1
          removeButton.setVisible(false);
          new InputTemplateUrlWizard(instance).center();     // This will do a callback
        } else if (selectedIndex == 1) {
          removeButton.setVisible(false);          lastSelectedIndex = selectedIndex;
          usingExternalTemplate = false; // MIT templates at index 1
          templateHostUrl = "";
          retrieveSelectedTemplates(templatesMenu.getValue(selectedIndex));  // may do callback
        } else {
          removeButton.setVisible(true);         lastSelectedIndex = selectedIndex;
          usingExternalTemplate = true; // MIT templates at index 1
          templateHostUrl = templatesMenu.getValue(selectedIndex);
          retrieveSelectedTemplates(templatesMenu.getValue(selectedIndex));  // may do callback
        }
      }
    });
  templatesMenu.setVisibleItemCount(1);  // Turns menu into a drop-down list).
  return templatesMenu;
}
 
Example #21
Source File: ETLPopPanel.java    From EasyML with Apache License 2.0 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 #22
Source File: ScriptParameterPanel.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public void addCountBoxHandler(ChangeHandler handler){
	inCountBox.addChangeHandler(handler);
	outCountBox.addChangeHandler(handler);
}
 
Example #23
Source File: AbstractInputBox.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addChangeHandler(ChangeHandler handler) {
	return this.input.addChangeHandler(handler);
}
 
Example #24
Source File: TagsInputBase.java    From gwtbootstrap3-extras with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addChangeHandler(ChangeHandler handler) {
    return addDomHandler(handler, ChangeEvent.getType());
}
 
Example #25
Source File: FolderSelectPopup.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public FolderSelectPopup() {
	// Establishes auto-close when click outside
	super(false, true);

	vPanel = new VerticalPanel();
	vPanel.setWidth("450px");
	vPanel.setHeight("400px");
	hPanel = new HorizontalPanel();
	hListPanel = new HorizontalPanel();
	hContextPanel = new HorizontalPanel();

	contextTxt = new HTML(Main.i18n("search.context"));
	contextListBox = new ListBox();
	contextListBox.setStyleName("okm-Select");

	contextListBox.addChangeHandler(new ChangeHandler() {
		                                @Override
		                                public void onChange(ChangeEvent event) {
			                                folderSelectTree.changeView(Integer.parseInt(contextListBox.getValue(contextListBox.getSelectedIndex())));
		                                }
	                                }
	);
	hContextPanel.add(contextTxt);
	hContextPanel.add(new HTML("&nbsp;&nbsp;"));
	hContextPanel.add(contextListBox);
	hContextPanel.setCellVerticalAlignment(contextTxt, HasVerticalAlignment.ALIGN_MIDDLE);

	hListPanel.add(hContextPanel);
	hListPanel.setWidth("440px");

	scrollDirectoryPanel = new ScrollPanel();
	scrollDirectoryPanel.setSize("440px", "350px");
	scrollDirectoryPanel.setStyleName("okm-Popup-text");
	verticalDirectoryPanel = new VerticalPanel();
	verticalDirectoryPanel.setSize("100%", "100%");
	folderSelectTree = new FolderSelectTree();
	folderSelectTree.setSize("100%", "100%");

	verticalDirectoryPanel.add(folderSelectTree);
	scrollDirectoryPanel.add(verticalDirectoryPanel);

	cancelButton = new Button(Main.i18n("button.cancel"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			action = ACTION_NONE;
			hide();
		}
	});

	actionButton = new Button(Main.i18n("button.move"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			executeAction(folderSelectTree.getActualPath(), false);
		}
	});

	status.setWidth("430px");
	status.setWordWrap(true);
	status.setStyleName("fancyfileupload-pending");
	status.setVisible(false);

	vPanel.add(new HTML("<br>"));
	vPanel.add(hListPanel);
	vPanel.add(new HTML("<br>"));
	vPanel.add(scrollDirectoryPanel);
	vPanel.add(status);
	vPanel.add(new HTML("<br>"));
	hPanel.add(cancelButton);
	HTML space = new HTML();
	space.setWidth("50px");
	hPanel.add(space);
	hPanel.add(actionButton);
	vPanel.add(hPanel);
	vPanel.add(new HTML("<br>"));

	vPanel.setCellHorizontalAlignment(hListPanel, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(scrollDirectoryPanel, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(status, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHeight(scrollDirectoryPanel, "350px");

	cancelButton.setStyleName("okm-NoButton");
	actionButton.setStyleName("okm-YesButton");

	massiveStatus = new com.openkm.frontend.client.widget.massive.Status(this);
	massiveStatus.setStyleName("okm-StatusPopup");

	super.hide();
	setWidget(vPanel);
}
 
Example #26
Source File: WorkflowPopup.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * WorkflowPopup popup
 */
public WorkflowPopup() {
	// Establishes auto-close when click outside
	super(false, true);

	vPanel = new VerticalPanel();
	hPanel = new HorizontalPanel();
	sp = new SimplePanel();

	closeButton = new Button(Main.i18n("button.close"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			hide();
		}
	});

	addButton = new Button(Main.i18n("button.start"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			addButton.setEnabled(false);
			runProcessDefinition();
		}
	});

	listBox = new ListBox();
	listBox.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			if (listBox.getSelectedIndex() > 0) {
				addButton.setEnabled(true);
			} else {
				addButton.setEnabled(false);
			}

			sp.setVisible(false);
			sp.clear();
		}
	});
	listBox.setStyleName("okm-Select");

	vPanel.setWidth("300px");
	vPanel.setHeight("50px");
	closeButton.setStyleName("okm-NoButton");
	addButton.setStyleName("okm-YesButton");
	addButton.setEnabled(false);

	hPanel.add(closeButton);
	hPanel.add(new HTML("&nbsp;&nbsp;"));
	hPanel.add(addButton);

	hPanel.setCellHorizontalAlignment(closeButton, VerticalPanel.ALIGN_CENTER);
	hPanel.setCellHorizontalAlignment(addButton, VerticalPanel.ALIGN_CENTER);

	vPanel.add(new HTML("<br>"));
	vPanel.add(listBox);
	vPanel.add(sp);
	vPanel.add(new HTML("<br>"));
	vPanel.add(hPanel);
	vPanel.add(new HTML("<br>"));

	vPanel.setCellHorizontalAlignment(listBox, VerticalPanel.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(hPanel, VerticalPanel.ALIGN_CENTER);

	super.hide();
	setWidget(vPanel);
}
 
Example #27
Source File: PropertyGroupPopup.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * PropertyGroupPopup popup
 */
public PropertyGroupPopup() {
	// Establishes auto-close when click outside
	super(false, true);
	setText(Main.i18n("group.label"));

	// Status
	status = new Status(this);
	status.setStyleName("okm-StatusPopup");

	table = new FlexTable();
	table.setCellPadding(4);
	table.setCellSpacing(0);
	table.setWidth("100%");
	hPanel = new HorizontalPanel();
	manager = new FormManager(this);

	propertyGroupTable = manager.getTable();
	propertyGroupTable.setWidth("100%");

	scrollPropertyGroup = new ScrollPanel();
	scrollPropertyGroup.add(propertyGroupTable);

	cancel = new Button(Main.i18n("button.cancel"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			if (Main.get().mainPanel.desktop.browser.fileBrowser.isMassive()) {
				Main.get().mainPanel.topPanel.toolBar.executeRefresh();
			}
			groupsLoaded = false;
			hide();
		}
	});

	add = new Button(Main.i18n("button.add"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			addGroup();
		}
	});

	listBox = new ListBox();
	listBox.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent arg0) {
			if (listBox.getSelectedIndex() > 0) {
				add.setEnabled(true);
			} else {
				add.setEnabled(false);
			}
		}
	});

	listBox.setStyleName("okm-Select");

	HorizontalPanel grpNamePanel = new HorizontalPanel();
	propertyGroupName = new HTML("");
	grpNamePanel.add(propertyGroupName);
	grpNamePanel.setWidth("100%");
	grpNamePanel.setCellHorizontalAlignment(propertyGroupName, HasAlignment.ALIGN_CENTER);

	cancel.setStyleName("okm-NoButton");
	add.setStyleName("okm-AddButton");
	add.setEnabled(false);

	hPanel.add(cancel);
	hPanel.add(new HTML("&nbsp;&nbsp;"));
	hPanel.add(add);

	hPanel.setCellHorizontalAlignment(cancel, VerticalPanel.ALIGN_CENTER);
	hPanel.setCellHorizontalAlignment(add, VerticalPanel.ALIGN_CENTER);

	table.setWidget(0, 0, listBox);
	table.setWidget(1, 0, grpNamePanel);
	table.setWidget(2, 0, scrollPropertyGroup);
	table.setWidget(3, 0, hPanel);

	table.getCellFormatter().setStyleName(1, 0, "okm-Security-Title");
	table.getCellFormatter().addStyleName(1, 0, "okm-Security-Title-RightBorder");

	table.getCellFormatter().setHorizontalAlignment(0, 0, HasAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(1, 0, HasAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(2, 0, HasAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(3, 0, HasAlignment.ALIGN_CENTER);

	super.hide();
	setWidget(table);
}
 
Example #28
Source File: FolderSelectPopup.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * FolderSelectPopup
 */
public FolderSelectPopup() {
	// Establishes auto-close when click outside
	super(false, true);

	vPanel = new VerticalPanel();
	vPanel.setWidth("300px");
	vPanel.setHeight("200px");
	hPanel = new HorizontalPanel();
	hListPanel = new HorizontalPanel();
	hContextPanel = new HorizontalPanel();

	contextTxt = new HTML(Main.i18n("search.context"));
	contextListBox = new ListBox();
	contextListBox.setStyleName("okm-Select");

	contextListBox.addChangeHandler(new ChangeHandler() {
		                                @Override
		                                public void onChange(ChangeEvent event) {
			                                folderSelectTree.changeView(Integer.parseInt(contextListBox.getValue(contextListBox.getSelectedIndex())));
		                                }
	                                }
	);
	hContextPanel.add(contextTxt);
	hContextPanel.add(new HTML("&nbsp;&nbsp;"));
	hContextPanel.add(contextListBox);
	hContextPanel.setCellVerticalAlignment(contextTxt, HasVerticalAlignment.ALIGN_MIDDLE);

	hListPanel.add(hContextPanel);
	hListPanel.setWidth("290px");

	setText(Main.i18n("search.folder.filter"));

	scrollDirectoryPanel = new ScrollPanel();
	scrollDirectoryPanel.setSize("290px", "150px");
	scrollDirectoryPanel.setStyleName("okm-Popup-text");
	verticalDirectoryPanel = new VerticalPanel();
	verticalDirectoryPanel.setSize("100%", "100%");
	folderSelectTree = new FolderSelectTree();
	folderSelectTree.setSize("100%", "100%");

	verticalDirectoryPanel.add(folderSelectTree);
	scrollDirectoryPanel.add(verticalDirectoryPanel);

	cancelButton = new Button(Main.i18n("button.cancel"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			hide();
		}
	});

	actionButton = new Button(Main.i18n("button.select"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			textBox.setValue(folderSelectTree.getActualPath());
			if (propertyHandler != null) {
				propertyHandler.metadataValueChanged();
			}
			hide();
		}
	});

	vPanel.add(new HTML("<br>"));
	vPanel.add(hListPanel);
	vPanel.add(new HTML("<br>"));
	vPanel.add(scrollDirectoryPanel);
	vPanel.add(new HTML("<br>"));
	hPanel.add(cancelButton);
	HTML space = new HTML();
	space.setWidth("50px");
	hPanel.add(space);
	hPanel.add(actionButton);
	vPanel.add(hPanel);
	vPanel.add(new HTML("<br>"));

	vPanel.setCellHorizontalAlignment(hListPanel, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(scrollDirectoryPanel, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHeight(scrollDirectoryPanel, "150px");

	cancelButton.setStyleName("okm-Input");
	actionButton.setStyleName("okm-Input");

	super.hide();
	setWidget(vPanel);
}
 
Example #29
Source File: SubsetJSONPropertyEditor.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public SubsetJSONPropertyEditor() {
  buildTrees();
  file.addChangeHandler(new ChangeHandler() {
    @Override
    public void onChange(ChangeEvent changeEvent) {
      if (customPopupShowing) {
        loadJSONfile(file, false);
      }
      else {
        loadJSONfile(file, true);
      }
    }
  });

  // This is an invisible panel holding a FileUpload button. It exists because we want to access
  // the file selection dialog from the subset editor dropdown menu item. There may be a better way
  // to do this.
  PopupPanel invisibleFilePanel = new PopupPanel();
  invisibleFilePanel.add(file);
  invisibleFilePanel.setVisible(false);
  invisibleFilePanel.show();

  List<DropDownButton.DropDownItem> items = Lists.newArrayList();
  items.add(new DropDownButton.DropDownItem("Subset Property Editor", "All", new Command() {
    @Override
    public void execute() {
      property.setValue("");
      updateValue();
    }}));
  items.add(new DropDownButton.DropDownItem("Subset Property Editor", "Match Project", new Command() {
    @Override
    public void execute() {
      matchProject();
      property.setValue(createJSONString());
      updateValue();
    }}));
  items.add(new DropDownButton.DropDownItem("Subset Property Editor", MESSAGES.fileUploadWizardCaption(), new Command() {
    @Override
    public void execute() {
      file.click();
    }}));

  items.add(new DropDownButton.DropDownItem("Subset Property Editor", "View and Modify", new Command() {
    @Override
    public void execute() {
      showCustomSubsetPanel();
    }}));
  dropDownButton = new DropDownButton("Subset Property Editor", "", items, false);
  dropDownButton.setStylePrimaryName("ode-ChoicePropertyEditor");
  initWidget(dropDownButton);
  INSTANCE = this;
  exportJavaMethods();
}
 
Example #30
Source File: MaterialRange.java    From gwt-material with Apache License 2.0 2 votes vote down vote up
/**
 * Register the ChangeHandler to become notified if the user changes the slider.
 * The Handler is called when the user releases the mouse only at the end of the slide
 * operation.
 */
@Override
public HandlerRegistration addChangeHandler(final ChangeHandler handler) {
    return getRangeInputElement().addDomHandler(handler, ChangeEvent.getType());
}