List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setInitialWidth
public ModalWindow setInitialWidth(final int initialWidth)
From source file:org.apache.syncope.console.pages.panels.PoliciesPanel.java
License:Apache License
public PoliciesPanel(final String id, final PageReference pageRef, final PolicyType policyType) { super(id);//ww w . 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<IColumn<AbstractPolicyTO, String>>(); columns.add(new PropertyColumn<AbstractPolicyTO, String>(new ResourceModel("id"), "id", "id")); 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.getId(), policyTO.getClass()); info(getString(Constants.OPERATION_SUCCEEDED)); } catch (SyncopeClientException e) { error(getString(Constants.OPERATION_ERROR)); LOG.error("While deleting policy {}({})", policyTO.getId(), 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.getAllAllowedRoles("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.console.pages.PolicyModalPage.java
License:Apache License
public PolicyModalPage(final PageReference pageRef, final ModalWindow window, final T policyTO) { super();//from www . j a v a2 s . c o m final Form<?> form = new Form<Void>(FORM); form.setOutputMarkupId(true); add(form); final AjaxTextFieldPanel policyid = new AjaxTextFieldPanel("id", "id", new PropertyModel<String>(policyTO, "id")); policyid.setEnabled(false); policyid.setStyleSheet("ui-widget-content ui-corner-all short_fixedsize"); form.add(policyid); final AjaxTextFieldPanel description = new AjaxTextFieldPanel("description", "description", new PropertyModel<String>(policyTO, "description")); description.addRequiredLabel(); description.setStyleSheet("ui-widget-content ui-corner-all medium_dynamicsize"); form.add(description); final AjaxDropDownChoicePanel<PolicyType> type = new AjaxDropDownChoicePanel<PolicyType>("type", "type", new PropertyModel<PolicyType>(policyTO, "type")); switch (policyTO.getType()) { case GLOBAL_ACCOUNT: case ACCOUNT: type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_ACCOUNT, PolicyType.ACCOUNT })); break; case GLOBAL_PASSWORD: case PASSWORD: type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_PASSWORD, PolicyType.PASSWORD })); break; case GLOBAL_SYNC: case SYNC: type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_SYNC, PolicyType.SYNC })); default: } type.setChoiceRenderer(new PolicyTypeRenderer()); type.addRequiredLabel(); form.add(type); // Authentication resources - only for AccountPolicyTO Fragment fragment; if (policyTO instanceof AccountPolicyTO) { fragment = new Fragment("forAccountOnly", "authResourcesFragment", form); final List<String> resourceNames = new ArrayList<String>(); for (ResourceTO resource : resourceRestClient.getAll()) { resourceNames.add(resource.getName()); } fragment.add(new AjaxPalettePanel<String>("authResources", new PropertyModel<List<String>>(policyTO, "resources"), new ListModel<String>(resourceNames))); } else { fragment = new Fragment("forAccountOnly", "emptyFragment", form); } form.add(fragment); // final AbstractPolicySpec policy = getPolicySpecification(policyTO); form.add(new PolicyBeanPanel("panel", policy)); final ModalWindow mwindow = new ModalWindow("metaEditModalWin"); mwindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY); mwindow.setInitialHeight(WIN_HEIGHT); mwindow.setInitialWidth(WIN_WIDTH); mwindow.setCookieName("meta-edit-modal"); add(mwindow); List<IColumn<String, String>> resColumns = new ArrayList<IColumn<String, String>>(); resColumns.add(new AbstractColumn<String, String>(new StringResourceModel("name", this, null, "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public void populateItem(final Item<ICellPopulator<String>> cellItem, final String componentId, final IModel<String> rowModel) { cellItem.add(new Label(componentId, rowModel.getObject())); } }); resColumns.add(new AbstractColumn<String, String>(new StringResourceModel("actions", this, null, "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public String getCssClass() { return "action"; } @Override public void populateItem(final Item<ICellPopulator<String>> cellItem, final String componentId, final IModel<String> model) { final String resource = model.getObject(); final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference()); 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; @Override public Page createPage() { return new ResourceModalPage(PolicyModalPage.this.getPageReference(), mwindow, resourceRestClient.read(resource), false); } }); mwindow.show(target); } }, ActionLink.ActionType.EDIT, "Resources"); cellItem.add(panel); } }); ISortableDataProvider<String, String> resDataProvider = new SortableDataProvider<String, String>() { private static final long serialVersionUID = 8263758912838836438L; @Override public Iterator<? extends String> iterator(final long first, final long count) { return policyTO.getId() == 0 ? Collections.<String>emptyList().iterator() : policyRestClient.getPolicy(policyTO.getId()).getUsedByResources() .subList((int) first, (int) first + (int) count).iterator(); } @Override public long size() { return policyTO.getId() == 0 ? 0 : policyRestClient.getPolicy(policyTO.getId()).getUsedByResources().size(); } @Override public IModel<String> model(final String object) { return new Model<String>(object); } }; final AjaxFallbackDefaultDataTable<String, String> resources = new AjaxFallbackDefaultDataTable<String, String>( "resources", resColumns, resDataProvider, 10); form.add(resources); List<IColumn<RoleTO, String>> roleColumns = new ArrayList<IColumn<RoleTO, String>>(); roleColumns.add(new PropertyColumn<RoleTO, String>(new ResourceModel("id", "id"), "id", "id")); roleColumns.add(new PropertyColumn<RoleTO, String>(new ResourceModel("name", "name"), "name", "name")); roleColumns.add(new AbstractColumn<RoleTO, String>(new StringResourceModel("actions", this, null, "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public String getCssClass() { return "action"; } @Override public void populateItem(final Item<ICellPopulator<RoleTO>> cellItem, final String componentId, final IModel<RoleTO> model) { final RoleTO role = model.getObject(); final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference()); 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; @Override public Page createPage() { return new RoleModalPage(PolicyModalPage.this.getPageReference(), mwindow, role); } }); mwindow.show(target); } }, ActionLink.ActionType.EDIT, "Roles"); cellItem.add(panel); } }); ISortableDataProvider<RoleTO, String> roleDataProvider = new SortableDataProvider<RoleTO, String>() { private static final long serialVersionUID = 8263758912838836438L; @Override public Iterator<? extends RoleTO> iterator(final long first, final long count) { List<RoleTO> roles = new ArrayList<RoleTO>(); if (policyTO.getId() > 0) { for (Long roleId : policyRestClient.getPolicy(policyTO.getId()).getUsedByRoles() .subList((int) first, (int) first + (int) count)) { roles.add(roleRestClient.read(roleId)); } } return roles.iterator(); } @Override public long size() { return policyTO.getId() == 0 ? 0 : policyRestClient.getPolicy(policyTO.getId()).getUsedByRoles().size(); } @Override public IModel<RoleTO> model(final RoleTO object) { return new Model<RoleTO>(object); } }; final AjaxFallbackDefaultDataTable<RoleTO, String> roles = new AjaxFallbackDefaultDataTable<RoleTO, String>( "roles", roleColumns, roleDataProvider, 10); form.add(roles); mwindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L; @Override public void onClose(final AjaxRequestTarget target) { target.add(resources); target.add(roles); if (isModalResult()) { info(getString(Constants.OPERATION_SUCCEEDED)); feedbackPanel.refresh(target); setModalResult(false); } } }); final AjaxButton submit = new IndicatingAjaxButton(APPLY, new ResourceModel(APPLY)) { private static final long serialVersionUID = -958724007591692537L; @Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { setPolicySpecification(policyTO, policy); try { if (policyTO.getId() > 0) { policyRestClient.updatePolicy(policyTO); } else { policyRestClient.createPolicy(policyTO); } ((BasePage) pageRef.getPage()).setModalResult(true); window.close(target); } catch (Exception e) { LOG.error("While creating policy", e); error(getString(Constants.ERROR) + ": " + e.getMessage()); ((NotificationPanel) getPage().get(Constants.FEEDBACK)).refresh(target); } } @Override protected void onError(final AjaxRequestTarget target, final Form<?> form) { ((NotificationPanel) getPage().get(Constants.FEEDBACK)).refresh(target); } }; form.add(submit); final IndicatingAjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) { private static final long serialVersionUID = -958724007591692537L; @Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { window.close(target); } @Override protected void onError(final AjaxRequestTarget target, final Form<?> form) { } }; cancel.setDefaultFormProcessing(false); form.add(cancel); }
From source file:org.apache.syncope.console.pages.ReportModalPage.java
License:Apache License
private void setupProfile() { final WebMarkupContainer profile = new WebMarkupContainer("profile"); profile.setOutputMarkupId(true);/* www. j a v a 2 s . com*/ form.add(profile); final ModalWindow reportletConfWin = new ModalWindow("reportletConfWin"); reportletConfWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); reportletConfWin.setCookieName("reportlet-conf-win-modal"); reportletConfWin.setInitialHeight(REPORTLET_CONF_WIN_HEIGHT); reportletConfWin.setInitialWidth(REPORTLET_CONF_WIN_WIDTH); reportletConfWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L; @Override public void onClose(final AjaxRequestTarget target) { int foundIdx = -1; if (modalReportletConfOldName != null) { for (int i = 0; i < reportTO.getReportletConfs().size() && foundIdx == -1; i++) { if (reportTO.getReportletConfs().get(i).getName().equals(modalReportletConfOldName)) { foundIdx = i; } } } if (modalReportletConf != null) { if (foundIdx == -1) { reportTO.getReportletConfs().add(modalReportletConf); } else { reportTO.getReportletConfs().set(foundIdx, modalReportletConf); } } target.add(reportlets); } }); add(reportletConfWin); final Label idLabel = new Label("idLabel", new ResourceModel("id")); profile.add(idLabel); final AjaxTextFieldPanel id = new AjaxTextFieldPanel("id", getString("id"), new PropertyModel<String>(reportTO, "id")); id.setEnabled(false); profile.add(id); final Label nameLabel = new Label("nameLabel", new ResourceModel("name")); profile.add(nameLabel); final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", getString("name"), new PropertyModel<String>(reportTO, "name")); profile.add(name); final AjaxTextFieldPanel lastExec = new AjaxTextFieldPanel("lastExec", getString("lastExec"), new DateFormatROModel(new PropertyModel<String>(reportTO, "lastExec"))); lastExec.setEnabled(false); profile.add(lastExec); final AjaxTextFieldPanel nextExec = new AjaxTextFieldPanel("nextExec", getString("nextExec"), new DateFormatROModel(new PropertyModel<String>(reportTO, "nextExec"))); nextExec.setEnabled(false); profile.add(nextExec); reportlets = new ListChoice<AbstractReportletConf>("reportletConfs", new Model<AbstractReportletConf>(), reportTO.getReportletConfs(), new IChoiceRenderer<ReportletConf>() { private static final long serialVersionUID = 1048000918946220007L; @Override public Object getDisplayValue(final ReportletConf object) { return object.getName(); } @Override public String getIdValue(final ReportletConf object, final int index) { return object.getName(); } }) { private static final long serialVersionUID = 4022366881854379834L; @Override protected CharSequence getDefaultChoice(final String selectedValue) { return null; } }; reportlets.setNullValid(true); profile.add(reportlets); reportlets.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { target.add(reportlets); } }); profile.add(new AjaxLink<Void>(ADD_BUTTON_ID) { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { reportletConfWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { modalReportletConfOldName = null; modalReportletConf = null; return new ReportletConfModalPage(null, reportletConfWin, ReportModalPage.this.getPageReference()); } }); reportletConfWin.show(target); } }); profile.add(new AjaxLink<Void>(EDIT_BUTTON_ID) { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { if (reportlets.getModelObject() != null) { reportletConfWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { modalReportletConfOldName = reportlets.getModelObject().getName(); modalReportletConf = null; return new ReportletConfModalPage(reportlets.getModelObject(), reportletConfWin, ReportModalPage.this.getPageReference()); } }); reportletConfWin.show(target); } } }); profile.add(new AjaxLink<Void>(REMOVE_BUTTON_ID) { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { reportTO.getReportletConfs().remove(reportlets.getModelObject()); reportlets.setModelObject(null); target.add(reportlets); } @Override protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) { if (reportlets.getModelObject() != null) { super.updateAjaxAttributes(attributes); final AjaxCallListener ajaxCallListener = new AjaxCallListener() { private static final long serialVersionUID = 7160235486520935153L; @Override public CharSequence getPrecondition(final Component component) { return "if (!confirm('" + getString("confirmDelete") + "')) {return false;}"; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } } }); profile.add(new AjaxLink<Void>(UP_BUTTON_ID) { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { if (reportlets.getModelObject() != null) { moveUp(reportlets.getModelObject()); target.add(reportlets); } } }); profile.add(new AjaxLink<Void>(DOWN_BUTTON_ID) { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { if (reportlets.getModelObject() != null) { moveDown(reportlets.getModelObject()); target.add(reportlets); } } }); }
From source file:org.apache.syncope.console.pages.ReportModalPage.java
License:Apache License
@SuppressWarnings({ "unchecked", "rawtypes" }) private void setupExecutions() { final WebMarkupContainer executions = new WebMarkupContainer("executionContainer"); executions.setOutputMarkupId(true);//from w ww . j ava 2s .c om form.add(executions); final ModalWindow reportExecMessageWin = new ModalWindow("reportExecMessageWin"); reportExecMessageWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); reportExecMessageWin.setCookieName("report-exec-message-win-modal"); add(reportExecMessageWin); final ModalWindow reportExecExportWin = new ModalWindow("reportExecExportWin"); reportExecExportWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); reportExecExportWin.setCookieName("report-exec-export-win-modal"); reportExecExportWin.setInitialHeight(EXEC_EXPORT_WIN_HEIGHT); reportExecExportWin.setInitialWidth(EXEC_EXPORT_WIN_WIDTH); reportExecExportWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L; @Override public void onClose(final AjaxRequestTarget target) { AjaxExportDownloadBehavior behavior = new AjaxExportDownloadBehavior( ReportModalPage.this.exportFormat, ReportModalPage.this.exportExecId); executions.add(behavior); behavior.initiate(target); } }); add(reportExecExportWin); final List<IColumn> columns = new ArrayList<IColumn>(); columns.add(new PropertyColumn(new ResourceModel("id"), "id", "id")); columns.add(new DatePropertyColumn(new ResourceModel("startDate"), "startDate", "startDate")); columns.add(new DatePropertyColumn(new ResourceModel("endDate"), "endDate", "endDate")); columns.add(new PropertyColumn(new ResourceModel("status"), "status", "status")); columns.add(new ActionColumn<ReportExecTO, String>(new ResourceModel("actions", "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public ActionLinksPanel getActions(final String componentId, final IModel<ReportExecTO> model) { final ReportExecTO taskExecutionTO = model.getObject(); final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference()); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { reportExecMessageWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new ExecMessageModalPage(model.getObject().getMessage()); } }); reportExecMessageWin.show(target); } }, ActionLink.ActionType.EDIT, "Reports", StringUtils.hasText(model.getObject().getMessage())); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { reportExecExportWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { ReportModalPage.this.exportExecId = model.getObject().getId(); return new ReportExecResultDownloadModalPage(reportExecExportWin, ReportModalPage.this.getPageReference()); } }); reportExecExportWin.show(target); } }, ActionLink.ActionType.EXPORT, "Reports", ReportExecStatus.SUCCESS.name().equals(model.getObject().getStatus())); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { try { reportRestClient.deleteExecution(taskExecutionTO.getId()); reportTO.getExecutions().remove(taskExecutionTO); info(getString(Constants.OPERATION_SUCCEEDED)); } catch (SyncopeClientException scce) { error(scce.getMessage()); } feedbackPanel.refresh(target); target.add(executions); } }, ActionLink.ActionType.DELETE, "Reports"); return panel; } @Override public Component getHeader(final String componentId) { final ActionLinksPanel panel = new ActionLinksPanel(componentId, new Model(), getPageReference()); panel.add(new ActionLink() { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { if (target != null) { final ReportTO currentReportTO = reportTO.getId() == 0 ? reportTO : reportRestClient.read(reportTO.getId()); reportTO.getExecutions().clear(); reportTO.getExecutions().addAll(currentReportTO.getExecutions()); final AjaxFallbackDefaultDataTable currentTable = new AjaxFallbackDefaultDataTable( "executionsTable", columns, new ReportExecutionsProvider(reportTO), 10); currentTable.setOutputMarkupId(true); target.add(currentTable); executions.addOrReplace(currentTable); } } }, ActionLink.ActionType.RELOAD, TASKS, "list"); return panel; } }); final AjaxFallbackDefaultDataTable table = new AjaxFallbackDefaultDataTable("executionsTable", columns, new ReportExecutionsProvider(reportTO), 10); executions.add(table); }
From source file:org.apache.syncope.console.pages.Users.java
License:Apache License
public Users(final PageParameters parameters) { super(parameters); // Modal window for editing user attributes final ModalWindow editModalWin = new ModalWindow("editModal"); editModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); editModalWin.setInitialHeight(EDIT_MODAL_WIN_HEIGHT); editModalWin.setInitialWidth(EDIT_MODAL_WIN_WIDTH); editModalWin.setCookieName("edit-modal"); add(editModalWin);/*from w w w . jav a 2 s . c o m*/ final AbstractSearchResultPanel searchResult = new UserSearchResultPanel("searchResult", true, null, getPageReference(), restClient); add(searchResult); final AbstractSearchResultPanel listResult = new UserSearchResultPanel("listResult", false, null, getPageReference(), restClient); add(listResult); // create new user final AjaxLink<Void> createLink = new ClearIndicatingAjaxLink<Void>("createLink", getPageReference()) { private static final long serialVersionUID = -7978723352517770644L; @Override protected void onClickInternal(final AjaxRequestTarget target) { editModalWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new EditUserModalPage(Users.this.getPageReference(), editModalWin, new UserTO()); } }); editModalWin.show(target); } }; MetaDataRoleAuthorizationStrategy.authorize(createLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Users", "create")); add(createLink); setWindowClosedReloadCallback(editModalWin); final Form searchForm = new Form("searchForm"); add(searchForm); final UserSearchPanel searchPanel = new UserSearchPanel.Builder("searchPanel").build(); searchForm.add(searchPanel); final ClearIndicatingAjaxButton searchButton = new ClearIndicatingAjaxButton("search", new ResourceModel("search"), getPageReference()) { private static final long serialVersionUID = -958724007591692537L; @Override protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) { final String fiql = searchPanel.buildFIQL(); LOG.debug("FIQL: " + fiql); doSearch(target, fiql, searchResult); Session.get().getFeedbackMessages().clear(); searchPanel.getSearchFeedback().refresh(target); } @Override protected void onError(final AjaxRequestTarget target, final Form<?> form) { searchPanel.getSearchFeedback().refresh(target); } }; searchForm.add(searchButton); searchForm.setDefaultButton(searchButton); }
From source file:org.apache.syncope.console.SyncopeApplication.java
License:Apache License
public void setupNavigationPanel(final WebPage page, final XMLRolesReader xmlRolesReader, final boolean notsel) { final ModalWindow infoModal = new ModalWindow("infoModal"); page.add(infoModal);/*from w w w . j a v a2s . co m*/ infoModal.setInitialWidth(350); infoModal.setInitialHeight(300); infoModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY); infoModal.setCookieName("infoModal"); infoModal.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new InfoModalPage(); } }); final AjaxLink<Page> infoLink = new AjaxLink<Page>("infoLink") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { infoModal.show(target); } }; page.add(infoLink); BookmarkablePageLink<Page> schemaLink = new BookmarkablePageLink<Page>("schema", Schema.class); MetaDataRoleAuthorizationStrategy.authorize(schemaLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Schema", "list")); page.add(schemaLink); schemaLink.add(new Image("schemaIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "schema" + Constants.PNG_EXT))); BookmarkablePageLink<Page> usersLink = new BookmarkablePageLink<Page>("users", Users.class); MetaDataRoleAuthorizationStrategy.authorize(usersLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Users", "list")); page.add(usersLink); usersLink.add(new Image("usersIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "users" + Constants.PNG_EXT))); BookmarkablePageLink<Page> rolesLink = new BookmarkablePageLink<Page>("roles", Roles.class); MetaDataRoleAuthorizationStrategy.authorize(rolesLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Roles", "list")); page.add(rolesLink); rolesLink.add(new Image("rolesIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "roles" + Constants.PNG_EXT))); BookmarkablePageLink<Page> resourcesLink = new BookmarkablePageLink<Page>("resources", Resources.class); MetaDataRoleAuthorizationStrategy.authorize(resourcesLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Resources", "list")); page.add(resourcesLink); resourcesLink.add(new Image("resourcesIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "resources" + Constants.PNG_EXT))); BookmarkablePageLink<Page> todoLink = new BookmarkablePageLink<Page>("todo", Todo.class); MetaDataRoleAuthorizationStrategy.authorize(todoLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Approval", "list")); page.add(todoLink); todoLink.add(new Image("todoIcon", new ContextRelativeResource(IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "todo" + Constants.PNG_EXT))); BookmarkablePageLink<Page> reportLink = new BookmarkablePageLink<Page>("reports", Reports.class); MetaDataRoleAuthorizationStrategy.authorize(reportLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Reports", "list")); page.add(reportLink); reportLink.add(new Image("reportsIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "reports" + Constants.PNG_EXT))); BookmarkablePageLink<Page> configurationLink = new BookmarkablePageLink<Page>("configuration", Configuration.class); MetaDataRoleAuthorizationStrategy.authorize(configurationLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Configuration", "list")); page.add(configurationLink); configurationLink.add(new Image("configurationIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "configuration" + Constants.PNG_EXT))); BookmarkablePageLink<Page> taskLink = new BookmarkablePageLink<Page>("tasks", Tasks.class); MetaDataRoleAuthorizationStrategy.authorize(taskLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Tasks", "list")); page.add(taskLink); taskLink.add(new Image("tasksIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "tasks" + Constants.PNG_EXT))); page.add(new BookmarkablePageLink<Page>("logout", Logout.class)); }
From source file:org.apache.syncope.console.SyncopeApplication.java
License:Apache License
public void setupEditProfileModal(final WebPage page, final UserSelfRestClient userSelfRestClient) { // Modal window for editing user profile final ModalWindow editProfileModalWin = new ModalWindow("editProfileModal"); editProfileModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); editProfileModalWin.setInitialHeight(EDIT_PROFILE_WIN_HEIGHT); editProfileModalWin.setInitialWidth(EDIT_PROFILE_WIN_WIDTH); editProfileModalWin.setCookieName("edit-profile-modal"); page.add(editProfileModalWin);// w w w . ja v a 2 s. co m final AjaxLink<Page> editProfileLink = new AjaxLink<Page>("editProfileLink") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { final UserTO userTO = SyncopeSession.get().isAuthenticated() ? userSelfRestClient.read() : new UserTO(); editProfileModalWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new UserSelfModalPage(page.getPageReference(), editProfileModalWin, userTO); } }); editProfileModalWin.show(target); } }; editProfileLink.add(new Label("username", SyncopeSession.get().getUsername())); if ("admin".equals(SyncopeSession.get().getUsername())) { editProfileLink.setEnabled(false); } page.add(editProfileLink); }
From source file:org.artifactory.webapp.actionable.action.DeleteVersionsAction.java
License:Open Source License
@Override public void onAction(RepoAwareItemEvent event) { RepoAwareActionableItem source = event.getSource(); org.artifactory.fs.ItemInfo info = source.getItemInfo(); RepoPath itemPath = info.getRepoPath(); if (!info.isFolder() && itemPath.getParent() != null) { itemPath = itemPath.getParent(); }/* ww w .j a va2 s. c o m*/ RepositoryService repositoryService = getRepoService(); ItemSearchResults<VersionUnitSearchResult> results = repositoryService.getVersionUnitsUnder(itemPath); List<VersionUnit> versionUnits = Lists.newArrayList(); for (VersionUnitSearchResult result : results.getResults()) { versionUnits.add(result.getVersionUnit()); } ItemEventTargetComponents eventTargetComponents = event.getTargetComponents(); ModalWindow modalWindow = eventTargetComponents.getModalWindow(); WebMarkupContainer nodePanelContainer = eventTargetComponents.getNodePanelContainer(); TreeBrowsePanel browseRepoPanel = (TreeBrowsePanel) nodePanelContainer.getParent(); DeleteVersionsPanel panel = new DeleteVersionsPanel(modalWindow.getContentId(), versionUnits, browseRepoPanel, event.getSource()); BaseModalPanel modalPanel = new PanelNestingBorderedModal(panel); modalPanel.setTitle("Delete Versions"); modalWindow.setContent(modalPanel); AjaxRequestTarget target = event.getTarget(); //VfsQueryDb returns -1 if userQueryLimit was exceeded. boolean exceededQueryLimit = results.getFullResultsCount() == -1; String warnMessage = ""; String bubbleMessage = ""; if (exceededQueryLimit) { modalWindow.setInitialWidth(700); //So that the warning text and the bubble are inline warnMessage = "The results shown are limited. Try executing Delete Versions from a node lower in the " + "hierarchy."; bubbleMessage = "The results shown are limited by the artifactory.search.userQueryLimit system property." + "\n You can modify it to get more results, but this can dramatically impact performance on large " + "repositories."; } Label label = new Label("largeQueryWarn", warnMessage); HelpBubble bubble = new HelpBubble("largeQueryWarn.help", bubbleMessage); panel.add(label); panel.add(bubble); label.setVisible(exceededQueryLimit); bubble.setVisible(exceededQueryLimit); modalWindow.show(target); }
From source file:org.brixcms.plugin.prototype.ManagePrototypesPanel.java
License:Apache License
public ManagePrototypesPanel(String id, final IModel<Workspace> model) { super(id, model); setOutputMarkupId(true);//w ww.ja v a 2 s . co m IModel<List<Workspace>> prototypesModel = new LoadableDetachableModel<List<Workspace>>() { @Override protected List<Workspace> load() { List<Workspace> list = PrototypePlugin.get().getPrototypes(); return getBrix().filterVisibleWorkspaces(list, Context.ADMINISTRATION); } }; Form<Void> modalWindowForm = new Form<Void>("modalWindowForm"); add(modalWindowForm); final ModalWindow modalWindow = new ModalWindow("modalWindow"); modalWindow.setInitialWidth(64); modalWindow.setWidthUnit("em"); modalWindow.setUseInitialHeight(false); modalWindow.setResizable(false); modalWindow.setTitle(new ResourceModel("selectItems")); modalWindowForm.add(modalWindow); add(new ListView<Workspace>("prototypes", prototypesModel) { @Override protected IModel<Workspace> getListItemModel(IModel<? extends List<Workspace>> listViewModel, int index) { return new WorkspaceModel(listViewModel.getObject().get(index)); } @Override protected void populateItem(final ListItem<Workspace> item) { PrototypePlugin plugin = PrototypePlugin.get(); final String name = plugin.getUserVisibleName(item.getModelObject(), false); item.add(new Label("label", name)); item.add(new Link<Void>("browse") { @Override public void onClick() { model.setObject(item.getModelObject()); } }); item.add(new AjaxLink<Void>("restoreItems") { @Override public void onClick(AjaxRequestTarget target) { String prototypeId = item.getModelObject().getId(); String targetId = ManagePrototypesPanel.this.getModelObject().getId(); Panel panel = new RestoreItemsPanel(modalWindow.getContentId(), prototypeId, targetId); modalWindow.setTitle(new ResourceModel("selectItems")); modalWindow.setContent(panel); modalWindow.show(target); } @Override public boolean isVisible() { Workspace target = ManagePrototypesPanel.this.getModelObject(); Action action = new RestorePrototypeAction(Context.ADMINISTRATION, item.getModelObject(), target); return getBrix().getAuthorizationStrategy().isActionAuthorized(action); } }); item.add(new Link<Void>("delete") { @Override public void onClick() { Workspace prototype = item.getModelObject(); prototype.delete(); } @Override public boolean isVisible() { Action action = new DeletePrototypeAction(Context.ADMINISTRATION, item.getModelObject()); return getBrix().getAuthorizationStrategy().isActionAuthorized(action); } }); } }); Form<Object> form = new Form<Object>("form") { @Override public boolean isVisible() { Workspace current = ManagePrototypesPanel.this.getModelObject(); Action action = new CreatePrototypeAction(Context.ADMINISTRATION, current); return getBrix().getAuthorizationStrategy().isActionAuthorized(action); } }; TextField<String> prototypeName = new TextField<String>("prototypeName", new PropertyModel<String>(this, "prototypeName")); form.add(prototypeName); prototypeName.setRequired(true); prototypeName.add(new UniquePrototypeNameValidator()); final FeedbackPanel feedback; add(feedback = new FeedbackPanel("feedback")); feedback.setOutputMarkupId(true); form.add(new AjaxButton("submit") { @Override public void onSubmit(AjaxRequestTarget target, Form<?> form) { String workspaceId = ManagePrototypesPanel.this.getModelObject().getId(); CreatePrototypePanel panel = new CreatePrototypePanel(modalWindow.getContentId(), workspaceId, ManagePrototypesPanel.this.prototypeName); modalWindow.setContent(panel); modalWindow.setTitle(new ResourceModel("selectItemsToCreate")); modalWindow.setWindowClosedCallback(new WindowClosedCallback() { public void onClose(AjaxRequestTarget target) { target.addComponent(ManagePrototypesPanel.this); } }); modalWindow.show(target); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.addComponent(feedback); } }); add(form); }
From source file:org.dcm4chee.web.war.tc.TCResultPanel.java
License:LGPL
@SuppressWarnings("serial") public TCResultPanel(final String id, final TCListModel model, final IModel<Boolean> trainingModeModel) { super(id, model != null ? model : new TCListModel()); setOutputMarkupId(true);/*from w ww. j a v a2 s . c o m*/ stPermHelper = StudyPermissionHelper.get(); initWebviewerLinkProvider(); add(msgWin); final ModalWindow modalWindow = new ModalWindow("modal-window"); add(modalWindow); final ModalWindow forumWindow = new ModalWindow("forum-window"); add(forumWindow); final TCStudyListPage studyPage = new TCStudyListPage(); final ModalWindow studyWindow = new ModalWindow("study-window"); studyWindow.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = 1L; public Page createPage() { return studyPage; } }); add(studyWindow); tclistProvider = new SortableTCListProvider((TCListModel) getDefaultModel()); final TCAttributeVisibilityStrategy attrVisibilityStrategy = new TCAttributeVisibilityStrategy( trainingModeModel); final DataView<TCModel> dataView = new DataView<TCModel>("row", tclistProvider) { private final StudyListLocal dao = (StudyListLocal) JNDIUtils.lookup(StudyListLocal.JNDI_NAME); private final Map<String, List<String>> studyActions = new HashMap<String, List<String>>(); @Override protected void populateItem(final Item<TCModel> item) { final TCModel tc = item.getModelObject(); final StringBuilder jsStopEventPropagationInline = new StringBuilder( "var event=arguments[0] || window.event; if (event.stopPropagation) {event.stopPropagation();} else {event.cancelBubble=True;};"); item.setOutputMarkupId(true); item.add(new TCMultiLineLabel("title", new AbstractReadOnlyModel<String>() { public String getObject() { if (!attrVisibilityStrategy.isAttributeVisible(TCAttribute.Title)) { return TCUtilities.getLocalizedString("tc.case.text") + " " + tc.getId(); } return tc.getTitle(); } }, new AutoClampSettings(40))); item.add(new TCMultiLineLabel("abstract", new AbstractReadOnlyModel<String>() { public String getObject() { if (!attrVisibilityStrategy.isAttributeVisible(TCAttribute.Abstract)) { return TCUtilities.getLocalizedString("tc.obfuscation.text"); } return tc.getAbstract(); } }, new AutoClampSettings(40))); item.add(new TCMultiLineLabel("author", new AbstractReadOnlyModel<String>() { public String getObject() { if (!attrVisibilityStrategy.isAttributeVisible(TCAttribute.AuthorName)) { return TCUtilities.getLocalizedString("tc.obfuscation.text"); } return tc.getAuthor(); } }, new AutoClampSettings(40))); item.add(new Label("date", new Model<Date>(tc.getCreationDate())) { private static final long serialVersionUID = 1L; @Override public IConverter getConverter(Class<?> type) { return new DateConverter() { private static final long serialVersionUID = 1L; @Override public DateFormat getDateFormat(Locale locale) { if (locale == null) { locale = Locale.getDefault(); } return DateFormat.getDateInstance(DateFormat.MEDIUM, locale); } }; } }); final String stuid = tc.getStudyInstanceUID(); if (dao != null && !studyActions.containsKey(stuid)) { studyActions.put(stuid, dao.findStudyPermissionActions(stuid, stPermHelper.getDicomRoles())); } item.add(Webviewer.getLink(tc, webviewerLinkProviders, stPermHelper, new TooltipBehaviour("tc.result.table.", "webviewer"), modalWindow, new WebviewerLinkClickedCallback() { public void linkClicked(AjaxRequestTarget target) { TCAuditLog.logTFImagesViewed(tc); } }).add(new SecurityBehavior(TCPanel.getModuleName() + ":webviewerInstanceLink"))); final Component viewLink = new IndicatingAjaxLink<String>("tc-view") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { selectTC(item, tc, target); openTC(tc, false, target); } protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("ondblclick", jsStopEventPropagationInline); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { try { return TCPanel.getMaskingBehaviour().getAjaxCallDecorator(); } catch (Exception e) { log.error("Failed to get IAjaxCallDecorator: ", e); } return null; } }.add(new Image("tcViewImg", ImageManager.IMAGE_COMMON_DICOM_DETAILS) .add(new ImageSizeBehaviour("vertical-align: middle;"))) .add(new TooltipBehaviour("tc.result.table.", "view")).setOutputMarkupId(true); final Component editLink = new IndicatingAjaxLink<String>("tc-edit") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { selectTC(item, tc, target); openTC(tc, true, target); } protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("ondblclick", jsStopEventPropagationInline); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { try { return TCPanel.getMaskingBehaviour().getAjaxCallDecorator(); } catch (Exception e) { log.error("Failed to get IAjaxCallDecorator: ", e); } return null; } }.add(new Image("tcEditImg", ImageManager.IMAGE_COMMON_DICOM_EDIT) .add(new ImageSizeBehaviour("vertical-align: middle;"))) .add(new TooltipBehaviour("tc.result.table.", "edit")) .add(new SecurityBehavior(TCPanel.getModuleName() + ":editTC")).setOutputMarkupId(true); final Component studyLink = new IndicatingAjaxLink<String>("tc-study") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { selectTC(item, tc, target); try { TCObject tcObject = TCObject.create(tc); List<TCReferencedStudy> refStudies = tcObject.getReferencedStudies(); if (refStudies != null && !refStudies.isEmpty()) { if (refStudies.size() == 1) { studyPage.setStudyInstanceUID(refStudies.get(0).getStudyUID()); } else { studyPage.setPatientIdAndIssuer(tc.getPatientId(), tc.getIssuerOfPatientId()); } } if (studyPage.getStudyInstanceUID() != null || studyPage.getPatientId() != null) { studyPage.getStudyViewPort().clear(); studyWindow .setTitle(new StringResourceModel("tc.result.studywindow.title", this, null, new Object[] { maskNull(cutAtISOControl(tc.getTitle(), 40), "?"), maskNull(cutAtISOControl(tc.getAbstract(), 25), "?"), maskNull(cutAtISOControl(tc.getAuthor(), 20), "?"), maskNull(tc.getCreationDate(), tc.getCreatedTime()) })); studyWindow.setInitialWidth(1200); studyWindow.setInitialHeight(600); studyWindow.setMinimalWidth(800); studyWindow.setMinimalHeight(400); if (studyWindow.isShown()) { log.warn("###### StudyView is already shown ???!!!"); try { Field showField = ModalWindow.class.getDeclaredField("shown"); showField.setAccessible(true); showField.set(studyWindow, false); } catch (Exception e) { log.error("Failed to reset shown Field from ModalWindow!"); } log.info("###### studyWindow.isShown():" + studyWindow.isShown()); } studyWindow.show(target); } else { log.warn("Showing TC referenced studies discarded: No referened study found!"); msgWin.setInfoMessage(getString("tc.result.studywindow.noStudies")); msgWin.show(target); } } catch (Exception e) { msgWin.setErrorMessage(getString("tc.result.studywindow.failed")); msgWin.show(target); log.error("Unable to show TC referenced studies!", e); } } @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("ondblclick", jsStopEventPropagationInline); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { try { return TCPanel.getMaskingBehaviour().getAjaxCallDecorator(); } catch (Exception e) { log.error("Failed to get IAjaxCallDecorator: ", e); } return null; } }.add(new Image("tcStudyImg", ImageManager.IMAGE_COMMON_SEARCH) .add(new ImageSizeBehaviour("vertical-align: middle;"))) .add(new TooltipBehaviour("tc.result.table.", "showStudy")) .add(new SecurityBehavior(TCPanel.getModuleName() + ":showTCStudy")) .setOutputMarkupId(true); final Component forumLink = new IndicatingAjaxLink<String>("tc-forum") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { try { TCForumPostsPanel content = new TCForumPostsPanel(forumWindow.getContentId(), new Model<String>(TCForumIntegration .get(WebCfgDelegate.getInstance().getTCForumIntegrationType()) .getPostsPageURL(tc))); forumWindow.setInitialHeight(820); forumWindow.setInitialWidth(1024); forumWindow.setContent(content); forumWindow.show(target); } catch (Exception e) { log.error("Unable to open case forum page!", e); } } @Override public boolean isVisible() { return TCForumIntegration .get(WebCfgDelegate.getInstance().getTCForumIntegrationType()) != null; } @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("ondblclick", jsStopEventPropagationInline); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { try { return TCPanel.getMaskingBehaviour().getAjaxCallDecorator(); } catch (Exception e) { log.error("Failed to get IAjaxCallDecorator: ", e); } return null; } }.add(new Image("tcForumImg", ImageManager.IMAGE_TC_FORUM) .add(new ImageSizeBehaviour("vertical-align: middle;"))) .add(new TooltipBehaviour("tc.result.table.", "showForum")).setOutputMarkupId(true); item.add(viewLink); item.add(editLink); item.add(studyLink); item.add(forumLink); item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { if (selected != null && selected.equals(tc)) { return "mouse-out-selected"; } else { return item.getIndex() % 2 == 1 ? "even-mouse-out" : "odd-mouse-out"; } } })); item.add(new AttributeModifier("selected", true, new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { if (selected != null && selected.equals(tc)) { return "selected"; } else { return null; } } })); item.add(new AttributeModifier("onmouseover", true, new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { StringBuffer sbuf = new StringBuffer(); sbuf.append("if ($(this).attr('selected')==null) {"); sbuf.append(" $(this).removeClass();"); sbuf.append(" if (").append(item.getIndex()) .append("%2==1) $(this).addClass('even-mouse-over');"); sbuf.append(" else $(this).addClass('odd-mouse-over');"); sbuf.append("}"); return sbuf.toString(); } })); item.add(new AttributeModifier("onmouseout", true, new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { StringBuffer sbuf = new StringBuffer(); sbuf.append("if ($(this).attr('selected')==null) {"); sbuf.append(" $(this).removeClass();"); sbuf.append(" if (").append(item.getIndex()) .append("%2==1) $(this).addClass('even-mouse-out');"); sbuf.append(" else $(this).addClass('odd-mouse-out');"); sbuf.append("}"); return sbuf.toString(); } })); item.add(new AjaxEventBehavior("onclick") { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { selectTC(item, tc, target); } }); item.add(new AjaxEventBehavior("ondblclick") { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { boolean edit = WebCfgDelegate.getInstance().getTCEditOnDoubleClick(); if (edit) { edit = SecureComponentHelper.isActionAuthorized(editLink, "render"); } openTC(selected, edit, target); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { try { return new IAjaxCallDecorator() { private static final long serialVersionUID = 1L; public final CharSequence decorateScript(CharSequence script) { return "if(typeof showMask == 'function') { showMask(); $('body').css('cursor','wait'); };" + script; } public final CharSequence decorateOnSuccessScript(CharSequence script) { return "hideMask();$('body').css('cursor','');" + script; } public final CharSequence decorateOnFailureScript(CharSequence script) { return "hideMask();$('body').css('cursor','');" + script; } }; } catch (Exception e) { log.error("Failed to get IAjaxCallDecorator: ", e); } return null; } }); } }; dataView.setItemReuseStrategy(new ReuseIfModelsEqualStrategy()); dataView.setItemsPerPage(WebCfgDelegate.getInstance().getDefaultFolderPagesize()); dataView.setOutputMarkupId(true); SortLinkGroup sortGroup = new SortLinkGroup(dataView); add(new SortLink("sortTitle", sortGroup, TCModel.Sorter.Title)); add(new SortLink("sortAbstract", sortGroup, TCModel.Sorter.Abstract)); add(new SortLink("sortDate", sortGroup, TCModel.Sorter.Date)); add(new SortLink("sortAuthor", sortGroup, TCModel.Sorter.Author)); add(dataView); add(new Label("numberOfMatchingInstances", new StringResourceModel("tc.list.numberOfMatchingInstances", this, null, new Object[] { new Model<Integer>() { private static final long serialVersionUID = 1L; @Override public Integer getObject() { return ((TCListModel) TCResultPanel.this.getDefaultModel()).getObject().size(); } } }))); add(new PagingNavigator("navigator", dataView)); }