List of usage examples for org.apache.wicket Component setVisible
public final Component setVisible(final boolean visible)
From source file:net.rrm.ehour.ui.timesheet.panel.ProjectOverviewPanel.java
License:Open Source License
/** * Create fold link (also contains the creation of the summary row) */// w ww . j ava2s . com @SuppressWarnings("serial") private Component createFoldLink(final Component original) { AjaxLink<String> foldLink = new AjaxLink<String>(ID_FOLD_LINK) { @Override public void onClick(AjaxRequestTarget target) { boolean isVisible = original.isVisible(); original.setVisible(!isVisible); target.add(original); WebMarkupContainer img = createFoldImage(!isVisible); this.get(ID_FOLD_IMG).replaceWith(img); target.add(img); } }; final WebMarkupContainer originalImage = createFoldImage(false); foldLink.add(originalImage); return foldLink; }
From source file:nl.knaw.dans.common.web.template.AbstractCommonForm.java
License:Apache License
/** * Disable all components in the form, make any submit component invisible and make a link visible. * * @param enableComponents/*from w ww . ja v a 2 s . c om*/ * list of all components */ protected void disableForm(final String[] enableComponents) { // Disable all components. final AttributeModifier disabler = new AttributeModifier("disabled", true, new Model("true")); this.visitChildren(FormComponent.class, new IVisitor() { public Object component(final Component component) { // Submitlinks and buttons are removed. if (SubmitLink.class.isAssignableFrom(component.getClass()) || Button.class.isAssignableFrom(component.getClass())) { component.setVisible(false); } else { // Others disabled. component.add(disabler); } return IVisitor.CONTINUE_TRAVERSAL; } }); // Disable the form. this.setEnabled(false); // Enable some specific components for (String componentName : enableComponents) { this.get(componentName).setVisible(true); } }
From source file:org.apache.isis.viewer.wicket.ui.pages.PageAbstract.java
License:Apache License
/** * Convenience for subclasses// w ww . java 2s.c om */ protected void addBookmarkedPages(final MarkupContainer container) { Component bookmarks = getComponentFactoryRegistry().createComponent(ComponentType.BOOKMARKED_PAGES, ID_BOOKMARKED_PAGES, getBookmarkedPagesModel()); container.add(bookmarks); bookmarks.add(new Behavior() { @Override public void onConfigure(Component component) { super.onConfigure(component); PageParameters parameters = getPageParameters(); component.setVisible(parameters.get(PageParametersUtils.ISIS_NO_HEADER_PARAMETER_NAME).isNull()); } }); }
From source file:org.apache.isis.viewer.wicket.ui.util.Components.java
License:Apache License
private static void setVisible(final MarkupContainer container, final boolean visibility, final String wicketId) { final Component childComponent = container.get(wicketId); childComponent.setVisible(visibility); }
From source file:org.apache.syncope.client.console.wicket.markup.html.form.AbstractFieldPanel.java
License:Apache License
public AbstractFieldPanel<T> hideLabel() { final Component label = get(LABEL); if (label != null) { label.setVisible(false); }//w w w . j a v a 2s . c o m return this; }
From source file:org.artifactory.webapp.wicket.page.browse.treebrowser.action.MoveAndCopyBasePanel.java
License:Open Source License
protected TitledAjaxSubmitLink createDryRunButton(Form form, String wicketId) { return new TitledAjaxSubmitLink(wicketId, "Dry Run", form) { @Override//from w ww .j a v a2s . com protected void onSubmit(AjaxRequestTarget target, Form form) { if (!isSearchResultsOperation()) { if (!sourceAndTargetAreValid()) { AjaxUtils.refreshFeedback(target); return; } } MoveMultiStatusHolder status = executeDryRun(); StringBuilder result = new StringBuilder(); if (!status.isError() && !status.hasWarnings()) { result.append(("<div class='info'>Dry run completed successfully with no errors.</div>")); } else { result.append( ("<div class='title'>Dry run completed with the following errors/warnings:</div>")); if (status.isError()) { List<StatusEntry> errors = status.getErrors(); for (StatusEntry error : errors) { result.append("<div class='notice'>Error: ") .append(Strings.escapeMarkup(error.getMessage(), false, false)) .append("</div>"); } } if (status.hasWarnings()) { List<StatusEntry> warnings = status.getWarnings(); for (StatusEntry warning : warnings) { result.append("<div class='notice'>Warning: ") .append(Strings.escapeMarkup(warning.getMessage(), false, false)) .append("</div>"); } } } Component dryRunResult = form.get("dryRunResult"); dryRunResult.setDefaultModelObject(result.toString()); dryRunResult.setVisible(true); target.add(MoveAndCopyBasePanel.this); target.add(form); AjaxUtils.refreshFeedback(target); ModalHandler.bindHeightTo("dryRunResult"); } }; }
From source file:org.artifactory.webapp.wicket.page.browse.treebrowser.tabs.jnlp.JnlpViewTabPanel.java
License:Open Source License
private void setRepository(RepoDescriptor repoDescriptor) { String servletContextUrl = RequestUtils.getWicketServletContextUrl(); final String key = repoDescriptor.getKey(); final String virtualRepoUrl = servletContextUrl + "/" + key + "/"; String jnlpHref = virtualRepoUrl + fileItem.getFileInfo().getRelPath(); JnlpUtils.AppletInfo appletInfo = JnlpUtils.getAppletInfo(jnlpContent, jnlpHref); boolean isJavaFxApplet = appletInfo != null; // add links//w w w .j a va 2 s.c om MarkupContainer jnlpLinksBorder = new FieldSetBorder("jnlpLinksBorder"); jnlpLinksBorder.add(new LaunchWebStartLink("webstart", virtualRepoUrl, key)); Component appletLink = new LaunchAppletLink("applet", appletInfo, key); appletLink.setVisible(isJavaFxApplet); jnlpLinksBorder.add(appletLink); addOrReplace(jnlpLinksBorder); // add script snippet if (isJavaFxApplet) { MarkupContainer scriptSnippetBorder = new FieldSetBorder("scriptSnippetBorder") { @Override public String getTitle() { return format("Applet's Script Snippet (%s repository)", key); } }; scriptSnippetBorder.add( WicketUtils.getSyntaxHighlighter("scriptSnippet", appletInfo.getScriptSnippet(), Syntax.xml)); addOrReplace(scriptSnippetBorder); } else { MarkupContainer scriptSnippetBorder = new PlaceHolder("scriptSnippetBorder"); scriptSnippetBorder.setOutputMarkupId(true); scriptSnippetBorder.setOutputMarkupPlaceholderTag(true); scriptSnippetBorder.add(new PlaceHolder("scriptSnippet")); addOrReplace(scriptSnippetBorder); } }
From source file:org.artifactory.webapp.wicket.page.home.WelcomeBorder.java
License:Open Source License
private void addArtifactsCount() { Component countLabel; if (authorizationService.isAdmin()) { countLabel = new TitledPageLink("artifactsCount", "", StorageSummaryPage.class); } else {//from w ww.j a va 2s .co m countLabel = new Label("artifactsCount", ""); } add(countLabel); try { long count = repoService.getArtifactCount(); countLabel.setDefaultModelObject(NumberFormatter.formatLong(count)); } catch (RepositoryRuntimeException e) { countLabel.setVisible(false); log.warn("Failed to retrieve artifacts count: " + e.getMessage()); } }
From source file:org.artifactory.webapp.wicket.page.security.profile.BintrayProfilePanel.java
License:Open Source License
public BintrayProfilePanel(String id, final T model, boolean enableFields) { super(id);/* w w w . j a v a2 s . c om*/ setOutputMarkupId(true); setDefaultModel(getModel(model)); add(new CssClass("display:block")); bintrayUsername = new TextField<>("bintrayUsername", new Model<>(HIDDEN_PASSWORD)); bintrayUsername.setEnabled(enableFields); bintrayUsername.setRequired(false); add(bintrayUsername); bintrayApiKey = new PasswordTextField("bintrayApiKey", new PropertyModel<String>(model, "bintrayApiKey")); bintrayApiKey.setResetPassword(false); bintrayApiKey.setEnabled(enableFields); bintrayApiKey.setRequired(false); add(bintrayApiKey); addHelpBubbles(); Component bintrayLink; if (StringUtils.isBlank(getBintrayAuth())) { bintrayLink = new ExternalLink("bintrayLink", bintrayService.getBintrayRegistrationUrl(), "Register to Bintray..."); bintrayLink.add(new CssClass("bintray-link")); } else { bintrayLink = new WebMarkupContainer("bintrayLink"); bintrayLink.setVisible(false); } add(bintrayLink); testButton = new TitledAjaxSubmitLink("test", "Test") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { try { Map<String, String> headersMap = WicketUtils.getHeadersMap(); BintrayUser bintrayUser = bintrayService.getBintrayUser(getBintrayUser(), getBintrayApiKey(), headersMap); info("Successfully authenticated '" + bintrayUser.getFullName() + "'"); } catch (IOException e) { error("Connection failed with exception: " + e.getMessage()); } catch (BintrayException e) { error("Could not authenticate user: " + e.getStatus() + " " + e.getMessage()); } catch (IllegalArgumentException e) { error(e.getMessage()); } AjaxUtils.refreshFeedback(target); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { return new ImmediateAjaxIndicatorDecorator(); } }; testButton.setEnabled(false); add(testButton); }
From source file:org.cast.isi.page.Notebook.java
License:Open Source License
private ListView<ISIResponse> makeResponseListView(Entry<ISIPrompt, List<ISIResponse>> entry) { final ISIPrompt currentPrompt = entry.getKey(); return new ListView<ISIResponse>("responseList", entry.getValue()) { private static final long serialVersionUID = 1L; @Override/*from ww w .java 2s .c o m*/ protected void populateItem(ListItem<ISIResponse> item) { // Anchor so links can jump to this id item.add(new WebMarkupContainer("responseAnchor") .add(new AttributeModifier("name", String.valueOf(item.getModelObject().getId())))); // Actual response item.add(factory.makeResponseViewComponent("response", item.getModel())); // Remove From Notebook button NotebookRemoveDialog removeDialog = new NotebookRemoveDialog("removeModal", item.getModel()); item.add(removeDialog); Component removeLink = new WebMarkupContainer("removeLink") .add(removeDialog.getClickToOpenBehavior()); removeLink.setVisible(!isTeacher); item.add(removeLink); // Link back to content BookmarkablePageLink<ISIStandardPage> editLink = new SectionLinkFactory().linkTo("editLink", currentPrompt.getContentElement().getContentLocObject().getSection(), currentPrompt.getContentElement().getXmlId()); editLink.add(new ClassAttributeModifier("sectionLink")); item.add(editLink); } }; }