List of usage examples for org.apache.wicket Component setVisible
public final Component setVisible(final boolean visible)
From source file:org.hippoecm.frontend.editor.builder.LayoutPluginEditorPlugin.java
License:Apache License
public LayoutPluginEditorPlugin(final IPluginContext context, final IPluginConfig config) { super(context, config); Component removeLink = get("head:remove"); if (removeLink != null) { removeLink.setVisible(false); }// ww w. j av a 2 s.co m }
From source file:org.hippoecm.frontend.plugins.cms.browse.SectionViewer.java
License:Apache License
@Override public void onBeforeRender() { if (sections != null) { for (String extension : sections.getSections()) { IBrowserSection section = sections.getSection(extension); Component component = section.getComponent(); component.setVisible(sections.isActive(extension)); }/* w ww . j a v a 2 s . com*/ } super.onBeforeRender(); }
From source file:org.hippoecm.frontend.plugins.cms.browse.tree.SectionTreePlugin.java
License:Apache License
@Override public void onBeforeRender() { final List<Section> sectionList = sections.getObject(); if (findSectionForInitialFocus) { Section section = findFocus();/*w w w. jav a2 s .c om*/ if (section != null) { focusRenderer(section); } else { if (!sectionList.isEmpty()) { section = sectionList.get(0); select.getModel().setObject(section); focusSection(section); } } findSectionForInitialFocus = false; } for (Section section : sectionList) { for (IRenderService service : section.getChildren()) { Component component = service.getComponent(); component.setVisible(section.focused); } } super.onBeforeRender(); }
From source file:org.hippoecm.frontend.plugins.standardworkflow.AddDocumentDialog.java
License:Apache License
public AddDocumentDialog(AddDocumentArguments addDocumentModel, IModel<String> title, String category, Set<String> prototypes, boolean translated, final IWorkflowInvoker invoker, IModel<StringCodec> nodeNameCodec, ILocaleProvider localeProvider, final WorkflowDescriptorModel workflowDescriptorModel) { super(invoker, Model.of(addDocumentModel)); this.title = title; this.nodeNameCodecModel = nodeNameCodec; final PropertyModel<String> prototypeModel = new PropertyModel<>(addDocumentModel, "prototype"); add(nameUriContainer = new NameUriField("name-url", this.nodeNameCodecModel)); // The dialog produces ajax requests in NameUriField and OK/Cancel dialog buttons, which may cause Wicket // exceptions when typing very fast. Thus it needs to use a dedicated ajax channel with ACTIVE behavior when // some AJAX requests may be sent after dialog is closed. final AjaxChannel activeAjaxChannel = new AjaxChannel(getMarkupId(), AjaxChannel.Type.ACTIVE); setAjaxChannel(activeAjaxChannel);/*w ww. j a v a 2 s. com*/ nameUriContainer.setAjaxChannel(activeAjaxChannel); final IModel<String> documentType = new StringResourceModel("document-type", this, null); final Label typeLabel = new Label("typelabel", documentType); add(typeLabel); if (prototypes.size() > 1) { final List<String> prototypesList = new LinkedList<>(prototypes); final DropDownChoice<String> folderChoice; SortedTypeChoiceRenderer typeChoiceRenderer = new SortedTypeChoiceRenderer(this, prototypesList); add(folderChoice = new DropDownChoice<>("prototype", prototypeModel, typeChoiceRenderer, typeChoiceRenderer)); folderChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { target.add(folderChoice); } }); folderChoice.setNullValid(false); folderChoice.setRequired(true); folderChoice.setLabel(documentType); // while not a prototype chosen, disable ok button add(new EmptyPanel("notypes").setVisible(false)); } else if (prototypes.size() == 1) { Component component; add(component = new EmptyPanel("prototype")); component.setVisible(false); prototypeModel.setObject(prototypes.iterator().next()); add(new EmptyPanel("notypes").setVisible(false)); typeLabel.setVisible(false); } else { // if the folderWorkflowPlugin.templates.get(category).size() = 0 you cannot add this // category currently. Component component; add(component = new EmptyPanel("prototype")); component.setVisible(false); prototypeModel.setObject(null); add(new Label("notypes", "There are no types available for : [" + category + "] First create document types please.")); nameUriContainer.getNameComponent().setVisible(false); typeLabel.setVisible(false); } languageField = new LanguageField("language", new PropertyModel<>(addDocumentModel, "language"), localeProvider); if (!translated) { languageField.setVisible(false); } add(languageField); add(new AddDocumentValidator(this, nameUriContainer, workflowDescriptorModel)); add(CssClass.append("add-document-dialog")); setSize(DialogConstants.MEDIUM_AUTO); }
From source file:org.lbogdanov.poker.web.markup.NavBar.java
License:Apache License
/** * @see Panel#Panel(String)// w w w . j av a 2s.c o m */ public NavBar(String id) { super(id); Behavior visibilityManager = new Behavior() { @Override public void onConfigure(Component component) { component.setVisible(userService.getCurrentUser() != null); } }; WebMarkupContainer userMenu = new WebMarkupContainer("userMenu"); WebMarkupContainer navigation = new WebMarkupContainer("navigation"); Label username = new BodylessLabel("username", new AbstractReadOnlyModel<User>() { @Override public User getObject() { return userService.getCurrentUser(); } }); userMenu.add(username, new LogoutLink("logout")); navigation.add(new WebMarkupContainer("sessions").add(append("class", new AbstractReadOnlyModel<String>() { @Override public String getObject() { return MySessionsPage.class.equals(NavBar.this.getPage().getClass()) ? "active" : null; } }))); add(userMenu.add(visibilityManager), navigation.add(visibilityManager), new BookmarkablePageLink<Void>("home", getApplication().getHomePage())); }
From source file:org.obiba.onyx.wicket.reusable.Dialog.java
License:Open Source License
/** * Sets the content of the dialog box.//from w ww.ja v a2 s . co m * * @param component */ @Override public Dialog setContent(Component component) { if (component.getId().equals(getContentId()) == false) { throw new WicketRuntimeException("Dialog box content id is wrong."); } component.setOutputMarkupPlaceholderTag(true); component.setVisible(true); form.replace(component); return this; }
From source file:org.obiba.onyx.wicket.toggle.ToggleLink.java
License:Open Source License
/** * Constructor.// w w w. jav a2 s.com * @param id * @param showModel * @param hideModel * @param toggle */ @SuppressWarnings("serial") public ToggleLink(String id, final IModel showModel, final IModel hideModel, final Component toggle) { super(id); setOutputMarkupId(true); toggle.getParent().setOutputMarkupId(true); AjaxLink link = new AjaxLink("link") { @Override public void onClick(AjaxRequestTarget target) { toggle.setVisible(!toggle.isVisible()); if (toggle.isVisible()) { toggleLabel.setDefaultModel(hideModel); } else { toggleLabel.setDefaultModel(showModel); } target.addComponent(toggle.getParent()); } }; add(link); link.add(toggleLabel = new Label("label", showModel)); toggle.setVisible(false); }
From source file:org.onexus.website.api.utils.panels.LoginPanel.java
License:Apache License
@Override protected void onBeforeRender() { LoginContext ctx = LoginContext.get(); WebMarkupContainer link;//from ww w . jav a2s. c o m if (!LoginContext.get().isAnonymous()) { if (WebsiteApplication.get().usePersonSignIn()) { link = new ExternalLink("account-details", "https://login.persona.org"); link.add(new AttributeModifier("target", "_tab")); } else { //TODO Account manager on JAAS authentication system link = new WebMarkupContainer("account-details"); } } else { if (WebsiteApplication.get().usePersonSignIn()) { link = new WebMarkupContainer("account-details"); link.add(new VerifyBehavior() { @Override protected void onSuccess(AjaxRequestTarget target) { BrowserId browserId = SessionHelper.getBrowserId(Session.get()); if (browserId != null && WebsiteSession.get().authenticate(browserId.getEmail(), null)) { target.appendJavaScript("location.reload();"); } } @Override protected void onFailure(AjaxRequestTarget target, final String failureReason) { } }); } else { link = new Link<String>("account-details") { @Override public void onClick() { WebsiteApplication.get().restartResponseAtSignInPage(); } }; } } link.add(new AttributeModifier("title", ctx.isAnonymous() ? "Sign in" : "Account Details")); link.add(new Label("username", ctx.isAnonymous() ? "Sign in" : ctx.getUserName())); Component signOut; if (!WebsiteApplication.get().usePersonSignIn() || ctx.isAnonymous()) { signOut = new BookmarkablePageLink<String>("signout", SignOutPage.class); } else { signOut = new WebMarkupContainer("signout").add(new SignOutBehavior()); } signOut.setVisible(!ctx.isAnonymous()); addOrReplace(signOut); addOrReplace(link); super.onBeforeRender(); }
From source file:org.opensingular.form.wicket.behavior.ConfigureByMInstanciaAttributesBehavior.java
License:Apache License
@Override public void onConfigure(Component component) { super.onConfigure(component); if (component != null) { component.setEnabled(isInstanceEnabled(component)); component.setVisible(isInstanceVisible(component)); }//from w w w .j a va2s . c o m }
From source file:org.opensingular.form.wicket.behavior.InvisibleIfNullOrEmptyBehavior.java
License:Apache License
@Override public void onConfigure(Component component) { component.setVisible(!NullOrEmptyModel.nullOrEmpty(component.getDefaultModelObject())); }