Java Code Examples for org.apache.wicket.ajax.markup.html.AjaxLink

The following are top voted examples for showing how to use org.apache.wicket.ajax.markup.html.AjaxLink. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: relax-dms   File: DocumentWorkflow.java   Source Code and License 7 votes vote down vote up
private void createCloseButton(boolean visible) {
    closeLink = new AjaxLink("close") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            workflowService.changeState(docData, StateEnum.CLOSED, user);

            stateLabel.setDefaultModel(new Model(workflow.getState().getCurrentState().getName()));
            
            setVisibility(false, closeLink, submitLink, startProgressLink, signLink, releaseLink, 
                    approveLink, declineLink, documentLabels.getSubmittedlabel(),
                    documentLabels.getFreezedLabel());
            reopenLink.setVisible(true);
            
            tabs.refreshTabs(docData.getMetadata().getRev());
            documentLabels.refreshLabels(docData.getWorkflow(), target);
            
            target.add(stateLabel, closeLink, submitLink, startProgressLink, signLink,
                    reopenLink, approveLink, declineLink, documentLabels, releaseLink, tabs);
        }
    };
    addComponent(closeLink, visible);
}
 
Example 2
Project: karate   File: VarsRefreshingView.java   Source Code and License 6 votes vote down vote up
@Override
protected void populateItem(Item<Var> item) {
    String name = item.getModel().getObject().getName();
    item.add(new AjaxLink("show") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            selectedName = name;
            Component headerPanel = getPage().get(BasePage.STICKY_HEADER_ID);
            VarModel varModel = new VarModel(model.getSessionId(), name);
            VarPanel varPanel = new VarPanel(BasePage.STICKY_HEADER_ID, varModel, VarsRefreshingView.this);                
            headerPanel = headerPanel.replaceWith(varPanel);
            target.add(headerPanel);
            Component varsPanel = getPage().get(BasePage.LEFT_NAV_ID);
            target.add(varsPanel);
        }
    }.add(new Label("name", name)));
    String type = item.getModel().getObject().getValue().getTypeAsShortString();
    item.add(new Label("type", type));
    if (name.equals(selectedName)) {
        item.add(new AttributeModifier("class", "success"));
    }
}
 
Example 3
Project: gitplex-mit   File: AjaxActionTab.java   Source Code and License 6 votes vote down vote up
@Override
public Component render(String componentId) {
	return new ActionTabLink(componentId, this) {

		@Override
		protected WebMarkupContainer newLink(String id, ActionTab tab) {
			return new AjaxLink<Void>("link") {

				@Override
				public void onClick(AjaxRequestTarget target) {
					selectTab(this);
				}
				
			};
		}
		
	};
}
 
Example 4
Project: gitplex-mit   File: CodeCommentPanel.java   Source Code and License 6 votes vote down vote up
private WebMarkupContainer newAddReplyContainer() {
	WebMarkupContainer addReplyContainer = new Fragment("addReply", "addReplyFrag", this) {

		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(SecurityUtils.getUser() != null);
		}
		
	};
	addReplyContainer.setOutputMarkupId(true);
	addReplyContainer.add(new AjaxLink<Void>("reply") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			onAddReply(target, false, null);
		}
		
	});
	return addReplyContainer;
}
 
Example 5
Project: GeoCrawler   File: CrawlsPage.java   Source Code and License 6 votes vote down vote up
private void populateCrawlRow(Item<Crawl> item) {
  item.add(new AjaxLink<Crawl>("edit", item.getModel()) {
    @Override
    public void onClick(AjaxRequestTarget target) {
      editCrawl(target, getModel());
    }
  }.add(new Label("crawlName")));
  item.add(new Label("seedList.name"));

  item.add(new Label("progress"));
  item.add(createStatusLabel());
  item.add(new Link<Crawl>("start", item.getModel()) {
    @Override
    public void onClick() {
      crawlService.startCrawl(getModelObject().getId(), getCurrentInstance());
    }
  });

  item.add(new Link<Crawl>("delete", item.getModel()) {
    @Override
    public void onClick() {
      crawlService.deleteCrawl(getModelObject().getId());
    }
  });
}
 
Example 6
Project: engerek   File: HelpInfoPanel.java   Source Code and License 6 votes vote down vote up
public void initLayout(final String messageKey){
    WebMarkupContainer content = new WebMarkupContainer(ID_CONTENT);
    add(content);

    Label helpLabel = new Label(ID_HELP, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(messageKey);
        }
    });
    helpLabel.setEscapeModelStrings(false);
    content.add(helpLabel);

    AjaxLink ok = new AjaxLink(ID_BUTTON_OK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            closePerformed(target);
        }
    };
    content.add(ok);
}
 
Example 7
Project: engerek   File: MultiValueChoosePanel.java   Source Code and License 6 votes vote down vote up
protected void initButtons(ListItem<T> item, WebMarkupContainer parent) {
        WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP); {
	        buttonGroup.setOutputMarkupId(true);
	
	        AjaxLink remove = new AjaxLink(ID_REMOVE) {
	
	            @Override
	            public void onClick(AjaxRequestTarget target) {
	                removeValuePerformed(target, item.getModelObject());
	            }
	        };
	        
	        remove.add(new VisibleEnableBehaviour() {
	
	            @Override
	            public boolean isVisible() {
	                return isRemoveButtonVisible();
	            }
	        });
	        buttonGroup.add(remove);
        }

        parent.add(buttonGroup);
}
 
Example 8
Project: engerek   File: SimpleRoleSelector.java   Source Code and License 6 votes vote down vote up
private void initLayout() {
    setOutputMarkupId(true);
    ListView<PrismObject<R>> list = new ListView<PrismObject<R>>(ID_LIST, availableRoles) {
        @Override
        protected void populateItem(ListItem<PrismObject<R>> item) {
            item.add(createRoleLink(ID_ITEM, item.getModel()));
        }
    };
    list.setOutputMarkupId(true);
    add(list);

    AjaxLink<String> buttonReset = new AjaxLink<String>(ID_BUTTON_RESET) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            reset();
            target.add(SimpleRoleSelector.this);
        }
    };
    buttonReset.setBody(createStringResource("SimpleRoleSelector.reset"));
    add(buttonReset);
}
 
Example 9
Project: engerek   File: LinkIconPanel.java   Source Code and License 6 votes vote down vote up
private void initLayout(IModel<String> model, IModel<String> titleModel) {
    AjaxLink link = new AjaxLink(ID_LINK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            onClickPerformed(target);
        }
    };

    Label image = new Label(ID_IMAGE);
    image.add(AttributeModifier.replace("class", model));
    if (titleModel != null) {
        image.add(AttributeModifier.replace("title", titleModel));
    }
    link.add(image);
    link.setOutputMarkupId(true);
    add(link);
}
 
Example 10
Project: engerek   File: TableConfigurationPanel.java   Source Code and License 6 votes vote down vote up
protected void initLayout() {
    WebMarkupContainer cogButton = new WebMarkupContainer(ID_COG_BUTTON);
    cogButton.setOutputMarkupId(true);
    add(cogButton);

    WebMarkupContainer pageSize = new WebMarkupContainer(ID_PAGE_SIZE);
    pageSize.setOutputMarkupId(true);
    cogButton.add(pageSize);

    AjaxLink tableColumns = new AjaxLink(ID_TABLE_COLUMNS) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            tableColumnsPerformed(target);
        }
    };
    cogButton.add(tableColumns);
    tableColumns.setVisible(false); //todo implement [lazyman]

    initPopoverLayout();
}
 
Example 11
Project: engerek   File: WizardHelpDialog.java   Source Code and License 6 votes vote down vote up
public void initLayout(WebMarkupContainer content){
    Label helpLabel = new Label(ID_HELP, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(determineHelpKey());
        }
    });
    helpLabel.setEscapeModelStrings(false);
    content.add(helpLabel);

    AjaxLink ok = new AjaxLink(ID_BUTTON_OK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            closePerformed(target);
        }
    };
    content.add(ok);
}
 
Example 12
Project: engerek   File: CapabilitiesPanel.java   Source Code and License 6 votes vote down vote up
private void createCapabilityButton(String id) {
	AjaxLink<Boolean> button = new AjaxLink<Boolean>(id, new PropertyModel<Boolean>(getModel(), id)) {

		@Override
		public void onClick(AjaxRequestTarget target) {
			// TODO:
		}

	};

	button.add(new AttributeModifier("class",
			button.getModelObject() ? "btn btn-app btn-resource-capability bg-light-blue"
					: "btn btn-app btn-resource-capability bg-gray text-light-blue"));

	button.add(new Label("label", new ResourceModel("CapabilitiesType." + id)));

	add(button);
}
 
Example 13
Project: Unicorn   File: DependenciesPanel.java   Source Code and License 6 votes vote down vote up
/**
 * Create and add a link to delete the selected attribute dependency.
 */
private void addDeleteDependencyButton() {
    AjaxLink deleteDependencyButton = new AjaxLink<Void>("deleteDependencyButton") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            AttributeDependency dependency = AttributeDependency
                    .getAttributeDependencyIfExists(selectedEventType, selectedBaseAttribute, selectedDependentAttribute);
            if (dependency == null) {
                DependenciesPanel.this.page.getFeedbackPanel().error("Error while deleting dependency. "
                        + "Dependency is already deleted.");
            } else if (dependency.remove() == null) {
                DependenciesPanel.this.page.getFeedbackPanel().error("Error while deleting dependency. "
                        + "Please delete the corresponding values first.");
            } else {
                DependenciesPanel.this.page.getFeedbackPanel().success("Dependency deleted.");
            }
            target.add(DependenciesPanel.this.page.getFeedbackPanel());
        }
    };
    dependencyForm.add(deleteDependencyButton);
}
 
Example 14
Project: Intercloud   File: UriResponsePanel.java   Source Code and License 6 votes vote down vote up
public UriResponsePanel(String id, IModel<UriListRepresentationModel> representationModel) {
    super(id);

    this.add(new ListView<String>("uriList", new ListModel<>(representationModel.getObject().getUriList())) {
        @Override
        protected void populateItem(ListItem<String> listItem) {
            AjaxLink link = new AjaxLink("uri") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    try {
                        XmppURI uri = new XmppURI(listItem.getModelObject());
                        setResponsePage(new BrowserPage(Model.of(uri)));
                    } catch (URISyntaxException e) {
                        logger.error("Could not parse Xmpp Uri. {}", listItem.getModelObject(), e);
                        target.appendJavaScript("alert('Could not parse Xmpp Uri.');");
                    }
                }
            };
            link.setBody(listItem.getModel());
            listItem.add(link);
        }
    });
}
 
Example 15
Project: owsi-core-parent   File: ActionColumnAjaxActionFactory.java   Source Code and License 6 votes vote down vote up
@Override
public AjaxLink<T> create(String wicketId, final IModel<T> parameter) {
	AjaxLink<T> link = new AjaxLink<T>(wicketId, parameter) {
		private static final long serialVersionUID = 1L;
		@Override
		protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
			super.updateAjaxAttributes(attributes);
			action.updateAjaxAttributes(attributes, parameter);
		}
		@Override
		public void onClick(AjaxRequestTarget target) {
			action.execute(target, parameter);
		}
	};
	
	link.add(
			action.getActionAvailableCondition(parameter).thenShowInternal()
	);
	
	return link;
}
 
Example 16
Project: etcd-viewer   File: DeleteClusterModalPanel.java   Source Code and License 6 votes vote down vote up
public DeleteClusterModalPanel(String id, IModel<String> model) {
    super(id, model);

    add(name = new Label("name", getModel()));
    name.setOutputMarkupId(true);

    add(new AjaxLink<String>("delete", getModel()) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {

            clusterManager.removeCluster(getModelObject());

            onClusterDeleted(target);

            modalHide(target);
        }
    });
}
 
Example 17
Project: relax-dms   File: SchemaUpdate.java   Source Code and License 6 votes vote down vote up
private void createTemplateList(Map<String, String> templateMap) {  
    List<String> titleList = templateMap.keySet().stream().collect(Collectors.toList());
    ListView listview = new ListView("listView", titleList) {
        @Override
        protected void populateItem(ListItem item) {
            final String title = (String) item.getModelObject();
            final String id = templateMap.get(title);
            
            AjaxLink<Void> templateLink = new AjaxLink("templateLink") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    PageParameters params = new PageParameters();
                    params.add("templateId", id);
                    setResponsePage(SchemaUpdate.class, params);
                }
            };
            item.add(templateLink.add(new Label("label", title)));
        }
    };
    add(listview);
}
 
Example 18
Project: relax-dms   File: DocumentCreate.java   Source Code and License 6 votes vote down vote up
private void createTemplateList(Map<String, String> templateMap) {  
    List<String> titleList = templateMap.keySet().stream().collect(Collectors.toList());
    ListView listview = new ListView("listView", titleList) {
        @Override
        protected void populateItem(ListItem item) {
            final String title = (String) item.getModelObject();
            final String id = templateMap.get(title);
            
            AjaxLink<Void> templateLink = new AjaxLink("templateLink") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    PageParameters params = new PageParameters();
                    params.add("templateId", id);
                    setResponsePage(DocumentCreate.class, params);
                }
            };
            item.add(templateLink.add(new Label("label", title)));
        }
    };
    add(listview);
}
 
Example 19
Project: relax-dms   File: DocumentWorkflow.java   Source Code and License 6 votes vote down vote up
private void createStartProgressButton(boolean visible) {
    startProgressLink = new AjaxLink("startProgress") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            workflowService.changeState(docData, StateEnum.IN_PROGRESS, user);
            
            stateLabel.setDefaultModel(new Model(workflow.getState().getCurrentState().getName()));
            
            setVisibility(false, startProgressLink, documentLabels.getFreezedLabel());
            setVisibility(true, freezeLink);
            
            tabs.refreshTabs(docData.getMetadata().getRev());
            documentLabels.refreshLabels(docData.getWorkflow(), target);
            
            target.add(stateLabel, startProgressLink, documentLabels, freezeLink, tabs);
        }
    };
    addComponent(startProgressLink, visible);
}
 
Example 20
Project: relax-dms   File: DocumentWorkflow.java   Source Code and License 6 votes vote down vote up
private void createSignButton(boolean visible) {
    signLink = new AjaxLink("sign") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            workflowService.addLabel(docData, LabelEnum.SIGNED, user);
            
            setVisibility(true, releaseLink, documentLabels.getSignedLabel());
            setVisibility(false, signLink);
            
            tabs.refreshTabs(docData.getMetadata().getRev());
            documentLabels.refreshLabels(docData.getWorkflow(), target);
            
            target.add(documentLabels, signLink, releaseLink, tabs);
        }
    };
    addComponent(signLink, visible);
}
 
Example 21
Project: relax-dms   File: DocumentWorkflow.java   Source Code and License 6 votes vote down vote up
private void createFreezeButton(boolean visible) {
    freezeLink = new AjaxLink("freeze") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            workflowService.addLabel(docData, LabelEnum.FREEZED, user);
            
            setVisibility(false, freezeLink);
            setVisibility(true, documentLabels.getFreezedLabel());
            
            tabs.refreshTabs(docData.getMetadata().getRev());
            documentLabels.refreshLabels(docData.getWorkflow(), target);
            
            target.add(freezeLink, documentLabels, tabs);
        }
    };
    addComponent(freezeLink, visible);
}
 
Example 22
Project: relax-dms   File: DocumentWorkflow.java   Source Code and License 6 votes vote down vote up
private void createReleaseButton(boolean visible) {
    releaseLink = new AjaxLink("release") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            workflowService.addLabel(docData, LabelEnum.RELEASED, user);
            
            setVisibility(false, releaseLink, closeLink);
            setVisibility(true, documentLabels.getReleasedLabel(), exportLink);
            assigneeLabel.setEnabled(false);
            textField.setEnabled(false);
            
            tabs.refreshTabs(docData.getMetadata().getRev());
            documentLabels.refreshLabels(docData.getWorkflow(), target);
            
            target.add(releaseLink, documentLabels, closeLink, assigneeLabel, tabs, exportLink);
        }
    };
    addComponent(releaseLink, visible);
}
 
Example 23
Project: elpaaso-core   File: EnvironmentsPage.java   Source Code and License 6 votes vote down vote up
private void createNewEnvironmentButton() {
    buttonContainer = new WebMarkupContainer("buttonContainer");
    buttonContainer.setOutputMarkupId(true);

    //create link
    newEnvironment = new AjaxLink("newEnvLink") {

        @Override
        public void onClick(AjaxRequestTarget target) {

            envCreatePanel = new EnvironmentCreatePanel("createEnvironmentForm", null, manageApplicationRelease, manageEnvironment, manageApplication);

            container.addOrReplace(envCreatePanel);
            target.add(container);

            this.setVisible(false);
            target.add(buttonContainer);

        }
    };
    newEnvironment.setMarkupId("newEnvLink");
    buttonContainer.add(newEnvironment);
    add(buttonContainer);
}
 
Example 24
Project: elpaaso-core   File: ReleasesPage.java   Source Code and License 6 votes vote down vote up
private void createNewReleaseButton() {
    buttonContainer = new WebMarkupContainer("buttonContainer");
    buttonContainer.setOutputMarkupId(true);

    //create link
    newRelease = new AjaxLink("newReleaseLink") {

        @Override
        public void onClick(AjaxRequestTarget target) {
            this.setVisible(false);
            target.add(buttonContainer);
            releaseCreatePanel.setVisible(true);
            newReleaseContainer.addOrReplace(releaseCreatePanel);
            target.add(newReleaseContainer);
        }
    };
    newRelease.setMarkupId("newReleaseLink");
    buttonContainer.add(newRelease);
    add(buttonContainer);
}
 
Example 25
Project: elpaaso-core   File: DesignerSteppedButtonsPanel.java   Source Code and License 6 votes vote down vote up
private void initPreviousStepButton() {

        AjaxLink previousButton = new AjaxLink("previousButton") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                step = parentPage.previousStepProcess();
                parentPage.managePageComponents(target, step, null);
            }

            @Override
            public boolean isVisible() {
                return step != 0;
            }
        };

        add(previousButton);

    }
 
Example 26
Project: elpaaso-core   File: DesignerArchitectureMatrixCellButtonPanel.java   Source Code and License 6 votes vote down vote up
private void initConfigBtn() {

        /** view icon */
        configBtn = new AjaxLink<Void>("cell-config") {

            private static final long serialVersionUID = 6195327499501053622L;

            @Override
            public void onClick(AjaxRequestTarget target) {
                logger.debug("config icon onClick");
                findParent(DesignerArchitectureMatrixCellButtonPanel.class).onClickConfigOverride(target);
            }

            @Override
            public boolean isVisible() {
                return allowOverride && DesignerArchitectureMatrixCellButtonPanel.this.getModelObject() instanceof LogicalConfigService;
            }

        };

        Model<String[]> labelModel = new Model<String[]>(new String[]{ getModelObject().getLabel() });
        configBtn.add(new AttributeModifier("title", new StringResourceModel("portal.designer.matrix.details.tooltip", labelModel)));

        add(configBtn);

    }
 
Example 27
Project: artifactory   File: BuildBreadCrumbsPanel.java   Source Code and License 6 votes vote down vote up
private BreadCrumbItem(String id, final String crumbTitle, final PageParameters pageParameters, boolean first) {
    super(id);

    add(new AjaxLink("link") {

        @Override
        public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
            replaceComponentTagBody(markupStream, openTag, crumbTitle);
        }

        @Override
        public void onClick(AjaxRequestTarget target) {
            setResponsePage(BuildBrowserRootPage.class, pageParameters);
        }
    });
    add(new WebMarkupContainer("sep").setVisible(!first));
}
 
Example 28
Project: artifactory   File: PublishedModulesTabPanel.java   Source Code and License 6 votes vote down vote up
/**
 * Returns a link that redirects to the module info
 *
 * @param componentId ID to assign to the link
 * @param moduleId    ID of module to display
 * @return Module redirection link
 */
private AjaxLink getModuleNameLink(String componentId, final String moduleId) {
    AjaxLink link = new AjaxLink<String>(componentId, Model.of(moduleId)) {

        @Override
        public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
            replaceComponentTagBody(markupStream, openTag, moduleId);
        }

        @Override
        public void onClick(AjaxRequestTarget target) {
            PageParameters pageParameters = new PageParameters();
            pageParameters.set(BUILD_NAME, build.getName());
            pageParameters.set(BUILD_NUMBER, build.getNumber());
            pageParameters.set(BUILD_STARTED, build.getStarted());
            pageParameters.set(MODULE_ID, moduleId);
            setResponsePage(BuildBrowserRootPage.class, pageParameters);
        }
    };
    link.add(new CssClass("item-link"));
    return link;
}
 
Example 29
Project: artifactory   File: GeneralInfoPanel.java   Source Code and License 6 votes vote down vote up
private void addArtifactCount(final RepoAwareActionableItem repoItem, final FieldSetBorder infoBorder) {
    if (!repoItem.getItemInfo().isFolder()) {
        infoBorder.add(new WebMarkupContainer("artifactCountLabel"));
        infoBorder.add(new WebMarkupContainer("artifactCountValue"));
        WebMarkupContainer linkContainer = new WebMarkupContainer("link");
        linkContainer.setVisible(false);
        infoBorder.add(linkContainer);
    } else {
        infoBorder.add(new Label("artifactCountLabel", "Artifact Count: "));
        final WebMarkupContainer container = new WebMarkupContainer("artifactCountValue");
        infoBorder.add(container);
        AjaxLink<String> link = new AjaxLink<String>("link") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                setVisible(false);
                container.replaceWith(new ArtifactCountLazySpanPanel("artifactCountValue", repoItem.getRepoPath()));
                target.add(infoBorder);
            }
        };
        infoBorder.add(link);
    }
}
 
Example 30
Project: artifactory   File: AjaxGroupableHeadersToolbar.java   Source Code and License 6 votes vote down vote up
private Component newGroupByLink(String id, final ISortStateLocator stateLocator, final String groupProperty) {
    return new AjaxLink(id) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            if (stateLocator instanceof IGroupStateLocator) {
                IGroupStateLocator groupStateLocator = (IGroupStateLocator) stateLocator;
                switchGroupState(groupStateLocator, groupProperty);
                target.add(getTable());
            }
        }

        @Override
        protected void onComponentTag(ComponentTag tag) {
            super.onComponentTag(tag);
            tag.put("title", "Group By");
        }

        @Override
        protected IAjaxCallDecorator getAjaxCallDecorator() {
            return new CancelDefaultDecorator();
        }
    };
}
 
Example 31
Project: u-qasar.platform   File: DashboardSharePage.java   Source Code and License 6 votes vote down vote up
/**
 * 
 * @return
 */
private AjaxLink newCancelButton() {
	AjaxLink cancelLink = new AjaxLink("cancelButton") {

		@Override
		public void onClick(AjaxRequestTarget target) {

			PageParameters params = new PageParameters();
			params.add(MESSAGE_PARAM,
					new StringResourceModel("canceled.message", this, null));
			params.add("id", dashboard.getId());

			// redirect to dashboard view page
			setResponsePage(DashboardViewPage.class, params);

		}
	};
	
	cancelLink.setOutputMarkupId(true);
	return cancelLink;
}
 
Example 32
Project: u-qasar.platform   File: WidgetAction.java   Source Code and License 6 votes vote down vote up
@Override
public AbstractLink getLink(String id) {
	return new AjaxLink<Void>(id) {

		private static final long serialVersionUID = 1L;

		@Override
		public void onClick(AjaxRequestTarget target) {
			if (widget.hasSettings()) {
				WidgetPanel widgetPanel = findParent(WidgetPanel.class);
				Panel settingsPanel = widgetPanel.getSettingsPanel();
				settingsPanel.setVisible(true);
				target.add(settingsPanel);
			}
		}
		
	};
}
 
Example 33
Project: pm-wicket-utils   File: AjaxComponentFeedbackPanelTest.java   Source Code and License 6 votes vote down vote up
public TestPanel(String id) {
	super(id);

	message = null;

	link = new AjaxLink<String>("link") {
		private static final long serialVersionUID = 1L;

		@Override
		public void onClick(AjaxRequestTarget target) {
			Session.get().getFeedbackMessages().add(new FeedbackMessage(label, msg, 0));
			target.add(TestPanel.this);
		}
	};

	label = new Label("label");
}
 
Example 34
Project: midpoint   File: HelpInfoPanel.java   Source Code and License 6 votes vote down vote up
public void initLayout(final String messageKey){
    WebMarkupContainer content = new WebMarkupContainer(ID_CONTENT);
    add(content);

    Label helpLabel = new Label(ID_HELP, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(messageKey);
        }
    });
    helpLabel.setEscapeModelStrings(false);
    content.add(helpLabel);

    AjaxLink ok = new AjaxLink(ID_BUTTON_OK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            closePerformed(target);
        }
    };
    content.add(ok);
}
 
Example 35
Project: midpoint   File: MultiValueChoosePanel.java   Source Code and License 6 votes vote down vote up
protected void initButtons(ListItem<T> item, WebMarkupContainer parent) {
        WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP); {
	        buttonGroup.setOutputMarkupId(true);

	        AjaxLink remove = new AjaxLink(ID_REMOVE) {

	            @Override
	            public void onClick(AjaxRequestTarget target) {
	                removeValuePerformed(target, item.getModelObject());
	            }
	        };

	        remove.add(new VisibleEnableBehaviour() {

	            @Override
	            public boolean isVisible() {
	                return isRemoveButtonVisible();
	            }
	        });
	        buttonGroup.add(remove);
        }

        parent.add(buttonGroup);
}
 
Example 36
Project: midpoint   File: SimpleRoleSelector.java   Source Code and License 6 votes vote down vote up
private void initLayout() {
    setOutputMarkupId(true);
    ListView<PrismObject<R>> list = new ListView<PrismObject<R>>(ID_LIST, availableRoles) {
        @Override
        protected void populateItem(ListItem<PrismObject<R>> item) {
            item.add(createRoleLink(ID_ITEM, item.getModel()));
        }
    };
    list.setOutputMarkupId(true);
    add(list);

    AjaxLink<String> buttonReset = new AjaxLink<String>(ID_BUTTON_RESET) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            reset();
            target.add(SimpleRoleSelector.this);
        }
    };
    buttonReset.setBody(createStringResource("SimpleRoleSelector.reset"));
    add(buttonReset);
}
 
Example 37
Project: midpoint   File: LinkIconPanel.java   Source Code and License 6 votes vote down vote up
private void initLayout(IModel<String> model, IModel<String> titleModel) {
    AjaxLink link = new AjaxLink(ID_LINK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            onClickPerformed(target);
        }
    };

    Label image = new Label(ID_IMAGE);
    image.add(AttributeModifier.replace("class", model));
    if (titleModel != null) {
        image.add(AttributeModifier.replace("title", titleModel));
    }
    link.add(image);
    link.setOutputMarkupId(true);
    add(link);
}
 
Example 38
Project: midpoint   File: TableConfigurationPanel.java   Source Code and License 6 votes vote down vote up
protected void initLayout() {
    WebMarkupContainer cogButton = new WebMarkupContainer(ID_COG_BUTTON);
    cogButton.setOutputMarkupId(true);
    add(cogButton);

    WebMarkupContainer pageSize = new WebMarkupContainer(ID_PAGE_SIZE);
    pageSize.setOutputMarkupId(true);
    cogButton.add(pageSize);

    AjaxLink tableColumns = new AjaxLink(ID_TABLE_COLUMNS) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            tableColumnsPerformed(target);
        }
    };
    cogButton.add(tableColumns);
    tableColumns.setVisible(false); //todo implement [lazyman]

    initPopoverLayout();
}
 
Example 39
Project: midpoint   File: PrismContainerHeaderPanel.java   Source Code and License 6 votes vote down vote up
@Override
protected void initButtons() {
	
	add(new VisibleEnableBehaviour() {
		
		private static final long serialVersionUID = 1L;

		@Override
		public boolean isVisible() {
			return isContainerMultivalue();
		}
	});
	
	 AjaxLink addButton = new AjaxLink(ID_ADD_BUTTON) {
			private static final long serialVersionUID = 1L;

			@Override
            public void onClick(AjaxRequestTarget target) {
                addValue(target);
            }
        };
        
        add(addButton);

}
 
Example 40
Project: midpoint   File: WizardHelpDialog.java   Source Code and License 6 votes vote down vote up
public void initLayout(WebMarkupContainer content){
    Label helpLabel = new Label(ID_HELP, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(determineHelpKey());
        }
    });
    helpLabel.setEscapeModelStrings(false);
    content.add(helpLabel);

    AjaxLink ok = new AjaxLink(ID_BUTTON_OK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            closePerformed(target);
        }
    };
    content.add(ok);
}
 
Example 41
Project: midpoint   File: CapabilitiesPanel.java   Source Code and License 6 votes vote down vote up
private void createCapabilityButton(String id) {
	AjaxLink<Boolean> button = new AjaxLink<Boolean>(id, new PropertyModel<Boolean>(getModel(), id)) {

		@Override
		public void onClick(AjaxRequestTarget target) {
			// TODO:
		}

	};

	button.add(new AttributeModifier("class",
			button.getModelObject() ? "btn btn-app btn-resource-capability bg-light-blue"
					: "btn btn-app btn-resource-capability bg-gray text-light-blue"));

	button.add(new Label("label", new ResourceModel("CapabilitiesType." + id)));

	add(button);
}
 
Example 42
Project: pm-wicket-archetype   File: ConfirmModal.java   Source Code and License 6 votes vote down vote up
@Override 
public void onInitialize(){
	super.onInitialize();

	/**
	 * Confirm buttom
	 */
	AjaxLink<Void> confirmBtn = new AjaxLink<Void>("closeOk") {
		private static final long serialVersionUID = 1L;
		@Override
		public void onClick(AjaxRequestTarget target) {
			hide(target);
			callOnSubmit(target);
		}
	};
	add(confirmBtn);
}
 
Example 43
Project: edemocracia   File: WikiLegisArtigoPanel.java   Source Code and License 6 votes vote down vote up
private void initMostrarLegislacao() {
	mostrarLegislacao = new AjaxLink<Void>("mostrarLegislacao") {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onConfigure() {
			super.onConfigure();
			ArtigoDisplay objeto = WikiLegisArtigoPanel.this.getModelObject();
			setVisible(objeto != null && objeto.getLegislacaoVigente() != null
					&& !objeto.getLegislacaoVigente().trim().isEmpty());
		}

		@Override
		public void onClick(AjaxRequestTarget target) {
			legislacaoVigenteRegiao.setVisible(!legislacaoVigenteRegiao.isVisible());
			if (target != null)
				target.addComponent(legislacaoVigenteRegiao);
		}

	};
	add(mostrarLegislacao);
}
 
Example 44
Project: edemocracia   File: WikiLegisArtigoPanel.java   Source Code and License 6 votes vote down vote up
private void initOcultarLegislacao() {
	ocultarLegislacao = new AjaxLink<Void>("ocultarLegislacao") {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onConfigure() {
			super.onConfigure();
			ArtigoDisplay objeto = WikiLegisArtigoPanel.this.getModelObject();
			setVisible(objeto != null && objeto.getLegislacaoVigente() != null
					&& !objeto.getLegislacaoVigente().trim().isEmpty());
		}

		@Override
		public void onClick(AjaxRequestTarget target) {
			legislacaoVigenteRegiao.setVisible(false);
			if (target != null)
				target.addComponent(legislacaoVigenteRegiao);
		}

	};
	legislacaoVigenteRegiao.add(ocultarLegislacao);

}
 
Example 45
Project: edemocracia   File: ComentariosPanel.java   Source Code and License 6 votes vote down vote up
/**
 * Link para adicionar comentário
 */
private void initAdicionarComentario() {
	adicionarComentario = new AjaxLink<Void>("adicionarComentario") {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		@Override
		public void onClick(AjaxRequestTarget target) {
			adicionarComentario("comentarioRaiz", comentariosContainer,
					MBMessageConstants.DEFAULT_PARENT_MESSAGE_ID);
			if (target != null)
				target.addComponent(comentariosContainer);
		}

		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(UIUtils.possuiPermissoes(ActionKeys.ADD_DISCUSSION));
		}
	};
	comentariosContainer.add(adicionarComentario);
}
 
Example 46
Project: edemocracia   File: ComentariosPanel.java   Source Code and License 6 votes vote down vote up
private void initOcultarComentarios() {

		ocultarComentarios = new AjaxLink<Void>("ocultarComentarios") {

			private static final long serialVersionUID = 1L;

			@Override
			public void onClick(AjaxRequestTarget target) {

				MarkupContainer parent = getParent();
				while (parent != null
						&& !(parent instanceof WikiLegisArtigoPanel))
					parent = parent.getParent();
				if (parent != null)
					((WikiLegisArtigoPanel) parent).ocultaComentarios(target);

			}
		};
		add(ocultarComentarios);
	}
 
Example 47
Project: syncope   File: TopologyITCase.java   Source Code and License 6 votes vote down vote up
@Test
public void showTopologyToggleMenu() {
    TESTER.executeAjaxEvent("body:resources:2:resources:0:res", Constants.ON_CLICK);
    TESTER.assertComponent("body:toggle:container:content:togglePanelContainer:container:actions:delete",
            AjaxLink.class);
    TESTER.assertComponent("body:toggle:container:content:togglePanelContainer:container:actions:edit",
            AjaxLink.class);
    TESTER.assertComponent("body:toggle:container:content:togglePanelContainer:container:actions:propagation",
            AjaxLink.class);
    TESTER.assertComponent("body:toggle:container:content:togglePanelContainer:container:actions:pull",
            AjaxLink.class);
    TESTER.assertComponent("body:toggle:container:content:togglePanelContainer:container:actions:push",
            AjaxLink.class);
    TESTER.executeAjaxEvent("body:syncope", Constants.ON_CLICK);
    TESTER.assertComponent("body:toggle:container:content:togglePanelContainer:container:actions:tasks",
            AjaxLink.class);
    TESTER.executeAjaxEvent("body:conns:0:conns:3:conn", Constants.ON_CLICK);
    TESTER.assertComponent("body:toggle:container:content:togglePanelContainer:container:actions:create",
            AjaxLink.class);
    TESTER.assertComponent("body:toggle:container:content:togglePanelContainer:container:actions:delete",
            AjaxLink.class);
    TESTER.assertComponent("body:toggle:container:content:togglePanelContainer:container:actions:edit",
            AjaxLink.class);
}
 
Example 48
Project: syncope   File: MultilevelPanel.java   Source Code and License 6 votes vote down vote up
public MultilevelPanel(final String id) {
    super(id);

    firstLevelContainer = new WebMarkupContainer("firstLevelContainer");
    firstLevelContainer.setOutputMarkupPlaceholderTag(true);
    firstLevelContainer.setVisible(true);
    add(firstLevelContainer);

    secondLevelContainer = new WebMarkupContainer("secondLevelContainer");
    secondLevelContainer.setOutputMarkupPlaceholderTag(true);
    secondLevelContainer.setVisible(false);
    add(secondLevelContainer);

    secondLevelContainer.add(new AjaxLink<String>("back") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            onClickBackInternal(target);
            prev(target);
        }
    });
}
 
Example 49
Project: wicket-crudifier   File: ButtonColumn.java   Source Code and License 6 votes vote down vote up
public Component createComponent(String id, final T object,
		Component resourceBase, Map<Class<?>, IObjectRenderer<?>> renderers) {
	ButtonPanel panel = new ButtonPanel(id);
	panel.add(new AjaxLink<Void>("button") {
		private static final long serialVersionUID = 4260049524761483954L;
		{
			add(AttributeModifier.append("class", getCssClass()));
		}

		@Override
		public void onClick(AjaxRequestTarget target) {
			ButtonColumn.this.onClick(Model.of(object), target);
		}
	}.add(new Label("label", resourceBase.getString(
			propertyName + ".button.label", new Model<String>(), "Button"))));
	return panel;
}
 
Example 50
Project: gizmo-v3   File: NavigatorPanel.java   Source Code and License 6 votes vote down vote up
private void initPrevious() {
    WebMarkupContainer previous = new WebMarkupContainer(ID_PREVIOUS);
    previous.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return isPreviousEnabled() ? "" : "disabled";
        }
    }));
    add(previous);
    AjaxLink previousLink = new AjaxLink(ID_PREVIOUS_LINK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            previousPerformed(target);
        }
    };
    previousLink.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return isPreviousEnabled();
        }
    });
    previous.add(previousLink);
}
 
Example 51
Project: gizmo-v3   File: LinkIconPanel.java   Source Code and License 6 votes vote down vote up
private void initLayout(IModel<String> model, IModel<String> titleModel) {
    AjaxLink link = new AjaxLink(ID_LINK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            onClickPerformed(target);
        }
    };

    Label image = new Label(ID_IMAGE);
    image.add(AttributeModifier.replace("class", model));
    if (titleModel != null) {
        image.add(AttributeModifier.replace("title", titleModel));
    }
    link.add(image);
    link.setOutputMarkupId(true);
    add(link);
}
 
Example 52
Project: gizmo-v3   File: LinkPanel.java   Source Code and License 6 votes vote down vote up
public LinkPanel(String id, IModel<String> label) {
    super(id);

    AjaxLink link = new AjaxLink(ID_LINK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            LinkPanel.this.onClick(target);
        }
    };
    link.add(new Label(ID_LABEL, label));
    link.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return LinkPanel.this.isEnabled();
        }
    });
    add(link);
}
 
Example 53
Project: midpoint   File: HelpInfoPanel.java   Source Code and License 6 votes vote down vote up
public void initLayout(final String messageKey){
    WebMarkupContainer content = new WebMarkupContainer(ID_CONTENT);
    add(content);

    Label helpLabel = new Label(ID_HELP, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(messageKey);
        }
    });
    helpLabel.setEscapeModelStrings(false);
    content.add(helpLabel);

    AjaxLink ok = new AjaxLink(ID_BUTTON_OK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            closePerformed(target);
        }
    };
    content.add(ok);
}
 
Example 54
Project: midpoint   File: MultiValueChoosePanel.java   Source Code and License 6 votes vote down vote up
protected void initButtons(ListItem<T> item, WebMarkupContainer parent) {
        WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP); {
	        buttonGroup.setOutputMarkupId(true);

	        AjaxLink remove = new AjaxLink(ID_REMOVE) {

	            @Override
	            public void onClick(AjaxRequestTarget target) {
	                removeValuePerformed(target, item.getModelObject());
	            }
	        };

	        remove.add(new VisibleEnableBehaviour() {

	            @Override
	            public boolean isVisible() {
	                return isRemoveButtonVisible();
	            }
	        });
	        buttonGroup.add(remove);
        }

        parent.add(buttonGroup);
}
 
Example 55
Project: midpoint   File: SimpleRoleSelector.java   Source Code and License 6 votes vote down vote up
private void initLayout() {
    setOutputMarkupId(true);
    ListView<PrismObject<R>> list = new ListView<PrismObject<R>>(ID_LIST, availableRoles) {
        @Override
        protected void populateItem(ListItem<PrismObject<R>> item) {
            item.add(createRoleLink(ID_ITEM, item.getModel()));
        }
    };
    list.setOutputMarkupId(true);
    add(list);

    AjaxLink<String> buttonReset = new AjaxLink<String>(ID_BUTTON_RESET) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            reset();
            target.add(SimpleRoleSelector.this);
        }
    };
    buttonReset.setBody(createStringResource("SimpleRoleSelector.reset"));
    add(buttonReset);
}
 
Example 56
Project: midpoint   File: LinkIconPanel.java   Source Code and License 6 votes vote down vote up
private void initLayout(IModel<String> model, IModel<String> titleModel) {
    AjaxLink link = new AjaxLink(ID_LINK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            onClickPerformed(target);
        }
    };

    Label image = new Label(ID_IMAGE);
    image.add(AttributeModifier.replace("class", model));
    if (titleModel != null) {
        image.add(AttributeModifier.replace("title", titleModel));
    }
    link.add(image);
    link.setOutputMarkupId(true);
    add(link);
}
 
Example 57
Project: midpoint   File: TableConfigurationPanel.java   Source Code and License 6 votes vote down vote up
protected void initLayout() {
    WebMarkupContainer cogButton = new WebMarkupContainer(ID_COG_BUTTON);
    cogButton.setOutputMarkupId(true);
    add(cogButton);

    WebMarkupContainer pageSize = new WebMarkupContainer(ID_PAGE_SIZE);
    pageSize.setOutputMarkupId(true);
    cogButton.add(pageSize);

    AjaxLink tableColumns = new AjaxLink(ID_TABLE_COLUMNS) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            tableColumnsPerformed(target);
        }
    };
    cogButton.add(tableColumns);
    tableColumns.setVisible(false); //todo implement [lazyman]

    initPopoverLayout();
}
 
Example 58
Project: midpoint   File: PrismContainerHeaderPanel.java   Source Code and License 6 votes vote down vote up
@Override
protected void initButtons() {
	
	add(new VisibleEnableBehaviour() {
		
		private static final long serialVersionUID = 1L;

		@Override
		public boolean isVisible() {
			return isContainerMultivalue();
		}
	});
	
	 AjaxLink addButton = new AjaxLink(ID_ADD_BUTTON) {
			private static final long serialVersionUID = 1L;

			@Override
            public void onClick(AjaxRequestTarget target) {
                addValue(target);
            }
        };
        
        add(addButton);

}
 
Example 59
Project: midpoint   File: WizardHelpDialog.java   Source Code and License 6 votes vote down vote up
public void initLayout(WebMarkupContainer content){
    Label helpLabel = new Label(ID_HELP, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(determineHelpKey());
        }
    });
    helpLabel.setEscapeModelStrings(false);
    content.add(helpLabel);

    AjaxLink ok = new AjaxLink(ID_BUTTON_OK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            closePerformed(target);
        }
    };
    content.add(ok);
}
 
Example 60
Project: midpoint   File: CapabilitiesPanel.java   Source Code and License 6 votes vote down vote up
private void createCapabilityButton(String id) {
	AjaxLink<Boolean> button = new AjaxLink<Boolean>(id, new PropertyModel<Boolean>(getModel(), id)) {

		@Override
		public void onClick(AjaxRequestTarget target) {
			// TODO:
		}

	};

	button.add(new AttributeModifier("class",
			button.getModelObject() ? "btn btn-app btn-resource-capability bg-light-blue"
					: "btn btn-app btn-resource-capability bg-gray text-light-blue"));

	button.add(new Label("label", new ResourceModel("CapabilitiesType." + id)));

	add(button);
}