List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow ModalWindow
public ModalWindow(final String id)
From source file:org.apache.syncope.client.console.panels.AbstractProvisioningTasksPanel.java
License:Apache License
public AbstractProvisioningTasksPanel(final String id, final PageReference pageRef, final Class<T> reference) { super(id, pageRef); this.reference = reference; container = new WebMarkupContainer("container"); container.setOutputMarkupId(true);//from www. ja va 2s . c o m add(container); window = new ModalWindow("taskWin"); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setInitialHeight(WIN_HEIGHT); window.setInitialWidth(WIN_WIDTH); window.setCookieName(VIEW_TASK_WIN_COOKIE_NAME); add(window); ((Tasks) pageRef.getPage()).setWindowClosedCallback(window, container); paginatorRows = prefMan.getPaginatorRows(getWebRequest(), Constants.PREF_SYNC_TASKS_PAGINATOR_ROWS); }
From source file:org.apache.syncope.client.console.panels.CamelRoutePanel.java
License:Apache License
public CamelRoutePanel(final String id, final PageReference pageref) { super(id, pageref); editCamelRouteWin = new ModalWindow("editCamelRouteWin"); editCamelRouteWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); editCamelRouteWin.setInitialHeight(CAMELROUTE_WIN_HEIGHT); editCamelRouteWin.setInitialWidth(CAMELROUTE_WIN_WIDTH); editCamelRouteWin.setCookieName("editCamelRouteWin-modal"); add(editCamelRouteWin);// w ww .j a v a2 s . c o m List<IColumn<CamelRouteTO, String>> routeCols = new ArrayList<>(); routeCols.add(new PropertyColumn<CamelRouteTO, String>(new ResourceModel("key"), "key", "key")); routeCols.add(new AbstractColumn<CamelRouteTO, String>(new ResourceModel("actions", "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public String getCssClass() { return "action"; } @Override public void populateItem(final Item<ICellPopulator<CamelRouteTO>> cellItem, final String componentId, final IModel<CamelRouteTO> model) { // Uncomment with something similar once SYNCOPE-156 is completed /* final ActionLinksPanel panel = new * ActionLinksPanel(componentId, model, pageref); * * panel.add(new ActionLink() { * * private static final long serialVersionUID = -3722207913631435501L; * * @Override * public void onClick(final AjaxRequestTarget target) { * * editCamelRouteWin.setPageCreator(new ModalWindow.PageCreator() { * * private static final long serialVersionUID = -7834632442532690940L; * * @Override * public Page createPage() { * return new CamelRouteModalPage(pageref, editCamelRouteWin, * restClient.read(model.getObject().getKey()), false); * } * * }); * * editCamelRouteWin.show(target); * } * }, ActionLink.ActionType.EDIT, "CamelRoutes"); * * cellItem.add(panel); */ } }); final AjaxFallbackDefaultDataTable<CamelRouteTO, String> routeTable = new AjaxFallbackDefaultDataTable<>( "camelRouteTable", routeCols, new CamelRouteProvider(), 50); WebMarkupContainer routeContainer = new WebMarkupContainer("camelRoutesContainer"); routeContainer.add(routeTable); routeContainer.setOutputMarkupId(true); MetaDataRoleAuthorizationStrategy.authorize(routeContainer, ENABLE, Entitlement.ROUTE_LIST); add(routeContainer); }
From source file:org.apache.syncope.client.console.panels.GroupDetailsPanel.java
License:Apache License
public GroupDetailsPanel(final String id, final GroupTO groupTO, final boolean templateMode) { super(id);//from www .j a v a 2s .c o m ownerContainer = new WebMarkupContainer("ownerContainer"); ownerContainer.setOutputMarkupId(true); this.add(ownerContainer); final ModalWindow userOwnerSelectWin = new ModalWindow("userOwnerSelectWin"); userOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); userOwnerSelectWin.setCookieName("create-userOwnerSelect-modal"); this.add(userOwnerSelectWin); final ModalWindow groupOwnerSelectWin = new ModalWindow("groupOwnerSelectWin"); groupOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); groupOwnerSelectWin.setCookieName("create-groupOwnerSelect-modal"); this.add(groupOwnerSelectWin); final ModalWindow parentSelectWin = new ModalWindow("parentSelectWin"); parentSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); parentSelectWin.setCookieName("create-parentSelect-modal"); this.add(parentSelectWin); if (templateMode) { parentFragment = new Fragment("parent", "parentFragment", this); parentModel = new ParentModel(groupTO); @SuppressWarnings("unchecked") final AjaxTextFieldPanel parent = new AjaxTextFieldPanel("parent", "parent", parentModel); parent.setReadOnly(true); parent.setOutputMarkupId(true); parentFragment.add(parent); final AjaxLink<Void> parentSelect = new IndicatingAjaxLink<Void>("parentSelect") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { parentSelectWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new GroupSelectModalPage(getPage().getPageReference(), parentSelectWin, ParentSelectPayload.class); } }); parentSelectWin.show(target); } }; parentFragment.add(parentSelect); final IndicatingAjaxLink<Void> parentReset = new IndicatingAjaxLink<Void>("parentReset") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { parentModel.setObject(null); target.add(parent); } }; parentFragment.add(parentReset); } else { parentFragment = new Fragment("parent", "emptyFragment", this); } parentFragment.setOutputMarkupId(true); this.add(parentFragment); final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(groupTO, "key")); final WebMarkupContainer jexlHelp = JexlHelpUtils.getJexlHelpWebContainer("jexlHelp"); final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtils.getAjaxLink(jexlHelp, "questionMarkJexlHelp"); this.add(questionMarkJexlHelp); questionMarkJexlHelp.add(jexlHelp); if (!templateMode) { name.addRequiredLabel(); questionMarkJexlHelp.setVisible(false); } this.add(name); userOwnerModel = new OwnerModel(groupTO, AttributableType.USER); @SuppressWarnings("unchecked") final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel); userOwner.setReadOnly(true); userOwner.setOutputMarkupId(true); ownerContainer.add(userOwner); final AjaxLink<Void> userOwnerSelect = new IndicatingAjaxLink<Void>("userOwnerSelect") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { userOwnerSelectWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new UserOwnerSelectModalPage(getPage().getPageReference(), userOwnerSelectWin); } }); userOwnerSelectWin.show(target); } }; ownerContainer.add(userOwnerSelect); final IndicatingAjaxLink<Void> userOwnerReset = new IndicatingAjaxLink<Void>("userOwnerReset") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { userOwnerModel.setObject(null); target.add(userOwner); } }; ownerContainer.add(userOwnerReset); groupOwnerModel = new OwnerModel(groupTO, AttributableType.GROUP); @SuppressWarnings("unchecked") final AjaxTextFieldPanel groupOwner = new AjaxTextFieldPanel("groupOwner", "groupOwner", groupOwnerModel); groupOwner.setReadOnly(true); groupOwner.setOutputMarkupId(true); ownerContainer.add(groupOwner); final AjaxLink<Void> groupOwnerSelect = new IndicatingAjaxLink<Void>("groupOwnerSelect") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { parentSelectWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new GroupSelectModalPage(getPage().getPageReference(), parentSelectWin, GroupOwnerSelectPayload.class); } }); parentSelectWin.show(target); } }; ownerContainer.add(groupOwnerSelect); final IndicatingAjaxLink<Void> groupOwnerReset = new IndicatingAjaxLink<Void>("groupOwnerReset") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { groupOwnerModel.setObject(null); target.add(groupOwner); } }; ownerContainer.add(groupOwnerReset); final AjaxCheckBoxPanel inhOwner = new AjaxCheckBoxPanel("inheritOwner", "inheritOwner", new PropertyModel<Boolean>(groupTO, "inheritOwner")); this.add(inhOwner); final AjaxCheckBoxPanel inhTemplates = new AjaxCheckBoxPanel("inheritTemplates", "inheritTemplates", new PropertyModel<Boolean>(groupTO, "inheritTemplates")); inhTemplates.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { send(getPage(), Broadcast.BREADTH, new GroupAttrTemplatesChange(Type.gPlainAttrTemplates, target)); send(getPage(), Broadcast.BREADTH, new GroupAttrTemplatesChange(Type.gDerAttrTemplates, target)); send(getPage(), Broadcast.BREADTH, new GroupAttrTemplatesChange(Type.gVirAttrTemplates, target)); } }); this.add(inhTemplates); }
From source file:org.apache.syncope.client.console.panels.MembershipsPanel.java
License:Apache License
public MembershipsPanel(final String id, final UserTO userTO, final Mode mode, final StatusPanel statusPanel, final PageReference pageRef) { super(id);//from ww w.java2s . c om this.userTO = userTO; this.statusPanel = statusPanel; final WebMarkupContainer membershipsContainer = new WebMarkupContainer("membershipsContainer"); membershipsContainer.setOutputMarkupId(true); add(membershipsContainer); final ModalWindow membWin = new ModalWindow("membershipWin"); membWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); membWin.setCookieName("create-membership-modal"); add(membWin); final ITreeProvider<DefaultMutableTreeNode> treeProvider = new TreeGroupProvider(groupTreeBuilder, true); final DefaultMutableTreeNodeExpansionModel treeModel = new DefaultMutableTreeNodeExpansionModel(); tree = new DefaultNestedTree<DefaultMutableTreeNode>("treeTable", treeProvider, treeModel) { private static final long serialVersionUID = 7137658050662575546L; @Override protected Component newContentComponent(final String id, final IModel<DefaultMutableTreeNode> node) { final DefaultMutableTreeNode treeNode = node.getObject(); final GroupTO groupTO = (GroupTO) treeNode.getUserObject(); return new Folder<DefaultMutableTreeNode>(id, MembershipsPanel.this.tree, node) { private static final long serialVersionUID = 9046323319920426493L; @Override protected boolean isClickable() { return true; } @Override protected IModel<?> newLabelModel(final IModel<DefaultMutableTreeNode> model) { return new Model<String>(groupTO.getDisplayName()); } @Override protected void onClick(final AjaxRequestTarget target) { if (groupTO.getKey() > 0) { membWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = 7661763358801821185L; @Override public Page createPage() { PageReference pageRef = getPage().getPageReference(); for (MembershipTO membTO : membView.getList()) { if (membTO.getGroupKey() == groupTO.getKey()) { return new MembershipModalPage(pageRef, membWin, membTO, mode); } } MembershipTO membTO = new MembershipTO(); membTO.setGroupKey(groupTO.getKey()); membTO.setGroupName(groupTO.getName()); return new MembershipModalPage(pageRef, membWin, membTO, mode); } }); membWin.show(target); } } }; } }; tree.add(new WindowsTheme()); tree.setOutputMarkupId(true); DefaultMutableTreeNodeExpansion.get().expandAll(); this.add(tree); membView = new ListView<MembershipTO>("memberships", new PropertyModel<List<? extends MembershipTO>>(userTO, "memberships")) { private static final long serialVersionUID = 9101744072914090143L; @Override protected void populateItem(final ListItem<MembershipTO> item) { final MembershipTO membershipTO = (MembershipTO) item.getDefaultModelObject(); item.add(new Label("groupId", new Model<Long>(membershipTO.getGroupKey()))); item.add(new Label("groupName", new Model<String>(membershipTO.getGroupName()))); AjaxLink editLink = new ClearIndicatingAjaxLink("editLink", pageRef) { private static final long serialVersionUID = -7978723352517770644L; @Override protected void onClickInternal(final AjaxRequestTarget target) { membWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new MembershipModalPage(getPage().getPageReference(), membWin, membershipTO, mode); } }); membWin.show(target); } }; item.add(editLink); AjaxLink deleteLink = new IndicatingOnConfirmAjaxLink("deleteLink", pageRef) { private static final long serialVersionUID = -7978723352517770644L; @Override protected void onClickInternal(final AjaxRequestTarget target) { userTO.getMemberships().remove(membershipTO); ((UserModalPage) getPage()).getUserTO().getMemberships().remove(membershipTO); target.add(membershipsContainer); GroupTO groupTO = groupTreeBuilder.findGroup(membershipTO.getGroupKey()); Set<String> resourcesToRemove = groupTO == null ? Collections.<String>emptySet() : groupTO.getResources(); if (!resourcesToRemove.isEmpty()) { Set<String> resourcesAssignedViaMembership = new HashSet<>(); for (MembershipTO membTO : userTO.getMemberships()) { groupTO = groupTreeBuilder.findGroup(membTO.getGroupKey()); if (groupTO != null) { resourcesAssignedViaMembership.addAll(groupTO.getResources()); } } resourcesToRemove.removeAll(resourcesAssignedViaMembership); resourcesToRemove.removeAll(userTO.getResources()); } StatusUtils.update(userTO, statusPanel, target, Collections.<String>emptySet(), resourcesToRemove); } }; item.add(deleteLink); } }; membershipsContainer.add(membView); setWindowClosedCallback(membWin, membershipsContainer); }
From source file:org.apache.syncope.client.console.panels.NotificationTasks.java
License:Apache License
public NotificationTasks(final String id, final PageReference pageRef) { super(id, pageRef); container = new WebMarkupContainer("container"); container.setOutputMarkupId(true);/* w w w.j a va 2 s . co m*/ add(container); add(window = new ModalWindow("taskWin")); paginatorRows = prefMan.getPaginatorRows(getWebRequest(), Constants.PREF_NOTIFICATION_TASKS_PAGINATOR_ROWS); table = Tasks.updateTaskTable(getColumns(), new TasksProvider<NotificationTaskTO>(restClient, paginatorRows, getId(), NotificationTaskTO.class), container, 0, pageRef, restClient); container.add(table); window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L; @Override public void onClose(final AjaxRequestTarget target) { target.add(container); if (operationResult) { info(getString(Constants.OPERATION_SUCCEEDED)); target.add(getPage().get(Constants.FEEDBACK)); operationResult = false; } } }); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setInitialHeight(WIN_HEIGHT); window.setInitialWidth(WIN_WIDTH); window.setCookieName(VIEW_TASK_WIN_COOKIE_NAME); @SuppressWarnings("rawtypes") final Form paginatorForm = new Form("PaginatorForm"); @SuppressWarnings({ "unchecked", "rawtypes" }) final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser", new PropertyModel(this, "paginatorRows"), prefMan.getPaginatorChoices()); rowsChooser.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { prefMan.set(getWebRequest(), (WebResponse) getResponse(), Constants.PREF_NOTIFICATION_TASKS_PAGINATOR_ROWS, String.valueOf(paginatorRows)); table = Tasks.updateTaskTable(getColumns(), new TasksProvider<NotificationTaskTO>(restClient, paginatorRows, getId(), NotificationTaskTO.class), container, table == null ? 0 : (int) table.getCurrentPage(), pageRef, restClient); target.add(container); } }); paginatorForm.add(rowsChooser); add(paginatorForm); }
From source file:org.apache.syncope.client.console.panels.PoliciesPanel.java
License:Apache License
public PoliciesPanel(final String id, final PageReference pageRef, final PolicyType policyType) { super(id);/*from w ww .j a v a 2 s . c o m*/ this.pageRef = pageRef; this.policyType = policyType; // Modal window for editing user attributes final ModalWindow mwindow = new ModalWindow("editModalWin"); mwindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY); mwindow.setInitialHeight(MODAL_WIN_HEIGHT); mwindow.setInitialWidth(MODAL_WIN_WIDTH); mwindow.setCookieName("policy-modal"); add(mwindow); // Container for user list final WebMarkupContainer container = new WebMarkupContainer("container"); container.setOutputMarkupId(true); add(container); setWindowClosedCallback(mwindow, container); final List<IColumn<AbstractPolicyTO, String>> columns = new ArrayList<>(); columns.add(new PropertyColumn<AbstractPolicyTO, String>(new ResourceModel("key"), "key", "key")); columns.add(new PropertyColumn<AbstractPolicyTO, String>(new ResourceModel("description"), "description", "description")); columns.add(new AbstractColumn<AbstractPolicyTO, String>(new ResourceModel("type")) { private static final long serialVersionUID = 8263694778917279290L; @Override public void populateItem(final Item<ICellPopulator<AbstractPolicyTO>> cellItem, final String componentId, final IModel<AbstractPolicyTO> model) { cellItem.add(new Label(componentId, getString(model.getObject().getType().name()))); } }); columns.add(new AbstractColumn<AbstractPolicyTO, String>(new ResourceModel("actions", "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public String getCssClass() { return "action"; } @Override public void populateItem(final Item<ICellPopulator<AbstractPolicyTO>> cellItem, final String componentId, final IModel<AbstractPolicyTO> model) { final AbstractPolicyTO policyTO = model.getObject(); final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, pageRef); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { mwindow.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Page createPage() { return new PolicyModalPage(pageRef, mwindow, policyTO); } }); mwindow.show(target); } }, ActionLink.ActionType.EDIT, "Policies"); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { try { policyRestClient.delete(policyTO.getKey(), policyTO.getClass()); info(getString(Constants.OPERATION_SUCCEEDED)); } catch (SyncopeClientException e) { error(getString(Constants.OPERATION_ERROR)); LOG.error("While deleting policy {}({})", policyTO.getKey(), policyTO.getDescription(), e); } target.add(container); ((NotificationPanel) getPage().get(Constants.FEEDBACK)).refresh(target); } }, ActionLink.ActionType.DELETE, "Policies"); cellItem.add(panel); } }); @SuppressWarnings({ "unchecked", "rawtypes" }) final AjaxFallbackDefaultDataTable table = new AjaxFallbackDefaultDataTable("datatable", columns, new PolicyDataProvider(), paginatorRows); container.add(table); final AjaxLink<Void> createButton = new ClearIndicatingAjaxLink<Void>("createLink", pageRef) { private static final long serialVersionUID = -7978723352517770644L; @Override protected void onClickInternal(final AjaxRequestTarget target) { mwindow.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Page createPage() { return new PolicyModalPage(pageRef, mwindow, getPolicyTOInstance(policyType)); } }); mwindow.show(target); } }; add(createButton); MetaDataRoleAuthorizationStrategy.authorize(createButton, ENABLE, xmlRolesReader.getEntitlement("Policies", "create")); @SuppressWarnings("rawtypes") final Form paginatorForm = new Form("PaginatorForm"); @SuppressWarnings({ "unchecked", "rawtypes" }) final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser", new PropertyModel(this, "paginatorRows"), prefMan.getPaginatorChoices()); rowsChooser.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { prefMan.set(getWebRequest(), (WebResponse) getResponse(), Constants.PREF_POLICY_PAGINATOR_ROWS, String.valueOf(paginatorRows)); table.setItemsPerPage(paginatorRows); target.add(container); } }); paginatorForm.add(rowsChooser); add(paginatorForm); }
From source file:org.apache.syncope.client.console.panels.PropagationTasks.java
License:Apache License
public PropagationTasks(final String id, final PageReference pageRef) { super(id, pageRef); container = new WebMarkupContainer("container"); container.setOutputMarkupId(true);/*from w ww . j a v a 2 s . co m*/ add(container); add(window = new ModalWindow("taskWin")); paginatorRows = prefMan.getPaginatorRows(getWebRequest(), Constants.PREF_PROPAGATION_TASKS_PAGINATOR_ROWS); table = Tasks.updateTaskTable(getColumns(), new TasksProvider<PropagationTaskTO>(restClient, paginatorRows, getId(), PropagationTaskTO.class), container, 0, pageRef, restClient); window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L; @Override public void onClose(final AjaxRequestTarget target) { target.add(container); if (operationResult) { info(getString(Constants.OPERATION_SUCCEEDED)); target.add(getPage().get(Constants.FEEDBACK)); operationResult = false; } } }); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setInitialHeight(WIN_HEIGHT); window.setInitialWidth(WIN_WIDTH); window.setCookieName(VIEW_TASK_WIN_COOKIE_NAME); @SuppressWarnings("rawtypes") Form paginatorForm = new Form("PaginatorForm"); @SuppressWarnings({ "unchecked", "rawtypes" }) final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser", new PropertyModel(this, "paginatorRows"), prefMan.getPaginatorChoices()); rowsChooser.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { prefMan.set(getWebRequest(), (WebResponse) getResponse(), Constants.PREF_PROPAGATION_TASKS_PAGINATOR_ROWS, String.valueOf(paginatorRows)); table = Tasks.updateTaskTable(getColumns(), new TasksProvider<>(restClient, paginatorRows, getId(), PropagationTaskTO.class), container, table == null ? 0 : (int) table.getCurrentPage(), pageRef, restClient); target.add(container); } }); paginatorForm.add(rowsChooser); add(paginatorForm); }
From source file:org.apache.syncope.client.console.panels.RoleDetailsPanel.java
License:Apache License
public RoleDetailsPanel(final String id, final RoleTO roleTO, final boolean templateMode) { super(id);/* www . j a va2 s . co m*/ ownerContainer = new WebMarkupContainer("ownerContainer"); ownerContainer.setOutputMarkupId(true); this.add(ownerContainer); final ModalWindow userOwnerSelectWin = new ModalWindow("userOwnerSelectWin"); userOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); userOwnerSelectWin.setCookieName("create-userOwnerSelect-modal"); this.add(userOwnerSelectWin); final ModalWindow roleOwnerSelectWin = new ModalWindow("roleOwnerSelectWin"); roleOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); roleOwnerSelectWin.setCookieName("create-roleOwnerSelect-modal"); this.add(roleOwnerSelectWin); final ModalWindow parentSelectWin = new ModalWindow("parentSelectWin"); parentSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); parentSelectWin.setCookieName("create-parentSelect-modal"); this.add(parentSelectWin); if (templateMode) { parentFragment = new Fragment("parent", "parentFragment", this); parentModel = new ParentModel(roleTO); @SuppressWarnings("unchecked") final AjaxTextFieldPanel parent = new AjaxTextFieldPanel("parent", "parent", parentModel); parent.setReadOnly(true); parent.setOutputMarkupId(true); parentFragment.add(parent); final AjaxLink<Void> parentSelect = new IndicatingAjaxLink<Void>("parentSelect") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { parentSelectWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin, ParentSelectPayload.class); } }); parentSelectWin.show(target); } }; parentFragment.add(parentSelect); final IndicatingAjaxLink<Void> parentReset = new IndicatingAjaxLink<Void>("parentReset") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { parentModel.setObject(null); target.add(parent); } }; parentFragment.add(parentReset); } else { parentFragment = new Fragment("parent", "emptyFragment", this); } parentFragment.setOutputMarkupId(true); this.add(parentFragment); final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(roleTO, "key")); final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp"); final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp"); this.add(questionMarkJexlHelp); questionMarkJexlHelp.add(jexlHelp); if (!templateMode) { name.addRequiredLabel(); questionMarkJexlHelp.setVisible(false); } this.add(name); userOwnerModel = new OwnerModel(roleTO, AttributableType.USER); @SuppressWarnings("unchecked") final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel); userOwner.setReadOnly(true); userOwner.setOutputMarkupId(true); ownerContainer.add(userOwner); final AjaxLink<Void> userOwnerSelect = new IndicatingAjaxLink<Void>("userOwnerSelect") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { userOwnerSelectWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new UserOwnerSelectModalPage(getPage().getPageReference(), userOwnerSelectWin); } }); userOwnerSelectWin.show(target); } }; ownerContainer.add(userOwnerSelect); final IndicatingAjaxLink<Void> userOwnerReset = new IndicatingAjaxLink<Void>("userOwnerReset") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { userOwnerModel.setObject(null); target.add(userOwner); } }; ownerContainer.add(userOwnerReset); roleOwnerModel = new OwnerModel(roleTO, AttributableType.ROLE); @SuppressWarnings("unchecked") final AjaxTextFieldPanel roleOwner = new AjaxTextFieldPanel("roleOwner", "roleOwner", roleOwnerModel); roleOwner.setReadOnly(true); roleOwner.setOutputMarkupId(true); ownerContainer.add(roleOwner); final AjaxLink<Void> roleOwnerSelect = new IndicatingAjaxLink<Void>("roleOwnerSelect") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { parentSelectWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin, RoleOwnerSelectPayload.class); } }); parentSelectWin.show(target); } }; ownerContainer.add(roleOwnerSelect); final IndicatingAjaxLink<Void> roleOwnerReset = new IndicatingAjaxLink<Void>("roleOwnerReset") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { roleOwnerModel.setObject(null); target.add(roleOwner); } }; ownerContainer.add(roleOwnerReset); final AjaxCheckBoxPanel inhOwner = new AjaxCheckBoxPanel("inheritOwner", "inheritOwner", new PropertyModel<Boolean>(roleTO, "inheritOwner")); this.add(inhOwner); final AjaxCheckBoxPanel inhTemplates = new AjaxCheckBoxPanel("inheritTemplates", "inheritTemplates", new PropertyModel<Boolean>(roleTO, "inheritTemplates")); inhTemplates.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rPlainAttrTemplates, target)); send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rDerAttrTemplates, target)); send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rVirAttrTemplates, target)); } }); this.add(inhTemplates); }
From source file:org.apache.syncope.client.console.panels.SchedTasks.java
License:Apache License
public SchedTasks(final String id, final PageReference pageRef) { super(id, pageRef); container = new WebMarkupContainer("container"); container.setOutputMarkupId(true);//from www. j av a2s.c o m add(container); window = new ModalWindow("taskWin"); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setInitialHeight(WIN_HEIGHT); window.setInitialWidth(WIN_WIDTH); window.setCookieName(VIEW_TASK_WIN_COOKIE_NAME); add(window); ((Tasks) pageRef.getPage()).setWindowClosedCallback(window, container); paginatorRows = prefMan.getPaginatorRows(getWebRequest(), Constants.PREF_SCHED_TASKS_PAGINATOR_ROWS); table = Tasks.updateTaskTable(getColumns(), new TasksProvider<SchedTaskTO>(restClient, paginatorRows, getId(), SchedTaskTO.class), container, 0, pageRef, restClient); container.add(table); @SuppressWarnings("rawtypes") Form paginatorForm = new Form("PaginatorForm"); @SuppressWarnings({ "unchecked", "rawtypes" }) final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser", new PropertyModel(this, "paginatorRows"), prefMan.getPaginatorChoices()); rowsChooser.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { prefMan.set(getWebRequest(), (WebResponse) getResponse(), Constants.PREF_SCHED_TASKS_PAGINATOR_ROWS, String.valueOf(paginatorRows)); table = Tasks.updateTaskTable(getColumns(), new TasksProvider<SchedTaskTO>(restClient, paginatorRows, getId(), SchedTaskTO.class), container, table == null ? 0 : (int) table.getCurrentPage(), pageRef, restClient); target.add(container); } }); paginatorForm.add(rowsChooser); add(paginatorForm); AjaxLink createLink = new ClearIndicatingAjaxLink("createLink", pageRef) { private static final long serialVersionUID = -7978723352517770644L; @Override protected void onClickInternal(final AjaxRequestTarget target) { window.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new SchedTaskModalPage(window, new SchedTaskTO(), pageRef); } }); window.show(target); } }; MetaDataRoleAuthorizationStrategy.authorize(createLink, RENDER, xmlRolesReader.getEntitlement(TASKS, "create")); add(createLink); }
From source file:org.apache.syncope.client.console.panels.StatusPanel.java
License:Apache License
public <T extends AbstractAttributableTO> StatusPanel(final String id, final AbstractSubjectTO subject, final List<StatusBean> selectedResources, final PageReference pageref) { super(id);// ww w . j a v a 2 s. c o m connObjectWin = new ModalWindow("connObjectWin"); connObjectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); connObjectWin.setInitialHeight(CONNOBJECT_WIN_HEIGHT); connObjectWin.setInitialWidth(CONNOBJECT_WIN_WIDTH); connObjectWin.setCookieName("connobject-modal"); add(connObjectWin); statusUtils = new StatusUtils(subject instanceof GroupTO ? groupRestClient : userRestClient); connObjects = statusUtils.getConnectorObjects(subject); final List<StatusBean> statusBeans = new ArrayList<>(connObjects.size() + 1); initialStatusBeanMap = new LinkedHashMap<>(connObjects.size() + 1); final StatusBean syncope = new StatusBean(subject, "syncope"); if (subject instanceof UserTO) { syncope.setAccountLink(((UserTO) subject).getUsername()); Status syncopeStatus = Status.UNDEFINED; if (((UserTO) subject).getStatus() != null) { try { syncopeStatus = Status.valueOf(((UserTO) subject).getStatus().toUpperCase()); } catch (IllegalArgumentException e) { LOG.warn("Unexpected status found: {}", ((UserTO) subject).getStatus(), e); } } syncope.setStatus(syncopeStatus); } else if (subject instanceof GroupTO) { syncope.setAccountLink(((GroupTO) subject).getDisplayName()); syncope.setStatus(Status.ACTIVE); } statusBeans.add(syncope); initialStatusBeanMap.put(syncope.getResourceName(), syncope); for (ConnObjectWrapper entry : connObjects) { final StatusBean statusBean = statusUtils.getStatusBean(entry.getAttributable(), entry.getResourceName(), entry.getConnObjectTO(), subject instanceof GroupTO); initialStatusBeanMap.put(entry.getResourceName(), statusBean); statusBeans.add(statusBean); } checkGroup = new CheckGroup<>("group", selectedResources); checkGroup.setOutputMarkupId(true); checkGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -151291731388673682L; @Override protected void onUpdate(final AjaxRequestTarget target) { // ignore } }); add(checkGroup); CheckGroupSelector groupSelector = new CheckGroupSelector("groupselector", checkGroup); if (subject instanceof GroupTO) { groupSelector.setVisible(false); } add(groupSelector); statusBeansListView = new AltListView<StatusBean>("resources", statusBeans) { private static final long serialVersionUID = 4949588177564901031L; @Override protected void populateItem(final ListItem<StatusBean> item) { item.add(statusUtils.getStatusImage("icon", item.getModelObject().getStatus())); final Check<StatusBean> check = new Check<StatusBean>("check", item.getModel(), checkGroup); if (subject instanceof GroupTO) { check.setVisible(false); } item.add(check); item.add(new Label("resource", new ResourceModel(item.getModelObject().getResourceName(), item.getModelObject().getResourceName()))); if (StringUtils.isNotBlank(item.getModelObject().getAccountLink())) { item.add(new Label("accountLink", new ResourceModel(item.getModelObject().getAccountLink(), item.getModelObject().getAccountLink()))); } else { item.add(new Label("accountLink", "")); } final ConnObjectTO connObjectTO = statusUtils.getConnObjectTO( item.getModelObject().getAttributableId(), item.getModelObject().getResourceName(), connObjects); if (pageref == null || connObjectTO == null) { item.add(new Label("connObject", new Model<String>())); } else { final ActionLinksPanel connObject = new ActionLinksPanel("connObject", new Model(), pageref); connObject.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { connObjectWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new ConnObjectModalPage(connObjectTO); } }); connObjectWin.show(target); } }, ActionLink.ActionType.SEARCH, "Resources", "getConnectorObject"); item.add(connObject); } } }; statusBeansListView.setReuseItems(true); checkGroup.add(statusBeansListView); }