/** {@inheritDoc} */ @Override public void setHardMode(boolean isHard) { hard.setValue(isHard); }
/** * Tests submitting using url-encoded get, with all form widgets (other than FileUpload, which * requires post/multipart. */ public void testMethodGet() { System.out.println("testMethodGet"); final FormPanel form = new FormPanel(); form.setMethod(FormPanel.METHOD_GET); form.setEncoding(FormPanel.ENCODING_URLENCODED); form.setAction(GWT.getModuleBaseURL() + "formHandler"); TextBox tb = new TextBox(); tb.setText("text"); tb.setName("tb"); PasswordTextBox ptb = new PasswordTextBox(); ptb.setText("password"); ptb.setName("ptb"); CheckBox cb0 = new CheckBox(), cb1 = new CheckBox(); cb1.setValue(true); cb0.setName("cb0"); cb1.setName("cb1"); RadioButton rb0 = new RadioButton("foo"); RadioButton rb1 = new RadioButton("foo"); rb0.setValue(true); rb0.setName("rb0"); rb1.setName("rb1"); ListBox lb = new ListBox(); lb.addItem("option0"); lb.addItem("option1"); lb.addItem("option2"); lb.setValue(0, "value0"); lb.setValue(1, "value1"); lb.setValue(2, "value2"); lb.setSelectedIndex(1); lb.setName("lb"); Hidden h = new Hidden("h", "v"); FlowPanel panel = new FlowPanel(); panel.add(tb); panel.add(ptb); panel.add(cb0); panel.add(cb1); panel.add(rb0); panel.add(rb1); panel.add(lb); panel.add(h); form.setWidget(panel); RootPanel.get().add(form); delayTestFinish(TEST_DELAY); form.addSubmitCompleteHandler( new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { // The server just echoes the query string. This is what it should look // like. assertTrue( event .getResults() .equals( "tb=text&ptb=password&cb1=on&rb0=on&lb=value1&h=v")); finishTest(); } }); form.submit(); }
/** {@inheritDoc} */ @Override public void setMixMode(boolean isMix) { mixed.setValue(isMix); }
/** {@inheritDoc} */ @Override public void setSoftMode(boolean isSoft) { soft.setValue(isSoft); }
public AddNewModuleDialog( final ApplicationModel model, final List<String> types, final NewModuleCreatedCallback callback, final Context errorDisplay) { super(false, true); okButton = new Button("Ok"); okButton.addStyleName("btn"); cancelButton = new Button("Cancel"); okButton.addStyleName("btn"); this.errorDisplay = errorDisplay; setTitle("Add new module"); final Panel radioPanel = new HorizontalPanel(); { final Panel daemonPanel; daemonPanel = new VerticalPanel(); boolean wasChecked = false; for (final DaemonModel daemonModel : model.getDaemons()) { final RadioButton radio = new RadioButton("daemonRadioGroup", "Add to " + daemonModel.getName() + " daemon."); if (!wasChecked) { radio.setValue(true); wasChecked = true; } daemonPanel.add(radio); daemonRadios.put(daemonModel, radio); } if (daemonRadios.size() > 1) { radioPanel.add(daemonPanel); } } { final Panel typePanel = new VerticalPanel(); boolean wasChecked = false; for (final String type : types) { if (!UiBuilderClient.NONE_TYPE.equals(type)) { final RadioButton radio = new RadioButton("typeRadioGroup", "Create " + type + " module."); if (!wasChecked) { radio.setValue(true); wasChecked = true; } typePanel.add(radio); typeRadios.put(type, radio); } } if (typeRadios.size() > 1) { radioPanel.add(typePanel); } } // If the user has no choice, just do the job if (skipDisplay()) { okClicked(callback); return; } final Panel buttonPanel = new HorizontalPanel(); buttonPanel.add(okButton); buttonPanel.add(cancelButton); okButton.addClickHandler( new ClickHandler() { @Override public void onClick(final ClickEvent event) { okClicked(callback); } }); cancelButton.addClickHandler( new ClickHandler() { @Override public void onClick(final ClickEvent event) { hide(); } }); final Panel allPanel = new VerticalPanel(); allPanel.add(radioPanel); allPanel.add(buttonPanel); add(allPanel); }
public NewPackageWizard(ClientFactory clientFactory, EventBus eventBus) { super(images.newexWiz(), constants.CreateANewPackage()); this.eventBus = eventBus; nameBox = new TextBox(); descBox = new TextBox(); newPackageLayout.addAttribute(constants.NameColon(), nameBox); newPackageLayout.addAttribute(constants.DescriptionColon(), descBox); nameBox.setTitle(constants.PackageNameTip()); RadioButton newPackage = new RadioButton("action", constants.CreateNewPackageRadio()); RadioButton importPackage = new RadioButton("action", constants.ImportFromDrlRadio()); newPackage.setValue(true); newPackageLayout.setVisible(true); newPackage.addClickHandler( new ClickHandler() { public void onClick(ClickEvent arg0) { newPackageLayout.setVisible(true); importLayout.setVisible(false); } }); this.setAfterShow( new Command() { public void execute() { nameBox.setFocus(true); } }); importLayout.setVisible(false); importPackage.addClickHandler( new ClickHandler() { public void onClick(ClickEvent arg0) { newPackageLayout.setVisible(false); importLayout.setVisible(true); } }); VerticalPanel ab = new VerticalPanel(); ab.add(newPackage); ab.add(importPackage); addAttribute("", ab); addRow(newPackageLayout); addRow(importLayout); importLayout.addAttribute(constants.DRLFileToImport(), newImportWidget(this)); importLayout.addRow(new HTML("<br/><b>" + constants.NoteNewPackageDrlImportWarning() + "</b>")); importLayout.addRow(new HTML(constants.ImportDRLDesc1())); importLayout.addRow(new HTML(constants.ImportDRLDesc2())); importLayout.addRow(new HTML(constants.ImportDRLDesc3())); HorizontalPanel hp = new HorizontalPanel(); Button create = new Button(constants.CreatePackage()); create.addClickHandler( new ClickHandler() { public void onClick(ClickEvent arg0) { if (PackageNameValidator.validatePackageName(nameBox.getText())) { createPackageAction(nameBox.getText(), descBox.getText()); hide(); } else { nameBox.setText(""); Window.alert(constants.PackageNameCorrectHint()); } } }); hp.add(create); Button cancel = new Button(constants.Cancel()); cancel.addClickHandler( new ClickHandler() { public void onClick(ClickEvent arg0) { hide(); } }); hp.add(cancel); newPackageLayout.addAttribute("", hp); }
public PackageBuilderWidget(final PackageConfigData conf, ClientFactory clientFactory) { this.conf = conf; this.clientFactory = clientFactory; // UI above the results table FormStyleLayout layout = new FormStyleLayout(); final VerticalPanel container = new VerticalPanel(); final VerticalPanel buildResults = new VerticalPanel(); RadioButton wholePackageRadioButton = new RadioButton("action", constants.BuildWholePackage()); RadioButton builtInSelectorRadioButton = new RadioButton("action", constants.BuildPackageUsingBuiltInSelector()); RadioButton customSelectorRadioButton = new RadioButton("action", constants.BuildPackageUsingCustomSelector()); wholePackageRadioButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(true); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(false); buildMode = "buildWholePackage"; } }); builtInSelectorRadioButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(false); builtInSelectorLayout.setVisible(true); customSelectorLayout.setVisible(false); buildMode = "BuiltInSelector"; } }); customSelectorRadioButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(false); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(true); buildMode = "customSelector"; } }); VerticalPanel verticalPanel = new VerticalPanel(); HorizontalPanel wholePackageRadioButtonPanel = new HorizontalPanel(); wholePackageRadioButtonPanel.add(wholePackageRadioButton); wholePackageRadioButtonPanel.add( new InfoPopup(constants.BuildWholePackage(), constants.BuildWholePackageTip())); verticalPanel.add(wholePackageRadioButtonPanel); HorizontalPanel builtInSelectorRadioButtonPanel = new HorizontalPanel(); builtInSelectorRadioButtonPanel.add(builtInSelectorRadioButton); builtInSelectorRadioButtonPanel.add( new InfoPopup(constants.BuiltInSelector(), constants.BuiltInSelectorTip())); verticalPanel.add(builtInSelectorRadioButtonPanel); HorizontalPanel customSelectorRadioButtonPanel = new HorizontalPanel(); customSelectorRadioButtonPanel.add(customSelectorRadioButton); customSelectorRadioButtonPanel.add( new InfoPopup(constants.CustomSelector(), constants.SelectorTip())); verticalPanel.add(customSelectorRadioButtonPanel); layout.addAttribute("", verticalPanel); wholePackageRadioButton.setValue(true); buildWholePackageLayout.setVisible(true); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(false); // Build whole package layout layout.addRow(buildWholePackageLayout); // Built-in selector layout builtInSelectorLayout.addRow( new HTML(" <i>" + constants.BuildPackageUsingFollowingAssets() + "</i>")); HorizontalPanel builtInSelectorStatusPanel = new HorizontalPanel(); final CheckBox enableStatusCheckBox = new CheckBox(); enableStatusCheckBox.setValue(false); builtInSelectorStatusPanel.add(enableStatusCheckBox); builtInSelectorStatusPanel.add( new HTML(" <i>" + constants.BuildPackageUsingBuiltInSelectorStatus() + " </i>")); final ListBox statusOperator = new ListBox(); String[] vals = new String[] {"=", "!="}; for (int i = 0; i < vals.length; i++) { statusOperator.addItem(vals[i], vals[i]); } builtInSelectorStatusPanel.add(statusOperator); final TextBox statusValue = new TextBox(); statusValue.setTitle(constants.WildCardsSearchTip()); builtInSelectorStatusPanel.add(statusValue); builtInSelectorLayout.addRow(builtInSelectorStatusPanel); HorizontalPanel builtInSelectorCatPanel = new HorizontalPanel(); final CheckBox enableCategoryCheckBox = new CheckBox(); enableCategoryCheckBox.setValue(false); builtInSelectorCatPanel.add(enableCategoryCheckBox); builtInSelectorCatPanel.add( new HTML(" <i>" + constants.BuildPackageUsingBuiltInSelectorCat() + " </i>")); final ListBox catOperator = new ListBox(); String[] catVals = new String[] {"=", "!="}; for (int i = 0; i < catVals.length; i++) { catOperator.addItem(catVals[i], catVals[i]); } builtInSelectorCatPanel.add(catOperator); final CategoryExplorerWidget catChooser = new CategoryExplorerWidget( new CategorySelectHandler() { public void selected(String selectedPath) {} }); ScrollPanel catScroll = new ScrollPanel(catChooser); catScroll.setAlwaysShowScrollBars(true); catScroll.setSize("300px", "130px"); builtInSelectorCatPanel.add(catScroll); builtInSelectorLayout.addRow(builtInSelectorCatPanel); layout.addRow(builtInSelectorLayout); // Custom selector layout customSelectorLayout.setVisible(false); HorizontalPanel customSelectorPanel = new HorizontalPanel(); customSelectorPanel.add( new HTML( " <i>" + constants.BuildPackageUsingCustomSelectorSelector() + " </i>")); // NON-NLS final ListBox customSelector = new ListBox(); customSelector.setTitle(constants.WildCardsSearchTip()); customSelectorPanel.add(customSelector); loadCustomSelectorList(customSelector); customSelectorLayout.addRow(customSelectorPanel); layout.addRow(customSelectorLayout); final Button b = new Button(constants.BuildPackage()); b.setTitle(constants.ThisWillValidateAndCompileAllTheAssetsInAPackage()); b.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { doBuild( buildResults, statusOperator.getValue(statusOperator.getSelectedIndex()), statusValue.getText(), enableStatusCheckBox.getValue(), catOperator.getValue(catOperator.getSelectedIndex()), catChooser.getSelectedPath(), enableCategoryCheckBox.getValue(), customSelector.getSelectedIndex() != -1 ? customSelector.getValue(customSelector.getSelectedIndex()) : null); } }); HorizontalPanel buildStuff = new HorizontalPanel(); buildStuff.add(b); layout.addAttribute(constants.BuildBinaryPackage(), buildStuff); layout.addRow( new HTML("<i><small>" + constants.BuildingPackageNote() + "</small></i>")); // NON-NLS container.add(layout); // The build results container.add(buildResults); // UI below the results table layout = new FormStyleLayout(); Button snap = new Button(constants.CreateSnapshotForDeployment()); snap.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { showSnapshotDialog(conf.getName(), null); } }); layout.addAttribute(constants.TakeSnapshot(), snap); container.add(layout); initWidget(container); }