protected void showNewPatternDialog() { final FormStylePopup pop = new FormStylePopup(); pop.setTitle(constants.NewFactSelectTheType()); final ListBox types = new ListBox(); for (int i = 0; i < sce.getFactTypes().length; i++) { types.addItem(sce.getFactTypes()[i]); } pop.addAttribute(constants.FactType(), types); final TextBox binding = new TextBox(); pop.addAttribute(constants.Binding(), binding); Button ok = new Button(constants.OK()); ok.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { editingCol.setBoundName(binding.getText()); editingCol.setFactType(types.getItemText(types.getSelectedIndex())); editingCol.setFactField(null); makeLimitedValueWidget(); doPatternLabel(); doFieldLabel(); pop.hide(); } }); pop.addAttribute("", ok); pop.show(); }
private void showFieldChange() { final FormStylePopup pop = new FormStylePopup(); pop.setModal(false); String[] fields = this.sce.getFieldCompletions( FieldAccessorsAndMutators.MUTATOR, this.editingCol.getFactType()); final ListBox box = new ListBox(); for (int i = 0; i < fields.length; i++) { box.addItem(fields[i]); } pop.addAttribute(constants.Field(), box); Button b = new Button(constants.OK()); pop.addAttribute("", b); b.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { editingCol.setFactField(box.getItemText(box.getSelectedIndex())); editingCol.setType( sce.getFieldType(editingCol.getFactType(), editingCol.getFactField())); makeLimitedValueWidget(); doFieldLabel(); pop.hide(); } }); pop.show(); }
private void showEditor(final String dependencyPath) { final FormStylePopup editor = new FormStylePopup(images.management(), "Edit Dependency"); /* editor.addRow(new HTML("<i>" + "Choose the version you want to depend on" + "</i>")); */ editor.addAttribute("Dependency Path: ", new Label(parseDependencyPath(dependencyPath)[0])); final VersionChooser versionChoose = new VersionChooser( parseDependencyPath(dependencyPath)[1], conf.uuid, parseDependencyAssetName(parseDependencyPath(dependencyPath)[0]), new Command() { public void execute() { table.refresh(); } }); editor.addAttribute("Dependency Version: ", versionChoose); HorizontalPanel hp = new HorizontalPanel(); Button save = new Button("Use selected version"); hp.add(save); save.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { String selectedVersion = versionChoose.getSelectedVersionName(); if (Window.confirm( "Are you sure you want to use version: " + selectedVersion + " as dependency?")) { RepositoryServiceFactory.getService() .updateDependency( conf.uuid, encodeDependencyPath( DependencyWidget.parseDependencyPath(dependencyPath)[0], selectedVersion), new GenericCallback<Void>() { public void onSuccess(Void v) { editor.hide(); table.refresh(); } }); } } }); Button cancel = new Button(constants.Cancel()); hp.add(cancel); cancel.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { editor.hide(); } }); editor.addAttribute("", hp); editor.show(); }
protected void showAddFieldPopup(ClickEvent w) { final SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions(); final FormStylePopup popup = new FormStylePopup(images.newexWiz(), constants.AddAField()); final ListBox box = new ListBox(); box.addItem("..."); for (int i = 0; i < fieldCompletions.length; i++) { box.addItem(fieldCompletions[i]); } box.setSelectedIndex(0); popup.addAttribute(constants.AddField(), box); box.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { String fieldName = box.getItemText(box.getSelectedIndex()); String fieldType = completions.getFieldType(variableClass, fieldName); model.addFieldValue(new ActionFieldValue(fieldName, "", fieldType)); setModified(true); getModeller().refreshWidget(); popup.hide(); } }); popup.show(); }
protected void showChangePattern(ClickEvent w) { final ListBox pats = this.loadPatterns(); if (pats.getItemCount() == 0) { showNewPatternDialog(); return; } final FormStylePopup pop = new FormStylePopup(); Button ok = new Button("OK"); HorizontalPanel hp = new HorizontalPanel(); hp.add(pats); hp.add(ok); pop.addAttribute(constants.ChooseExistingPatternToAddColumnTo(), hp); pop.addAttribute("", new HTML(constants.ORwithEmphasis())); Button createPattern = new Button(constants.CreateNewFactPattern()); createPattern.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { pop.hide(); showNewPatternDialog(); } }); pop.addAttribute("", createPattern); ok.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { String[] val = pats.getValue(pats.getSelectedIndex()).split("\\s"); // NON-NLS editingCol.setFactType(val[0]); editingCol.setBoundName(val[1]); editingCol.setFactField(null); makeLimitedValueWidget(); doPatternLabel(); doFieldLabel(); pop.hide(); } }); pop.show(); }
public static void showNewSnapshot(final Command refreshCmd) { final FormStylePopup pop = new FormStylePopup( DroolsGuvnorImages.INSTANCE.snapshot(), Constants.INSTANCE.NewSnapshot()); final RulePackageSelector sel = new RulePackageSelector(); pop.addAttribute(Constants.INSTANCE.ForPackage(), sel); Button ok = new Button(Constants.INSTANCE.OK()); pop.addAttribute("", ok); pop.show(); ok.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { pop.hide(); String pkg = sel.getSelectedPackage(); PackageBuilderWidget.showSnapshotDialog(pkg, refreshCmd); } }); }
private void showTypeChoice(Widget w, final VerifyField con) { final FormStylePopup form = new FormStylePopup(images.newexWiz(), constants.FieldValue()); Button lit = new Button(constants.LiteralValue()); lit.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { con.setNature(FieldData.TYPE_LITERAL); doTypeChosen(form); } }); form.addAttribute( constants.LiteralValue() + ":", widgets(lit, new InfoPopup(constants.LiteralValue(), constants.LiteralValTip()))); form.addRow(new HTML("<hr/>")); form.addRow(new SmallLabel(constants.AdvancedOptions())); // If we are here, then there must be a bound variable compatible with // me Button variable = new Button(constants.BoundVariable()); variable.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { con.setNature(FieldData.TYPE_VARIABLE); doTypeChosen(form); } }); form.addAttribute( constants.AVariable(), widgets(variable, new InfoPopup(constants.ABoundVariable(), constants.BoundVariableTip()))); form.show(); }
private void doPermissionEditor(final String userName, final Map<String, List<String>> perms) { final FormStylePopup editor = new FormStylePopup(images.management(), constants.EditUser0(userName)); editor.addRow(new HTML("<i>" + constants.UserAuthenticationTip() + "</i>")); // now render the actual permissions... VerticalPanel vp = new VerticalPanel(); editor.addAttribute("", doPermsPanel(perms, vp)); HorizontalPanel hp = new HorizontalPanel(); Button save = new Button(constants.SaveChanges()); hp.add(save); editor.addAttribute("", hp); save.addClickHandler(createClickHandlerForSaveButton(userName, perms, editor)); Button cancel = new Button(constants.Cancel()); hp.add(cancel); cancel.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { editor.hide(); } }); editor.show(); }
/** This will display a dialog for creating a snapshot. */ public static void showSnapshotDialog(final String packageName, final Command refreshCmd) { LoadingPopup.showMessage(constants.LoadingExistingSnapshots()); final FormStylePopup form = new FormStylePopup(images.snapshot(), constants.CreateASnapshotForDeployment()); form.addRow(new HTML(constants.SnapshotDescription())); final VerticalPanel vert = new VerticalPanel(); form.addAttribute(constants.ChooseOrCreateSnapshotName(), vert); final List<RadioButton> radioList = new ArrayList<RadioButton>(); final TextBox newName = new TextBox(); final String newSnapshotText = constants.NEW() + ": "; RepositoryServiceFactory.getPackageService() .listSnapshots( packageName, new GenericCallback<SnapshotInfo[]>() { public void onSuccess(SnapshotInfo[] result) { for (int i = 0; i < result.length; i++) { RadioButton existing = new RadioButton("snapshotNameGroup", result[i].getName()); // NON-NLS radioList.add(existing); vert.add(existing); } HorizontalPanel newSnap = new HorizontalPanel(); final RadioButton newSnapRadio = new RadioButton("snapshotNameGroup", newSnapshotText); // NON-NLS newSnap.add(newSnapRadio); newName.setEnabled(false); newSnapRadio.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { newName.setEnabled(true); } }); newSnap.add(newName); radioList.add(newSnapRadio); vert.add(newSnap); LoadingPopup.close(); } }); final TextBox comment = new TextBox(); form.addAttribute(constants.Comment(), comment); Button create = new Button(constants.CreateNewSnapshot()); form.addAttribute("", create); create.addClickHandler( new ClickHandler() { String name = ""; public void onClick(ClickEvent event) { boolean replace = false; for (RadioButton but : radioList) { if (but.getValue()) { name = but.getText(); if (!but.getText().equals(newSnapshotText)) { replace = true; } break; } } if (name.equals(newSnapshotText)) { name = newName.getText(); } if (name.equals("")) { Window.alert(constants.YouHaveToEnterOrChoseALabelNameForTheSnapshot()); return; } LoadingPopup.showMessage(constants.PleaseWaitDotDotDot()); RepositoryServiceFactory.getPackageService() .createPackageSnapshot( packageName, name, replace, comment.getText(), new GenericCallback<java.lang.Void>() { public void onSuccess(Void v) { Window.alert(constants.TheSnapshotCalled0WasSuccessfullyCreated(name)); form.hide(); if (refreshCmd != null) { refreshCmd.execute(); } LoadingPopup.close(); } }); } }); form.show(); }
public void openAdministrationSelection(int id) { switch (id) { case 0: if (!explorerViewCenterPanel.showIfOpen(CATMAN)) { explorerViewCenterPanel.addTab( constants.CategoryManager(), new CategoryManager(), CATMAN); } break; case 1: if (!explorerViewCenterPanel.showIfOpen(ARCHMAN)) { explorerViewCenterPanel.addTab( constants.ArchivedManager(), new ArchivedAssetManager(), ARCHMAN); } break; case 2: if (!explorerViewCenterPanel.showIfOpen(STATEMAN)) { explorerViewCenterPanel.addTab(constants.StateManager(), new StateManager(), STATEMAN); } break; case 3: if (!explorerViewCenterPanel.showIfOpen(BAKMAN)) { explorerViewCenterPanel.addTab(constants.ImportExport(), new BackupManager(), BAKMAN); } break; case 4: if (!explorerViewCenterPanel.showIfOpen(ERROR_LOG)) { explorerViewCenterPanel.addTab(constants.EventLog(), new LogViewer(), ERROR_LOG); } break; case 5: if (!explorerViewCenterPanel.showIfOpen(SECURITY_PERMISSIONS)) { explorerViewCenterPanel.addTab( constants.UserPermissionMappings(), new PermissionViewer(), SECURITY_PERMISSIONS); } break; case 6: Frame aboutInfoFrame = new Frame("../AboutInfo.html"); // NON-NLS FormStylePopup aboutPop = new FormStylePopup(); aboutPop.setWidth(600 + "px"); aboutPop.setTitle(constants.About()); String hhurl = GWT.getModuleBaseURL() + "webdav"; aboutPop.addAttribute(constants.WebDAVURL() + ":", new SmallLabel("<b>" + hhurl + "</b>")); aboutPop.addAttribute(constants.Version() + ":", aboutInfoFrame); aboutPop.show(); break; case 7: if (!explorerViewCenterPanel.showIfOpen(RULE_VERIFIER_MANAGER)) { explorerViewCenterPanel.addTab( constants.RulesVerificationManager(), new RuleVerifierManager(), RULE_VERIFIER_MANAGER); } break; case 8: if (!explorerViewCenterPanel.showIfOpen(REPOCONFIG)) explorerViewCenterPanel.addTab( constants.RepositoryConfig(), new RepoConfigManager(), REPOCONFIG); break; case 9: if (!explorerViewCenterPanel.showIfOpen(WORKSPACES)) explorerViewCenterPanel.addTab( constants.Workspaces(), new WorkspaceManager(), WORKSPACES); break; case 10: openPerspectivesManager(); break; } }