protected void movePDP(final PDP pdp, final PDPGroup currentGroup) { List<PDPGroup> currentGroups = this.container.getGroups(); Set<PDPGroup> otherGroups = new HashSet<PDPGroup>(currentGroups); if (otherGroups.remove(currentGroup) == false) { logger.warn("Group list inconsistency - failed to move pdp to selected group"); return; } final SelectPDPGroupWindow editor = new SelectPDPGroupWindow(otherGroups, "What was this?"); editor.setCaption("Move PDP to group"); editor.setModal(true); editor.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent event) { if (editor.isSaved()) { self.container.movePDP((PDP) pdp, editor.selectedGroup()); } } }); editor.center(); UI.getCurrent().addWindow(editor); }
public static void editConfiguration(final EntityItem<PIPConfiguration> entity) { final PIPConfigurationEditorWindow editor = new PIPConfigurationEditorWindow(entity); if (entity.isPersistent()) { editor.setCaption("Edit PIP Configuration " + entity.getEntity().getName()); } else { editor.setCaption("Create New PIP Configuration"); } editor.setModal(true); editor.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent event) { if (editor.isSaved()) { if (entity.isPersistent() == false) { ((XacmlAdminUI)UI.getCurrent()).getPIPConfigurations().addEntity(entity.getEntity()); } ((XacmlAdminUI)UI.getCurrent()).refreshPIPConfiguration(); } } }); editor.center(); UI.getCurrent().addWindow(editor); }
@Override public UIApplication<IUnoVaadinApplication> createApplication(final IUnoVaadinApplication application) { UIApplication<IUnoVaadinApplication> uiApplication = cacheMap.get(application); if (uiApplication == null) { uiApplication = delegate.createApplication(application); application.getMainWindow().addListener(new CloseListener() { private static final long serialVersionUID = 8932963545406877665L; @Override public void windowClose(CloseEvent e) { // TODO Check if this is called when the session expired cacheMap.remove(application); } }); cacheMap.put(application, uiApplication); } return uiApplication; }
private void editButtonClick(ClickEvent event) { LoadBalancerDto loadBalancer = (LoadBalancerDto) sender.loadBalancerPanel.loadBalancerTable.getValue(); Window winLoadBalancerEdit; if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(loadBalancer.getLoadBalancer().getType())) { winLoadBalancerEdit = new WinCloudStackLoadBalancerEdit(loadBalancer.getLoadBalancer().getLoadBalancerNo()); } else { winLoadBalancerEdit = new WinLoadBalancerEdit(loadBalancer.getLoadBalancer().getLoadBalancerNo()); } winLoadBalancerEdit.addListener(new Window.CloseListener() { @Override public void windowClose(CloseEvent e) { refreshTable(); } }); getWindow().addWindow(winLoadBalancerEdit); }
private void importFile() throws IllegalArgumentException, IllegalAccessException { final UploadViewForm uploadViewForm = new UploadViewForm(null, null); uploadViewForm.setWidth("300px"); uploadViewForm.setHeight("-1px"); uploadViewForm.addListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { byte[] file = uploadViewForm.getFile(); if(listenerImportButton != null) listenerImportButton.importButtonClick(new ClickNavigationEvent(btnImport, file, e.getComponent())); } }); getApplication().getMainWindow().addWindow(uploadViewForm); }
private void openLogWindow() { Window w = new Window("Log"); w.center(); w.setWidth("80%"); w.setHeight("80%"); w.setContent(logView); logView.setSizeFull(); UI.getCurrent().addWindow(w); setEnabled(false); w.addCloseListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { ShowLogButton.this.setEnabled(true); } }); }
/** * {@inheritDoc} */ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void buttonClick(ClickEvent event) { final TableComponent<?> table = getTable(); VaadinView view = table.getEditorView(); Object bean = BeanUtils.instantiate(table.getEntityClass()); view.setModel(bean); ViewDialog dialog = table.getGuiFactory().newViewDialog(view); dialog.setModal(this.modal); dialog.addCloseListener(new CloseListener() { public void windowClose(CloseEvent e) { table.refresh(); } }); table.getUI().addWindow(dialog); }
public static void editResolver(final EntityItem<PIPResolver> entity) { final PIPResolverEditorWindow window = new PIPResolverEditorWindow(entity); window.setModal(true); window.center(); if (entity.isPersistent()) { window.setCaption("Edit Resolver"); } else { window.setCaption("Create Resolver"); } window.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { // // Did the user click "save"? // if (window.isSaved() == false) { return; } // // Adding a new entity? // if (entity.isPersistent() == false) { // // Yes - let's official add it // ((XacmlAdminUI)UI.getCurrent()).getPIPResolvers().addEntity(entity.getEntity()); ((XacmlAdminUI)UI.getCurrent()).refreshPIPConfiguration(); } } }); UI.getCurrent().addWindow(window); }
protected void renamePolicy(final File policy) { // // Run the rename window // final RenamePolicyFileWindow window = new RenamePolicyFileWindow(policy.getName()); window.setCaption("Rename Policy"); window.setModal(true); window.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent event) { String newFilename = window.getNewFilename(); if (newFilename == null) { // // User cancelled // return; } Path newPolicy = Paths.get(policy.getParent(), newFilename); if (Files.exists(newPolicy)) { Notification.show("Cannot rename to an existing file", Notification.Type.ERROR_MESSAGE); return; } try { if (policy.renameTo(newPolicy.toFile()) == false) { throw new Exception("No known error, rename failed"); } self.treeContainer.updateItem(newPolicy.getParent().toFile()); } catch (Exception e) { Notification.show("Failed to rename file: " + e.getLocalizedMessage()); } } }); window.center(); UI.getCurrent().addWindow(window); }
public void showCloudEditWindow() { MyCloudManage window = new MyCloudManage(); window.addListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { sender.initialize(); sender.refresh(); } }); getApplication().getMainWindow().addWindow(window); }
private void addButtonClick(ClickEvent event) { WinServiceAdd winServiceAdd = new WinServiceAdd(); winServiceAdd.addListener(new Window.CloseListener() { @Override public void windowClose(CloseEvent e) { refreshTable(); } }); getWindow().addWindow(winServiceAdd); }
private void editButtonClick(Button.ClickEvent event) { ComponentDto component = (ComponentDto) sender.servicePanel.serviceTable.getValue(); WinServiceEdit winServiceEdit = new WinServiceEdit(component.getComponent().getComponentNo()); winServiceEdit.addListener(new Window.CloseListener() { @Override public void windowClose(CloseEvent e) { refreshTable(); } }); getWindow().addWindow(winServiceEdit); }
private void addButtonClick(ClickEvent event) { WinServerAdd winServerAdd = new WinServerAdd(); winServerAdd.addListener(new Window.CloseListener() { @Override public void windowClose(CloseEvent e) { refreshTable(); } }); getWindow().addWindow(winServerAdd); }
private void editButtonClick(Button.ClickEvent event) { InstanceDto instance = (InstanceDto) sender.serverPanel.serverTable.getValue(); WinServerEdit winServerEdit = new WinServerEdit(instance.getInstance().getInstanceNo()); winServerEdit.addListener(new Window.CloseListener() { @Override public void windowClose(CloseEvent e) { refreshTable(); } }); getWindow().addWindow(winServerEdit); }
private void addButtonClick(ClickEvent event) { WinLoadBalancerAdd winLoadBalancerAdd = new WinLoadBalancerAdd(); winLoadBalancerAdd.addListener(new Window.CloseListener() { @Override public void windowClose(CloseEvent e) { refreshTable(); } }); getWindow().addWindow(winLoadBalancerAdd); }
public void showLogin() { WinLogin winLogin = new WinLogin(); winLogin.addListener(new Window.CloseListener() { @Override public void windowClose(CloseEvent e) { // ログインに成功した場合 Long userNo = ViewContext.getUserNo(); if (userNo != null) { topBar.loginSuccess(); } } }); getApplication().getMainWindow().addWindow(winLogin); }
@Override public void windowClose(CloseEvent event) { Window source = event.getWindow(); if (source == confirmUpgrade) { if (confirmUpgrade.getDecision()) { try { UpgradeUtils.doSystemUpgrade(app, this, getLebSettingsAnlegen(LebSettingsContainer.getLebSettings())); } catch (Exception e) { e.printStackTrace(); app.getMainWindow().showNotification("Fehler beim L�schen! Bitte wenden Sie sich an den Administrator!", Notification.TYPE_ERROR_MESSAGE); } } } }
@Override public void windowClose(CloseEvent event) { final Window source = event.getWindow(); unlockLasos(source); refreshPage(); for (Window mainWindow : getWindows()) { for (Window window : mainWindow.getChildWindows()) { if (window instanceof SchuelerlisteAnzeigen) { ((SchuelerlisteAnzeigen) window).refreshPage(); } else if (window instanceof PflichtfaecherlisteAnzeigen) { ((PflichtfaecherlisteAnzeigen) window).refreshPage(); } else if (window instanceof KurseZuordnen) { ((KurseZuordnen) window).refreshPage(); } else if (window instanceof VersetzungsvermerklisteAnzeigen) { ((VersetzungsvermerklisteAnzeigen) window).refreshPage(); } else if (window instanceof FachschuelerlisteAnzeigen) { ((FachschuelerlisteAnzeigen) window).refreshPage(); } else if (window instanceof SchuelerfachlisteAnzeigen) { ((SchuelerfachlisteAnzeigen) window).refreshPage(); } else if (window instanceof KlassenlehrerDashboard) { ((KlassenlehrerDashboard) window).refreshPage(); } else if (window instanceof FachlehrerDashboard) { ((FachlehrerDashboard) window).refreshPage(); } else if (window instanceof FachdefinitionlisteAnzeigen) { ((FachdefinitionlisteAnzeigen) window).refreshPage(); } else if (window instanceof FachbezeichnungenLeblisteAnzeigen) { ((FachbezeichnungenLeblisteAnzeigen) window).refreshPage(); } else if (window instanceof KlassenlisteAnzeigen) { ((KlassenlisteAnzeigen) window).refreshPage(); } } } }
protected void editCSVAttribute(final Table table, final ResolverAttribute request) { assert(this.isCSV()); // // Prompt for the column // final ColumnSelectionWindow window = new ColumnSelectionWindow((request != null ? request.getColumn() : 0)); if (request == null) { window.setCaption("Input the CSV Column for the new attribute"); } else { window.setCaption("Edit the CSV Column for the attribute"); } window.setModal(true); window.center(); window.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { // // Did the user save? // if (window.isSaved() == false) { return; } // // Save it if its not a new // if (request != null) { request.setColumn(window.getColumn()); } // // Now we select the attribute, pass the column // in case this is a brand new attribute. Yeah its messy. // self.editResolverAttribute(table, request, window.getColumn()); } }); window.center(); UI.getCurrent().addWindow(window); }
/** * Creates and shows the ImportFromClipboardWindow. */ public void showImportFromClipboardWindow() { final ImportFromClipboardWindow importWindow = new ImportFromClipboardWindow(type.getSimpleName(), getImportPropertiesLabel(type.getSimpleName())); importWindow.setModal(true); EnterpriseApplication.getInstance().getMainWindow().addWindow(importWindow); importWindow.addListener(new Window.CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { importFromClipboard(importWindow.getClipboardContent(), true); } }); }
@Override public void windowClose(CloseEvent e) { clearFields(); state = null; source = null; window = null; }
/** * Build and configure the Window to use to display a View. * @param navigationState Navigation state * @param view View to display * @param viewName View name * @param viewConfiguration View configurator * @param windowConfigurator Optional Window configurator * @return Window to use to display the given View */ @SuppressWarnings("serial") protected Window buildViewWindow(final String navigationState, final View view, final String viewName, final ViewConfiguration viewConfiguration, Consumer<ViewWindowConfigurator> windowConfigurator) { // window String caption = null; if (viewConfiguration != null) { caption = LocalizationContext.translate(viewConfiguration.getCaptionMessageCode(), viewConfiguration.getCaption(), true); } final DefaultViewWindow wnd = new DefaultViewWindow(caption, navigationState); wnd.setWidth(ViewWindowConfigurator.DEFAULT_WINDOW_WIDTH); wnd.setHeight(ViewWindowConfigurator.DEFAULT_WINDOW_WIDTH); wnd.setClosable(true); wnd.setResizable(true); wnd.setDraggable(true); wnd.addStyleName(ViewWindowConfigurator.DEFAULT_WINDOW_STYLE_NAME); final ViewWindowConfigurator configurator = new DefaultViewWindowConfigurator(wnd); // window configuration if (viewConfiguration != null) { viewConfiguration.accept(configurator); } // default if (defaultViewWindowConfigurator != null) { defaultViewWindowConfigurator.accept(configurator); } // provided if (windowConfigurator != null) { windowConfigurator.accept(configurator); } // force modal wnd.setModal(true); wnd.addCloseListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { onViewWindowClose(navigationState, view, viewConfiguration, e.getWindow()); } }); return wnd; }
@Test public void test() { FWindow window = new FWindow().withAssistivePostfix("postfix") .withAssistivePrefix("prefix") .withAssistiveRole(WindowRole.ALERTDIALOG) .withCloseListener(event -> System.out.println("closed")) .withClosable(false) .withCloseShortcut(ShortcutAction.KeyCode.ENTER, null) .withDraggable(false) .withModal(true) .withResizable(false) .withResizeLazy(true) .withResizeListener(event -> System.out.println("resized")) .withTabStopBottomAssistiveText("bottom") .withTabStopTopAssistiveText("top") .withTabStopEnabled(true) .withWindowMode(WindowMode.MAXIMIZED) .withWindowModeChangeListener(event -> System.out.println("mode changed")) .withWindowOrderChangeListener(event -> System.out.println("order changed")) .withPosition(1, 2) .withParent(null); assertEquals("postfix", window.getAssistivePostfix()); assertEquals("prefix", window.getAssistivePrefix()); assertEquals(WindowRole.ALERTDIALOG, window.getAssistiveRole()); assertEquals(1, window.getListeners(CloseEvent.class).size()); assertEquals(1, window.getListeners(ResizeEvent.class).size()); assertEquals(1, window.getListeners(WindowModeChangeEvent.class).size()); assertEquals(1, window.getListeners(WindowOrderChangeEvent.class).size()); assertFalse(window.isClosable()); assertFalse(window.isDraggable()); assertFalse(window.isResizable()); assertTrue(window.isModal()); assertTrue(window.isResizeLazy()); assertTrue(window.isTabStopEnabled()); assertTrue(window.getCloseShortcuts() .stream() .map(CloseShortcut::getKeyCode) .collect(Collectors.toList()) .contains(ShortcutAction.KeyCode.ENTER)); assertEquals("bottom", window.getTabStopBottomAssistiveText()); assertEquals("top", window.getTabStopTopAssistiveText()); assertEquals(WindowMode.MAXIMIZED, window.getWindowMode()); assertEquals(1, window.getPositionX()); assertEquals(2, window.getPositionY()); }
protected void editParameter(final Object source) { // // Make a copy // final Object target = source != null ? source : this.config instanceof PIPConfiguration ? new PIPConfigParam() : new PIPResolverParam(); final PIPParamEditorWindow window = new PIPParamEditorWindow(target); window.setModal(true); window.setCaption((source == null ? "Create New Parameter" : "Edit Parameter")); window.center(); window.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { // // Did user save? // if (window.isSaved() == false) { return; } // // Yes - was it a brand new object? // if (source == null) { // // yes add it to the parent object // if (self.config instanceof PIPConfiguration) { ((PIPConfiguration) self.config).addPipconfigParam((PIPConfigParam) target); } else { ((PIPResolver) self.config).addPipresolverParam((PIPResolverParam) target); } // // add it to the table // Item item = self.tableParameters.addItem(target); if (item == null) { logger.error("Failed to add parameter: " + target); } else { self.tableParameters.select(target); } } else { // // Copy the parameters over // if (source instanceof PIPConfigParam) { ((PIPConfigParam) source).setParamName(((PIPConfigParam) target).getParamName()); ((PIPConfigParam) source).setParamValue(((PIPConfigParam) target).getParamValue()); } else { ((PIPResolverParam) source).setParamName(((PIPResolverParam) target).getParamName()); ((PIPResolverParam) source).setParamValue(((PIPResolverParam) target).getParamValue()); } // // Update the table // self.tableParameters.refreshRowCache(); } } }); UI.getCurrent().addWindow(window); }
protected void importPolicy(final File domain) { // // Get the current domain // if (! domain.isDirectory()) { logger.error("Table must have a directory selected to import the file."); return; } // // Create the upload window // final PolicyUploadWindow upload = new PolicyUploadWindow(Paths.get(domain.toURI())); upload.setCaption("Import Xacml 3.0 Policy File"); upload.setCloseShortcut(KeyCode.ESCAPE); upload.setModal(true); upload.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { // // Was it successful? // Path newFile = upload.getUploadedFile(); if (newFile == null) { return; } // // Add it // self.addPolicyFileToTree(domain, newFile.toFile()); // // Are we importing anything in the policy file? // boolean importAttributes = upload.importAttributes(); boolean importObligations = upload.importObligations(); boolean importAdvice = upload.importAdvice(); if (importAttributes || importObligations || importAdvice) { // // Create our importer // XACMLPolicyImporter importer = new XACMLPolicyImporter(); importer.setImportAttributes(importAttributes); importer.setImportObligations(importObligations); importer.setImportAdvice(importAdvice); importer.setIgnoreStandardAttributes(upload.ignoreStandard()); // // Yes load and scan the policy // new XACMLPolicyScanner(newFile, importer).scan(); } } }); upload.center(); UI.getCurrent().addWindow(upload); }
protected void editPolicySet(final PolicySetType policy, final PolicySetType parent) { logger.info("editPolicySet: " + policy + " parent " + parent); // // Create a copy // final PolicySetType newPolicySet = (policy == null ? new PolicySetType() : XACMLObjectCopy.copy(policy)); // // Create window // final PolicySetEditorWindow window = new PolicySetEditorWindow(newPolicySet); window.setCaption(policy == null ? "Create New Policy Set" : "Edit Policy Set"); window.setModal(true); window.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { // // Did the user click save? // if (window.isSaved() == false) { if (logger.isDebugEnabled()) { logger.debug("user did NOT save"); } return; } // // Was it a new Policy Set? // if (policy == null) { logger.info("adding new policy set " + newPolicySet.getPolicySetId()); // // Yes - new add it in // if (newPolicySet.getTarget() == null) { newPolicySet.setTarget(new TargetType()); } if (self.policyContainer.addItem(newPolicySet, parent) == null) { logger.error("Failed to add new policy set"); } else { self.tree.setCollapsed(parent, false); self.tree.setCollapsed(newPolicySet, false); self.tree.select(newPolicySet); } } else { logger.info("updating new policy set " + newPolicySet.getPolicySetId()); // // No - copy everything // policy.setDescription(newPolicySet.getDescription()); policy.setVersion(newPolicySet.getVersion()); policy.setPolicyCombiningAlgId(newPolicySet.getPolicyCombiningAlgId()); // // Update // self.policyContainer.updateItem(policy); } } }); window.center(); UI.getCurrent().addWindow(window); }
protected void editPolicy(final PolicyType policy, final PolicySetType parent) { // // Create a copy // final PolicyType newPolicy = (policy == null ? new PolicyType() : XACMLObjectCopy.copy(policy)); // // Create window // final PolicyEditorWindow window = new PolicyEditorWindow(newPolicy); window.setCaption(policy == null ? "Create New Policy" : "Edit Policy"); window.setModal(true); window.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { // // Did the user click save? // if (window.isSaved() == false) { return; } // // Was it a new Policy? // if (policy == null) { // // Yes - new add it in // if (newPolicy.getTarget() == null) { newPolicy.setTarget(new TargetType()); } if (self.policyContainer.addItem(newPolicy, parent) == null) { logger.error("Failed to add policy"); } else { self.tree.setCollapsed(parent, false); self.tree.setCollapsed(newPolicy, false); self.tree.select(newPolicy); } } else { // // No - copy everything // policy.setDescription(newPolicy.getDescription()); policy.setVersion(newPolicy.getVersion()); policy.setRuleCombiningAlgId(newPolicy.getRuleCombiningAlgId()); // // Update // self.policyContainer.updateItem(policy); } } }); window.center(); UI.getCurrent().addWindow(window); }
protected void editRule(final RuleType rule, final PolicyType parent) { // // Create a copy // final RuleType newRule = (rule == null ? new RuleType() : XACMLObjectCopy.copy(rule)); // // Create window // final RuleEditorWindow window = new RuleEditorWindow(newRule); window.setCaption(rule == null ? "Create New Rule" : "Edit Rule"); window.setModal(true); window.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { // // Did the user click save? // if (window.isSaved() == false) { return; } // // Was this a new rule? // if (rule == null) { // // Yes a new rule // if (newRule.getTarget() == null) { newRule.setTarget(new TargetType()); } if (self.policyContainer.addItem(newRule, parent) == null) { logger.error("Failed to add new rule"); } else { self.tree.setCollapsed(parent, false); self.tree.setCollapsed(newRule, false); self.tree.select(newRule); } } else { // // No - editing existing rule. Copy everything // rule.setEffect(newRule.getEffect()); rule.setDescription(newRule.getDescription()); self.policyContainer.updateItem(rule); } } }); window.center(); UI.getCurrent().addWindow(window); }
protected void editCondition(final ConditionType condition, final RuleType rule) { // // Make a copy of it first, in case the user manipulates it // and then decides to NOT save it // final ConditionType copyCondition = (condition == null ? new ConditionType() : XACMLObjectCopy.copy(condition)); // // Create the window // final ExpressionBuilderComponent expression = new ExpressionBuilderComponent(copyCondition, (copyCondition.getExpression() != null ? copyCondition.getExpression().getValue() : null), null, self.policyContainer.getVariables()); if (condition == null) { expression.setCaption("Create An Expression For The Condition"); } else { expression.setCaption("Edit The Condition Expression"); } expression.setModal(true); // // Add the close listener // expression.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { // // Did the user hit save? // if (expression.isSaved() == false) { return; } // // Were we creating something new? // if (condition == null) { // // Yes add the new one into the container // if (self.policyContainer.addItem(copyCondition, rule) == null) { logger.error("Failed to add condition"); } else { self.tree.setCollapsed(rule, false); self.tree.setCollapsed(copyCondition, false); self.tree.select(copyCondition); } } else { // // We were editing an existing condition, so copy // over the new edited expression. // condition.setExpression(copyCondition.getExpression()); // // Update the container // self.policyContainer.updateItem(condition); } } }); expression.center(); UI.getCurrent().addWindow(expression); }
protected void editPDP(final PDP pdp, final PDPGroup group) { final EditPDPWindow editor = new EditPDPWindow(pdp, this.container.getGroups()); if (pdp == null) { editor.setCaption("Create New PDP"); } else { editor.setCaption("Edit PDP " + pdp.getId()); } editor.setModal(true); editor.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent event) { if (editor.isSaved() == false) { return; } try { // // Adding a new PDP? // if (pdp == null) { // // Yes tell the container to add it // self.container.addNewPDP(editor.getPDPId(), group, editor.getPDPName(), editor.getPDPDescription()); } else { // // No tell the container to update it // pdp.setName(editor.getPDPName()); pdp.setDescription(editor.getPDPDescription()); self.container.updatePDP(pdp); } } catch (Exception e) { String message = "Unable to create PDP. Reason:\n" + e.getMessage(); logger.error(message); AdminNotification.error(message); } } }); editor.center(); UI.getCurrent().addWindow(editor); }
protected void editPDPGroup(final PDPGroup group) { // // copy the group // final StdPDPGroup copyGroup = (group == null ? null : new StdPDPGroup(group)); // // // final EditPDPGroupWindow editor = new EditPDPGroupWindow(copyGroup, this.container.getGroups(), papEngine); if (group == null) { editor.setCaption("Create PDP Group"); } else { editor.setCaption("Edit PDP Group " + ((PDPGroup) group).getName()); } editor.setModal(true); editor.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent event) { if (editor.isSaved() == false) { return; } if (group == null) { // // Creating a new group // try { self.container.addNewGroup(editor.getGroupName(), editor.getGroupDescription()); } catch (Exception e) { String message = "Unable to create Group. Reason:\n" + e.getMessage(); logger.error(message); AdminNotification.error(message); } } else { // // Update group // self.container.updateGroup(editor.getUpdatedObject()); } } }); editor.center(); UI.getCurrent().addWindow(editor); }
@Override public void windowClose(CloseEvent e) { fireOnCloseEvent(); }
private void showEditFilterPopup() { final Window popup = new Window(); popup.setWidth("400px"); popup.setHeight("400px"); popup.center(); popup.setModal(true); VerticalLayout cont = new VerticalLayout(); cont.setMargin(true); cont.setSpacing(true); final FilterEditor<B> editCopy = theEditor.getCopy(); cont.addComponent(editCopy.getFilterEditView()); popup.setContent(cont); popup.addCloseListener(new CloseListener() { /** * */ private static final long serialVersionUID = 8568957374426173040L; @Override public void windowClose(CloseEvent e) { updateLayout(); } }); // edit's are committed only if OK-button is clicked and // editor's checkAndNotify returns true; // closing the popup with other methods effectively cancel // any edits done Button okButton = StandardUIFactory.getOKButton(localizer); okButton.addClickListener(new ClickListener() { /** * */ private static final long serialVersionUID = -6979725003624509202L; @Override public void buttonClick(ClickEvent event) { if (editCopy.checkAndNotify()) { UI.getCurrent().removeWindow(popup); updateBackingEditor(editCopy); } } }); cont.addComponent(okButton); UI.getCurrent().addWindow(popup); }
protected void editParameter(final Object source) { // // Make a copy // final Object target = (source != null ? source : (this.config instanceof PIPConfiguration ? new PIPConfigParam() : new PIPResolverParam())); final PIPParamEditorWindow window = new PIPParamEditorWindow(target); window.setModal(true); window.setCaption((source == null ? "Create New Parameter" : "Edit Parameter")); window.center(); window.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { // // Did user save? // if (window.isSaved() == false) { return; } // // Yes - was it a brand new object? // if (source == null) { // // yes add it to the parent object // if (self.config instanceof PIPConfiguration) { ((PIPConfiguration) self.config).addPipconfigParam((PIPConfigParam) target); } else { ((PIPResolver) self.config).addPipresolverParam((PIPResolverParam) target); } // // add it to the table // Item item = self.tableParameters.addItem(target); if (item == null) { logger.error("Failed to add parameter: " + target); } else { self.tableParameters.select(target); } } else { // // Copy the parameters over // if (source instanceof PIPConfigParam) { ((PIPConfigParam) source).setParamName(((PIPConfigParam) target).getParamName()); ((PIPConfigParam) source).setParamValue(((PIPConfigParam) target).getParamValue()); } else { ((PIPResolverParam) source).setParamName(((PIPResolverParam) target).getParamName()); ((PIPResolverParam) source).setParamValue(((PIPResolverParam) target).getParamValue()); } // // Update the table // self.tableParameters.refreshRowCache(); } } }); UI.getCurrent().addWindow(window); }