Java Code Examples for org.apache.wicket.markup.html.WebMarkupContainer.setVisible()

The following are Jave code examples for showing how to use setVisible() of the org.apache.wicket.markup.html.WebMarkupContainer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: gitplex-mit   File: RequestOverviewPage.java   Source Code and License Vote up 7 votes
private WebMarkupContainer newManageContainer() {
	WebMarkupContainer container = new WebMarkupContainer("manage");
	container.setVisible(SecurityUtils.canModify(getPullRequest()));
	container.add(new Link<Void>("synchronize") {

		@Override
		public void onClick() {
			GitPlex.getInstance(PullRequestManager.class).check(getPullRequest());
			Session.get().success("Pull request is synchronized");
		}
		
	});
	container.add(new Link<Void>("delete") {

		@Override
		public void onClick() {
			PullRequest request = getPullRequest();
			GitPlex.getInstance(PullRequestManager.class).delete(request);
			Session.get().success("Pull request #" + request.getNumber() + " is deleted");
			setResponsePage(RequestListPage.class, RequestListPage.paramsOf(getProject()));
		}
		
	}.add(new ConfirmOnClick("Do you really want to delete this pull request?")));
	return container;
}
 
Example 2
Project: openNaEF   File: LocationViewPage.java   Source Code and License Vote up 6 votes
private void populateNode() throws ExternalServiceException, IOException, RemoteException {
    ListView<NodeDto> list = new ListView<NodeDto>("nodeList", this.model) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<NodeDto> item) {
            NodeDto node = item.getModelObject();
            BookmarkablePageLink<Void> link = NodePageUtil.createNodeLink("nodeLink", node);
            item.add(link);
        }
    };
    add(list);
    WebMarkupContainer container = new WebMarkupContainer("nodeBlock");
    add(container);
    container.setVisible(this.model.isVisible());
}
 
Example 3
Project: gitplex-mit   File: ConcreteListPropertyViewer.java   Source Code and License Vote up 5 votes
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(new ListView<PropertyContext<Serializable>>("headers", elementPropertyContexts) {

		@Override
		protected void populateItem(ListItem<PropertyContext<Serializable>> item) {
			item.add(new Label("header", EditableUtils.getName(item.getModelObject().getPropertyGetter())));
		}
		
	});
	add(new ListView<Serializable>("rows", elements) {

		@Override
		protected void populateItem(final ListItem<Serializable> rowItem) {
			rowItem.add(new ListView<PropertyContext<Serializable>>("columns", elementPropertyContexts) {

				@Override
				protected void populateItem(ListItem<PropertyContext<Serializable>> columnItem) {
					PropertyContext<Serializable> propertyContext = columnItem.getModelObject(); 
					Serializable elementPropertyValue = (Serializable) propertyContext.getPropertyValue(rowItem.getModelObject());
					columnItem.add(propertyContext.renderForView("cell", Model.of(elementPropertyValue)));
				}
				
			});
		}
		
	});
	WebMarkupContainer noElements = new WebMarkupContainer("noElements");
	noElements.setVisible(elements.isEmpty());
	noElements.add(AttributeModifier.append("colspan", elementPropertyContexts.size()));
	add(noElements);
}
 
Example 4
Project: gitplex-mit   File: CommitOptionPanel.java   Source Code and License Vote up 5 votes
private void newChangedContainer(@Nullable AjaxRequestTarget target) {
	WebMarkupContainer changedContainer = new WebMarkupContainer("changed");
	changedContainer.setVisible(change != null);
	changedContainer.setOutputMarkupPlaceholderTag(true);
	if (change != null) {
		changedContainer.add(new BlobDiffPanel("changes", new AbstractReadOnlyModel<Project>() {

			@Override
			public Project getObject() {
				return context.getProject();
			}
			
		}, new Model<PullRequest>(null), change, DiffViewMode.UNIFIED, null, null));
	} else {
		changedContainer.add(new WebMarkupContainer("changes"));
	}
	if (target != null) {
		replace(changedContainer);
		target.add(changedContainer);
		if (change != null) {
			String script = String.format("$('#%s .commit-option input[type=submit]').val('Commit and overwrite');", 
					getMarkupId());
			target.appendJavaScript(script);
		}
	} else {
		add(changedContainer);		
	}
}
 
Example 5
Project: vlo-curation   File: RecordPage.java   Source Code and License Vote up 5 votes
private Component createNavigation(final String id) {
    if (navigationModel != null) {
        final IModel<String> tabModel = new AbstractReadOnlyModel<String>() {
            @Override
            public String getObject() {
                return TABS_ORDER.get(tabs.getSelectedTab());
            }
        };

        // Add a panel that shows the index of the current record in the
        // resultset and allows for forward/backward navigation
        return new RecordNavigationPanel(id, navigationModel, tabModel) {

            @Override
            protected void onConfigure() {
                final SearchContext context = navigationModel.getObject();
                setVisible(context != null && context.getResultCount() > 1);
            }

        };
    } else {
        // If no context model is available (i.e. when coming from a bookmark
        // or external link, do not show the navigation panel
        final WebMarkupContainer navigationDummy = new WebMarkupContainer(id);
        navigationDummy.setVisible(false);
        return navigationDummy;
    }
}
 
Example 6
Project: vlo-curation   File: BootstrapDropdown.java   Source Code and License Vote up 5 votes
protected Component createDropDownLink(String id) {
    //link that activates dropdown
    final Link<Boolean> link = new Link<Boolean>(id, openStateModel) {
        @Override
        public void onClick() {
            getModel().setObject(!getModelObject());
        }
    };
    final Serializable buttonClass = getButtonClass();
    if (buttonClass != null) {
        link.add(new AttributeAppender("class", buttonClass, " "));
    }

    //optional icon
    final WebMarkupContainer icon = new WebMarkupContainer("buttonIcon");
    final Serializable iconClass = getButtonIconClass();
    if (iconClass != null) {
        icon.add(new AttributeModifier("class", iconClass));
    }
    link.add(icon);

    //caret
    final WebMarkupContainer caret = new WebMarkupContainer("caret");
    caret.setVisible(showCaret());
    link.add(caret);
    return link;
}
 
Example 7
Project: singular-server   File: TopMenu.java   Source Code and License Vote up 5 votes
protected void buildContent() {
        queue(new Label("nome", $m.ofValue(SingularSession.get().getName())));

        WebMarkupContainer avatar    = new WebMarkupContainer("codrh");
        Optional<String>   avatarSrc = Optional.ofNullable(null);
        avatarSrc.ifPresent(src -> avatar.add($b.attr("src", src)));
        queue(avatar);
        avatar.setVisible(avatarSrc.isPresent());

        SecurityAuthPathsFactory securityAuthPathsFactory = new SecurityAuthPathsFactory();
        SecurityAuthPaths        securityAuthPaths        = securityAuthPathsFactory.get();

        Link logout = new Link("logout") {
            @Override
            public void onClick() {
                throw new RedirectToUrlException(securityAuthPaths.getLogoutPath(RequestCycle.get()));
            }
        };

        queue(logout);


//        final WebMarkupContainer opcoesVisuais = new WebMarkupContainer("opcoes-visuais");
//        opcoesVisuais.setRenderBodyOnly(true);
//        opcoesVisuais.setVisible(option.options().size() > 1);
//        opcoesVisuais.queue(buildSkinOptions());
//        queue(opcoesVisuais);
    }
 
Example 8
Project: gitplex-mit   File: BlobEditPanel.java   Source Code and License Vote up 4 votes
protected WebMarkupContainer newEditOptions(String componentId) {
	WebMarkupContainer options = new WebMarkupContainer(componentId);
	options.setVisible(false);
	return options;
}
 
Example 9
Project: gitplex-mit   File: BlobViewPanel.java   Source Code and License Vote up 4 votes
protected WebMarkupContainer newOptions(String id) {
	WebMarkupContainer options = new WebMarkupContainer(id);
	options.setVisible(false);
	return options;
}
 
Example 10
Project: engerek   File: BoxedTablePanel.java   Source Code and License Vote up 4 votes
protected WebMarkupContainer createHeader(String headerId) {
	WebMarkupContainer header = new WebMarkupContainer(headerId);
	header.setVisible(false);
	return header;
}
 
Example 11
Project: engerek   File: QNameEditorPanel.java   Source Code and License Vote up 4 votes
private void initLayout(String localPartLabelKey, String localPartTooltipKey,
	String namespaceLabelKey, String namespaceTooltipKey, boolean markLocalPartAsRequired, boolean markNamespaceAsRequired){

      Label localPartLabel = new Label(ID_LOCAL_PART_LABEL, getString(localPartLabelKey));
      localPartLabel.setOutputMarkupId(true);
      localPartLabel.setOutputMarkupPlaceholderTag(true);
      add(localPartLabel);

WebMarkupContainer localPartRequired = new WebMarkupContainer(ID_LOCAL_PART_REQUIRED);
localPartRequired.setVisible(markLocalPartAsRequired);
add(localPartRequired);

      Label namespaceLabel = new Label(ID_NAMESPACE_LABEL, getString(namespaceLabelKey));
      namespaceLabel.setOutputMarkupId(true);
      namespaceLabel.setOutputMarkupPlaceholderTag(true);
      add(namespaceLabel);

WebMarkupContainer namespaceRequired = new WebMarkupContainer(ID_NAMESPACE_REQUIRED);
namespaceRequired.setVisible(markNamespaceAsRequired);
add(namespaceRequired);

TextField localPart = new TextField<>(ID_LOCAL_PART, localpartModel);
      localPart.setOutputMarkupId(true);
      localPart.setOutputMarkupPlaceholderTag(true);
      localPart.setRequired(isLocalPartRequired());
localPart.add(new UpdateBehavior());
      add(localPart);

      DropDownChoice namespace = new DropDownChoice<>(ID_NAMESPACE, namespaceModel, prepareNamespaceList());
      namespace.setOutputMarkupId(true);
      namespace.setOutputMarkupPlaceholderTag(true);
      namespace.setNullValid(false);
      namespace.setRequired(isNamespaceRequired());
namespace.add(new UpdateBehavior());
      add(namespace);

      Label localPartTooltip = new Label(ID_T_LOCAL_PART);
      localPartTooltip.add(new AttributeAppender("data-original-title", getString(localPartTooltipKey)));
      localPartTooltip.add(new InfoTooltipBehavior());
      localPartTooltip.setOutputMarkupPlaceholderTag(true);
      add(localPartTooltip);

      Label namespaceTooltip = new Label(ID_T_NAMESPACE);
      namespaceTooltip.add(new AttributeAppender("data-original-title", getString(namespaceTooltipKey)));
      namespaceTooltip.add(new InfoTooltipBehavior());
      namespaceTooltip.setOutputMarkupPlaceholderTag(true);
      add(namespaceTooltip);
  }
 
Example 12
Project: engerek   File: ProfilingConfigPanel.java   Source Code and License Vote up 4 votes
private void initLayout(PageSystemConfiguration parentPage) {

		WebMarkupContainer profilingEnabledNote = new WebMarkupContainer(ID_PROFILING_ENABLED_NOTE);
		profilingEnabledNote.setVisible(!parentPage.getMidpointConfiguration().isProfilingEnabled());
		add(profilingEnabledNote);

        //Entry-Exit profiling init
        DropDownChoice<ProfilingLevel> profilingLevel = new DropDownChoice<>("profilingLevel",
                new PropertyModel<ProfilingLevel>(getModel(), "profilingLevel"),
                WebComponentUtil.createReadonlyModelFromEnum(ProfilingLevel.class),
                new EnumChoiceRenderer<ProfilingLevel>(this));
        profilingLevel.add(new EmptyOnChangeAjaxFormUpdatingBehavior());
        add(profilingLevel);

        DropDownChoice<String> profilingAppender = new DropDownChoice<>("profilingAppender",
                new PropertyModel<String>(getModel(), "profilingAppender"), createAppendersListModel());
        profilingAppender.setNullValid(true);
        profilingAppender.add(new EmptyOnChangeAjaxFormUpdatingBehavior());
        add(profilingAppender);

        //Subsystem and general profiling init
        CheckBox requestFilter = WebComponentUtil.createAjaxCheckBox("requestFilter", new PropertyModel<Boolean>(getModel(), "requestFilter"));
        
        CheckBox performanceStatistics = WebComponentUtil.createAjaxCheckBox("performanceStatistics", new PropertyModel<Boolean>(getModel(), "performanceStatistics"));
        CheckBox subsystemModel = WebComponentUtil.createAjaxCheckBox("subsystemModel", new PropertyModel<Boolean>(getModel(), "subsystemModel"));
        CheckBox subsystemRepository = WebComponentUtil.createAjaxCheckBox("subsystemRepository", new PropertyModel<Boolean>(getModel(), "subsystemRepository"));
        CheckBox subsystemProvisioning = WebComponentUtil.createAjaxCheckBox("subsystemProvisioning", new PropertyModel<Boolean>(getModel(), "subsystemProvisioning"));
        //CheckBox subsystemUcf = WebComponentUtil.createAjaxCheckBox("subsystemUcf", new PropertyModel<Boolean>(getModel(), "subsystemUcf"));
        CheckBox subsystemResourceObjectChangeListener = WebComponentUtil.createAjaxCheckBox("subsystemSynchronizationService", new PropertyModel<Boolean>(getModel(), "subsystemSynchronizationService"));
        CheckBox subsystemTaskManager = WebComponentUtil.createAjaxCheckBox("subsystemTaskManager", new PropertyModel<Boolean>(getModel(), "subsystemTaskManager"));
        CheckBox subsystemWorkflow = WebComponentUtil.createAjaxCheckBox("subsystemWorkflow", new PropertyModel<Boolean>(getModel(), "subsystemWorkflow"));
        add(requestFilter);
        add(performanceStatistics);
        add(subsystemModel);
        add(subsystemRepository);
        add(subsystemProvisioning);
        //add(subsystemUcf);
        add(subsystemResourceObjectChangeListener);
        add(subsystemTaskManager);
        add(subsystemWorkflow);

        TextField<Integer> dumpInterval = WebComponentUtil.createAjaxTextField("dumpInterval", new PropertyModel<Integer>(getModel(),
                "dumpInterval"));
        add(dumpInterval);

        Label dumpIntervalTooltip = new Label(ID_DUMP_INTERVAL_TOOLTIP);
        dumpIntervalTooltip.add(new InfoTooltipBehavior());
        add(dumpIntervalTooltip);
    }
 
Example 13
Project: engerek   File: ChangePasswordPanel.java   Source Code and License Vote up 4 votes
private void initLayout(final boolean oldPasswordVisible) {
     model = (LoadableModel<MyPasswordsDto>) getModel();

     Label oldPasswordLabel = new Label(ID_OLD_PASSWORD_LABEL, createStringResource("PageSelfCredentials.oldPasswordLabel"));
     add(oldPasswordLabel);
     oldPasswordLabel.add(new VisibleEnableBehaviour() {
     	
     	private static final long serialVersionUID = 1L;

@Override
     	public boolean isVisible() {
     		return oldPasswordVisible;
     	}
     });

     Label passwordLabel = new Label(ID_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel1"));
     add(passwordLabel);

     PasswordTextField oldPasswordField =
             new PasswordTextField(ID_OLD_PASSWORD_FIELD, new PropertyModel<String>(model, MyPasswordsDto.F_OLD_PASSWORD));
     oldPasswordField.setRequired(false);
     oldPasswordField.setResetPassword(false);
     add(oldPasswordField);
     oldPasswordField.add(new VisibleEnableBehaviour() {
     	
     	private static final long serialVersionUID = 1L;
     	
     	public boolean isVisible() {
     		return oldPasswordVisible;
     	};
     });

     PasswordPanel passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new PropertyModel<ProtectedStringType>(model, MyPasswordsDto.F_PASSWORD));
     passwordPanel.getBaseFormComponent().add(new AttributeModifier("autofocus", ""));
     add(passwordPanel);

     WebMarkupContainer accountContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER);

     List<IColumn<PasswordAccountDto, String>> columns = initColumns();
     ListDataProvider<PasswordAccountDto> provider = new ListDataProvider<PasswordAccountDto>(this,
             new PropertyModel<List<PasswordAccountDto>>(model, MyPasswordsDto.F_ACCOUNTS));
     TablePanel accounts = new TablePanel(ID_ACCOUNTS_TABLE, provider, columns);
     accounts.setItemsPerPage(30);
     accounts.setShowPaging(false);
     if (model.getObject().getPropagation() != null && model.getObject().getPropagation()
             .equals(CredentialsPropagationUserControlType.MAPPING)){
         accountContainer.setVisible(false);
     }
     accountContainer.add(accounts);

     AjaxLink help = new AjaxLink(ID_BUTTON_HELP) {
     	private static final long serialVersionUID = 1L;
     	
         @Override
         public void onClick(AjaxRequestTarget target) {
             showHelpPerformed(target);
         }
     };
     accountContainer.add(help);

     add(accountContainer);
 }