List of usage examples for org.apache.wicket.ajax.markup.html AjaxLink AjaxLink
public AjaxLink(final String id)
From source file:guru.mmp.application.web.template.pages.JobAdministrationPage.java
License:Apache License
/** * Constructs a new <code>JobAdministrationPage</code>. *//*from w w w. j a v a 2 s . c om*/ public JobAdministrationPage() { super("Scheduler"); try { /* * The table container, which allows the table and its associated navigator to be updated * using AJAX. */ WebMarkupContainer tableContainer = new WebMarkupContainer("tableContainer"); tableContainer.setOutputMarkupId(true); add(tableContainer); // The dialog used to confirm the removal of a job RemoveDialog removeDialog = new RemoveDialog(tableContainer); add(removeDialog); // The "addLink" used to add a new job Link<Void> addLink = new Link<Void>("addLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { AddJobPage page = new AddJobPage(getPageReference()); setResponsePage(page); } }; tableContainer.add(addLink); FilteredJobDataProvider dataProvider = new FilteredJobDataProvider(); // The "filterForm" form Form<Void> filterForm = new Form<>("filterForm"); filterForm.setMarkupId("filterForm"); filterForm.setOutputMarkupId(true); // The "filter" field TextField<String> filterField = new TextField<>("filter", new PropertyModel<>(dataProvider, "filter")); filterForm.add(filterField); // The "filterButton" button Button filterButton = new Button("filterButton") { private static final long serialVersionUID = 1000000; @Override public void onSubmit() { } }; filterButton.setDefaultFormProcessing(true); filterForm.add(filterButton); // The "resetButton" button Button resetButton = new Button("resetButton") { private static final long serialVersionUID = 1000000; @Override public void onSubmit() { dataProvider.setFilter(""); } }; filterForm.add(resetButton); tableContainer.add(filterForm); // The job data view DataView<Job> dataView = new DataView<Job>("job", dataProvider) { private static final long serialVersionUID = 1000000; @Override protected void populateItem(Item<Job> item) { item.add(new Label("name", new PropertyModel<String>(item.getModel(), "name"))); item.add(new Label("jobClass", new PropertyModel<String>(item.getModel(), "jobClass"))); item.add(DateLabel.forDatePattern("nextExecution", new PropertyModel<>(item.getModel(), "nextExecution"), "YYYY-MM-dd hh:mm a")); // The "parametersLink" link Link<Void> parametersLink = new Link<Void>("parametersLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { // Job job = item.getModelObject(); // JobParametersPage page = new JobParametersPage(getPageReference(), job.getId()); // // setResponsePage(page); } }; item.add(parametersLink); // The "updateLink" link Link<Void> updateLink = new Link<Void>("updateLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { UpdateJobPage page = new UpdateJobPage(getPageReference(), item.getModel()); setResponsePage(page); } }; item.add(updateLink); // The "removeLink" link AjaxLink<Void> removeLink = new AjaxLink<Void>("removeLink") { private static final long serialVersionUID = 1000000; @Override public void onClick(AjaxRequestTarget target) { Job job = item.getModelObject(); if (job != null) { removeDialog.show(target, job); } else { target.add(tableContainer); } } }; item.add(removeLink); } }; dataView.setItemsPerPage(10); dataView.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance()); tableContainer.add(dataView); tableContainer.add(new PagingNavigator("navigator", dataView)); } catch (Throwable e) { throw new WebApplicationException("Failed to initialise the JobAdministrationPage", e); } }
From source file:guru.mmp.application.web.template.pages.OrganisationAdministrationPage.java
License:Apache License
/** * Constructs a new <code>OrganisationAdministrationPage</code>. *//*w ww.ja v a 2s .c o m*/ public OrganisationAdministrationPage() { super("Organisations"); try { /* * The table container, which allows the table and its associated navigator to be updated * using AJAX. */ WebMarkupContainer tableContainer = new WebMarkupContainer("tableContainer"); tableContainer.setOutputMarkupId(true); add(tableContainer); // The dialog used to confirm the removal of an organisation RemoveDialog removeDialog = new RemoveDialog(tableContainer); add(removeDialog); // The "addLink" used to add a new organisation Link<Void> addLink = new Link<Void>("addLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { setResponsePage(new AddOrganisationPage(getPageReference())); } }; tableContainer.add(addLink); FilteredOrganisationDataProvider dataProvider = new FilteredOrganisationDataProvider(); // The "filterForm" form Form<Void> filterForm = new Form<>("filterForm"); filterForm.setMarkupId("filterForm"); filterForm.setOutputMarkupId(true); // The "filter" field TextField<String> filterField = new TextField<>("filter", new PropertyModel<>(dataProvider, "filter")); filterForm.add(filterField); // The "filterButton" button Button filterButton = new Button("filterButton") { private static final long serialVersionUID = 1000000; @Override public void onSubmit() { } }; filterButton.setDefaultFormProcessing(true); filterForm.add(filterButton); // The "resetButton" button Button resetButton = new Button("resetButton") { private static final long serialVersionUID = 1000000; @Override public void onSubmit() { dataProvider.setFilter(""); } }; filterForm.add(resetButton); tableContainer.add(filterForm); // The organisation data view DataView<Organisation> dataView = new DataView<Organisation>("organisation", dataProvider) { private static final long serialVersionUID = 1000000; @Override protected void populateItem(Item<Organisation> item) { item.add(new Label("id", new PropertyModel<String>(item.getModel(), "id"))); item.add(new Label("name", new PropertyModel<String>(item.getModel(), "name"))); // The "updateLink" link Link<Void> updateLink = new Link<Void>("updateLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { UpdateOrganisationPage page = new UpdateOrganisationPage(getPageReference(), item.getModel()); setResponsePage(page); } }; item.add(updateLink); // The "removeLink" link AjaxLink<Void> removeLink = new AjaxLink<Void>("removeLink") { private static final long serialVersionUID = 1000000; @Override public void onClick(AjaxRequestTarget target) { Organisation organisation = item.getModelObject(); if (organisation != null) { removeDialog.show(target, organisation); } else { target.add(tableContainer); } } }; item.add(removeLink); } }; dataView.setItemsPerPage(10); dataView.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance()); tableContainer.add(dataView); tableContainer.add(new PagingNavigator("navigator", dataView)); } catch (Throwable e) { throw new WebApplicationException("Failed to initialise the OrganisationAdministrationPage", e); } }
From source file:guru.mmp.application.web.template.pages.ReportDefinitionAdministrationPage.java
License:Apache License
/** * Constructs a new <code>ReportDefinitionAdministrationPage</code>. */// ww w.j av a 2 s . c om @SuppressWarnings("unused") public ReportDefinitionAdministrationPage() { super("Report Definitions"); try { /* * The table container, which allows the table and its associated navigator to be updated * using AJAX. */ WebMarkupContainer tableContainer = new WebMarkupContainer("tableContainer"); tableContainer.setOutputMarkupId(true); add(tableContainer); // The dialog used to confirm the removal of a group RemoveDialog removeDialog = new RemoveDialog(tableContainer); add(removeDialog); // The "addLink" link Link<Void> addLink = new Link<Void>("addLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { AddReportDefinitionPage page = new AddReportDefinitionPage(getPageReference()); setResponsePage(page); } }; tableContainer.add(addLink); ReportDefinitionSummaryDataProvider dataProvider = new ReportDefinitionSummaryDataProvider(); // The report definition data view DataView<ReportDefinitionSummary> dataView = new DataView<ReportDefinitionSummary>("reportDefinition", dataProvider) { private static final long serialVersionUID = 1000000; protected void populateItem(Item<ReportDefinitionSummary> item) { item.add(new Label("name", new PropertyModel<String>(item.getModel(), "name"))); // The "updateLink" link Link<Void> updateLink = new Link<Void>("updateLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { ReportDefinitionSummary reportDefinitionSummary = item.getModelObject(); try { ReportDefinition reportDefinition = reportingService .getReportDefinition(reportDefinitionSummary.getId()); UpdateReportDefinitionPage page = new UpdateReportDefinitionPage(getPageReference(), new Model<>(reportDefinition)); setResponsePage(page); } catch (Throwable e) { logger.error(String.format("Failed to retrieve the report definition (%s)", reportDefinitionSummary.getId()), e); error(String.format("Failed to retrieve the report definition (%s)", reportDefinitionSummary.getId())); } } }; item.add(updateLink); // The "removeLink" link AjaxLink<Void> removeLink = new AjaxLink<Void>("removeLink") { private static final long serialVersionUID = 1000000; @Override public void onClick(AjaxRequestTarget target) { ReportDefinitionSummary reportDefinitionSummary = item.getModelObject(); if (reportDefinitionSummary != null) { removeDialog.show(target, reportDefinitionSummary); } else { target.add(tableContainer); } } }; item.add(removeLink); } }; dataView.setItemsPerPage(10); dataView.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance()); tableContainer.add(dataView); tableContainer.add(new PagingNavigator("navigator", dataView)); } catch (Throwable e) { throw new WebApplicationException("Failed to initialise the ReportDefinitionAdministrationPage", e); } }
From source file:guru.mmp.application.web.template.pages.UserAdministrationPage.java
License:Apache License
/** * Constructs a new <code>UserAdministrationPage</code>. *///from w w w. ja v a2 s . c o m public UserAdministrationPage() { super("Users"); try { /* * Retrieve the list of user directories for the organisation the currently logged on user * is associated with and default to the first user directory. */ List<UserDirectory> userDirectories = getUserDirectories(); userDirectory = userDirectories.get(0); /* * The table container, which allows the table and its associated navigator to be updated * using AJAX. */ WebMarkupContainer tableContainer = new WebMarkupContainer("tableContainer"); tableContainer.setOutputMarkupId(true); add(tableContainer); // The dialog used to confirm the removal of a user RemoveDialog removeDialog = new RemoveDialog(tableContainer); add(removeDialog); // The "addLink" used to add a new user Link<Void> addLink = new Link<Void>("addLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { AddUserPage page = new AddUserPage(getPageReference(), userDirectory.getId()); setResponsePage(page); } }; tableContainer.add(addLink); FilteredUserDataProvider dataProvider = new FilteredUserDataProvider(userDirectory.getId()); // The "userDirectoryDropdownMenu" dropdown button DropdownMenu<UserDirectory> userDirectoryDropdownMenu = new DropdownMenu<UserDirectory>( "userDirectoryDropdownMenu", new PropertyModel<>(this, "userDirectory"), userDirectories, "fa fa-users") { @Override protected String getDisplayValue(UserDirectory menuItem) { return menuItem.getName(); } @Override protected void onMenuItemSelected(AjaxRequestTarget target, UserDirectory menuItem) { dataProvider.setUserDirectoryId(userDirectory.getId()); if (target != null) { target.add(tableContainer); target.appendJavaScript( "jQuery('[data-toggle=\"tooltip\"]').tooltip({container: 'body', animation: false});"); } } }; userDirectoryDropdownMenu.setVisible(userDirectories.size() > 1); tableContainer.add(userDirectoryDropdownMenu); // The "filterForm" form Form<Void> filterForm = new Form<>("filterForm"); filterForm.setMarkupId("filterForm"); filterForm.setOutputMarkupId(true); // The "filter" field TextField<String> filterField = new TextField<>("filter", new PropertyModel<>(dataProvider, "filter")); filterForm.add(filterField); // The "filterButton" button Button filterButton = new Button("filterButton") { private static final long serialVersionUID = 1000000; @Override public void onSubmit() { } }; filterButton.setDefaultFormProcessing(true); filterForm.add(filterButton); // The "resetButton" button Button resetButton = new Button("resetButton") { private static final long serialVersionUID = 1000000; @Override public void onSubmit() { dataProvider.setFilter(""); } }; filterForm.add(resetButton); tableContainer.add(filterForm); // The user data view DataView<User> dataView = new DataView<User>("user", dataProvider) { private static final long serialVersionUID = 1000000; @Override protected void populateItem(Item<User> item) { User user = item.getModelObject(); item.add(new Label("username", new PropertyModel<String>(item.getModel(), "username"))); item.add(new Label("firstName", new PropertyModel<String>(item.getModel(), "firstName"))); item.add(new Label("lastName", new PropertyModel<String>(item.getModel(), "lastName"))); // The "userGroupsLink" link Link<Void> userGroupsLink = new Link<Void>("userGroupsLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { User user = item.getModelObject(); if (!user.getUsername().equalsIgnoreCase("Administrator")) { UserGroupsPage page = new UserGroupsPage(getPageReference(), userDirectory.getId(), user.getUsername()); setResponsePage(page); } } }; item.add(userGroupsLink); // The "updateLink" link Link<Void> updateLink = new Link<Void>("updateLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { User user = item.getModelObject(); if (!user.getUsername().equalsIgnoreCase("Administrator")) { UpdateUserPage page = new UpdateUserPage(getPageReference(), item.getModel()); setResponsePage(page); } } }; updateLink.setVisible(!user.isReadOnly()); item.add(updateLink); // The "resetPassword" link Link<Void> resetPasswordLink = new Link<Void>("resetPasswordLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { ResetUserPasswordPage page = new ResetUserPasswordPage(getPageReference(), new Model<>(item.getModelObject())); setResponsePage(page); } }; resetPasswordLink.setVisible(!user.isReadOnly()); item.add(resetPasswordLink); // The "removeLink" link AjaxLink<Void> removeLink = new AjaxLink<Void>("removeLink") { private static final long serialVersionUID = 1000000; @Override public void onClick(AjaxRequestTarget target) { User user = item.getModelObject(); if (user != null) { if (!user.getUsername().equalsIgnoreCase("Administrator")) { removeDialog.show(target, user); } } else { target.add(tableContainer); } } }; removeLink.setVisible(!user.isReadOnly()); item.add(removeLink); } }; dataView.setItemsPerPage(10); dataView.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance()); tableContainer.add(dataView); tableContainer.add(new PagingNavigator("navigator", dataView)); } catch (Throwable e) { throw new WebApplicationException("Failed to initialise the UserAdministrationPage", e); } }
From source file:guru.mmp.application.web.template.pages.UserDirectoryAdministrationPage.java
License:Apache License
/** * Constructs a new <code>UserDirectoryAdministrationPage</code>. *//*from www . j av a 2 s . c o m*/ public UserDirectoryAdministrationPage() { super("User Directories"); try { /* * The table container, which allows the table and its associated navigator to be updated * using AJAX. */ WebMarkupContainer tableContainer = new WebMarkupContainer("tableContainer"); tableContainer.setOutputMarkupId(true); add(tableContainer); // The dialog used to confirm the removal of a user directory RemoveDialog removeDialog = new RemoveDialog(tableContainer); add(removeDialog); // The dialog used to select the type of user directory being added AddDialog selectUserDirectoryTypeDialog = new AddDialog(); add(selectUserDirectoryTypeDialog); // The "addLink" used to add a new user directory AjaxLink<Void> addLink = new AjaxLink<Void>("addLink") { private static final long serialVersionUID = 1000000; @Override public void onClick(AjaxRequestTarget target) { selectUserDirectoryTypeDialog.show(target); } }; tableContainer.add(addLink); FilteredUserDirectoryDataProvider dataProvider = new FilteredUserDirectoryDataProvider(); // The "filterForm" form Form<Void> filterForm = new Form<>("filterForm"); filterForm.setMarkupId("filterForm"); filterForm.setOutputMarkupId(true); // The "filter" field TextField<String> filterField = new TextField<>("filter", new PropertyModel<>(dataProvider, "filter")); filterForm.add(filterField); // The "filterButton" button Button filterButton = new Button("filterButton") { private static final long serialVersionUID = 1000000; @Override public void onSubmit() { } }; filterButton.setDefaultFormProcessing(true); filterForm.add(filterButton); // The "resetButton" button Button resetButton = new Button("resetButton") { private static final long serialVersionUID = 1000000; @Override public void onSubmit() { dataProvider.setFilter(""); } }; filterForm.add(resetButton); tableContainer.add(filterForm); // The user directory data view DataView<UserDirectory> dataView = new DataView<UserDirectory>("userDirectory", dataProvider) { private static final long serialVersionUID = 1000000; @Override protected void populateItem(Item<UserDirectory> item) { item.add(new Label("name", new PropertyModel<String>(item.getModel(), "name"))); item.add(new Label("type", new PropertyModel<String>(item.getModel(), "type.name"))); // The "updateLink" link Link<Void> updateLink = new Link<Void>("updateLink") { private static final long serialVersionUID = 1000000; @Override public void onClick() { UpdateUserDirectoryPage page = new UpdateUserDirectoryPage(getPageReference(), item.getModel()); setResponsePage(page); } }; item.add(updateLink); // The "removeLink" link AjaxLink<Void> removeLink = new AjaxLink<Void>("removeLink") { private static final long serialVersionUID = 1000000; @Override public void onClick(AjaxRequestTarget target) { UserDirectory userDirectory = item.getModelObject(); if (userDirectory != null) { removeDialog.show(target, userDirectory); } else { target.add(tableContainer); } } }; item.add(removeLink); } }; dataView.setItemsPerPage(10); dataView.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance()); tableContainer.add(dataView); tableContainer.add(new PagingNavigator("navigator", dataView)); } catch (Throwable e) { throw new WebApplicationException("Failed to initialise the UserDirectoryAdministrationPage", e); } }
From source file:guru.mmp.sample.web.pages.dialogs.TestExtensibleDialogImplementationPage.java
License:Apache License
/** * Constructs a new <code>TestExtensibleDialogImplementationPage</code>. */// w w w . java2s .c om public TestExtensibleDialogImplementationPage() { super("Test Extensible Dialog Implementation", "The test extensible dialog implementation"); try { AjaxLink showDialogLink = new AjaxLink("showDialogLink") { @Override public void onClick(AjaxRequestTarget target) { getDialog().show(target, new TestExtensibleDialogImplementation()); } }; add(showDialogLink); } catch (Throwable e) { throw new WebApplicationException("Failed to initialise the TestExtensibleDialogImplementationPage", e); } }
From source file:guru.mmp.sample.web.pages.dialogs.TestExtensibleFormDialogImplementationPage.java
License:Apache License
/** * Constructs a new <code>TestExtensibleFormDialogImplementationPage</code>. *///w w w. ja v a2 s .c o m public TestExtensibleFormDialogImplementationPage() { super("Test Extensible Form Dialog Implementation", "The test extensible form dialog implementation"); try { AjaxLink showDialogLink = new AjaxLink("showDialogLink") { @Override public void onClick(AjaxRequestTarget target) { getDialog().show(target, new TestExtensibleFormDialogImplementation()); } }; add(showDialogLink); } catch (Throwable e) { throw new WebApplicationException("Failed to initialise the TestExtensibleFormDialogImplementationPage", e); } }
From source file:guru.mmp.sample.web.pages.HomePage.java
License:Apache License
/** * Constructs a new <code>HomePage</code>. *//*from w w w . j a v a2 s . c o m*/ public HomePage() { super("Home"); try { AjaxLink<Void> testLink = new AjaxLink<Void>("testLink") { @Override public void onClick(AjaxRequestTarget target) { try { for (Data data : sampleService.getAllData()) { logger.info(data.toString()); } } catch (Throwable e) { logger.error("Failed to retrieve the data", e); } } }; add(testLink); } catch (Throwable e) { throw new WebApplicationException("Failed to initialise the HomePage", e); } }
From source file:hsa.awp.usergui.registrationmanagement.ConfirmedRegistrationManagementPanel.java
License:Open Source License
public ConfirmedRegistrationManagementPanel(String id, final List<ConfirmedRegistration> registrations) { super(id);//w w w .ja v a2 s .com final MarkupContainer box = new WebMarkupContainer("FifoManagementBox"); box.setOutputMarkupId(true); final LoadableDetachedModel<List<ConfirmedRegistration>> regModel = new LoadableDetachedModel<List<ConfirmedRegistration>>() { /** * unique serialization id. */ private static final long serialVersionUID = -5771746782326674752L; @Override protected List<ConfirmedRegistration> load() { SingleUser singleUser = controller .getUserById(SecurityContextHolder.getContext().getAuthentication().getName()); return controller.findConfirmedRegistrationsByParticipantId(singleUser.getId()); } }; box.add(new ListView<ConfirmedRegistration>("registrationList", regModel) { /** * generated uid. */ private static final long serialVersionUID = 5261679476830400718L; @Override protected void populateItem(final ListItem<ConfirmedRegistration> item) { ConfirmedRegistration registration = item.getModelObject(); Event event = controller.getEventById(registration.getEventId()); item.add(new Label("regName", formatIdSubjectNameAndDetailInformation(event))); if (registration.getProcedure() == null) { item.add(new Label("procedureName", "direkt")); } else { item.add(new Label("procedureName", registration.getProcedure().getName())); } AjaxLink<String> deleteLink = new AjaxLink<String>("regCancelLink") { /** * generated UID. */ private static final long serialVersionUID = 7720300709649429249L; @Override public void onClick(AjaxRequestTarget target) { controller.deleteConfirmedRegistration(item.getModelObject()); RegistrationManagementPanel regPan = findParent(RegistrationManagementPanel.class); if (regPan != null) { regPan.update(target); } target.addComponent(box); regModel.detach(); } }; deleteLink.setVisible(controller.isCampaignOpen(item.getModelObject())); item.add(deleteLink); deleteLink.add(new JavascriptEventConfirmation("onclick", "Sind Sie sicher?/Are you sure?")); } }); add(box); }
From source file:info.jtrac.wicket.ItemRelatePanel.java
License:Apache License
public ItemRelatePanel(String id, boolean isItemViewPage, ItemSearch itemSearch) { super(id);//from ww w. ja va2s .co m refId = itemSearch == null ? null : itemSearch.getRelatingItemRefId(); if (refId != null) { final YuiDialog dialog = new YuiDialog("itemWindow"); add(dialog); AjaxLink link = new AjaxLink("link") { @Override public void onClick(AjaxRequestTarget target) { Item item = getJtrac().loadItemByRefId(refId); dialog.show(target, refId, new ItemViewPanel(YuiDialog.CONTENT_ID, new Model(item), true)); } }; link.add(new Label("refId", refId)); if (isItemViewPage) { add(new WebMarkupContainer("link").setVisible(false)); add(new WebMarkupContainer("message").setVisible(false)); add(new RelateForm("form").add(link)); } else { add(new Label("message", localize("item_list.searchingForRelated"))); add(link); add(new WebMarkupContainer("form").setVisible(false)); } add(new Link("cancel") { @Override public void onClick() { Item item = getJtrac().loadItemByRefId(refId); JtracSession.get().setItemSearch(null); setResponsePage(ItemViewPage.class, new PageParameters("0=" + item.getRefId())); } }); } else { setVisible(false); } }