Java Code Examples for org.apache.wicket.markup.html.list.ListView.setOutputMarkupId()

The following are Jave code examples for showing how to use setOutputMarkupId() of the org.apache.wicket.markup.html.list.ListView 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: engerek   File: SimpleRoleSelector.java   Source Code and License Vote up 6 votes
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 2
Project: engerek   File: DelegationEditorPanel.java   Source Code and License Vote up 6 votes
private void addPrivilegesPanel(WebMarkupContainer body){
    privilegesNames = getPrivilegesNamesList();
    ListView<String> privilegesListComponent = new ListView<String>(ID_PRIVILEGES_LIST, privilegesNames){
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<String> item) {
            Label privilageNameLabel = new Label(ID_PRIVILEGE, item.getModel());
            item.add(privilageNameLabel);
        }
    };
    privilegesListComponent.setOutputMarkupId(true);
    privilegesListComponent.add(new VisibleEnableBehaviour(){
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible(){
            if (!UserDtoStatus.ADD.equals(getModelObject().getStatus())){
                return true;
            }
           return false;
        }
    });
    body.addOrReplace(privilegesListComponent);
}
 
Example 3
Project: midpoint   File: SimpleRoleSelector.java   Source Code and License Vote up 6 votes
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 4
Project: midpoint   File: DelegationEditorPanel.java   Source Code and License Vote up 6 votes
private void addPrivilegesPanel(WebMarkupContainer body){
    privilegesNames = getPrivilegesNamesList();
    ListView<String> privilegesListComponent = new ListView<String>(ID_PRIVILEGES_LIST, privilegesNames){
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<String> item) {
            Label privilageNameLabel = new Label(ID_PRIVILEGE, item.getModel());
            item.add(privilageNameLabel);
        }
    };
    privilegesListComponent.setOutputMarkupId(true);
    privilegesListComponent.add(new VisibleEnableBehaviour(){
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible(){
            if (!UserDtoStatus.ADD.equals(getModelObject().getStatus())){
                return true;
            }
           return false;
        }
    });
    body.addOrReplace(privilegesListComponent);
}
 
Example 5
Project: syncope   File: ProgressesPanel.java   Source Code and License Vote up 6 votes
public ProgressesPanel(final String id, final Date lastUpdate, final List<ProgressBean> progressBeans) {
    super(id);

    add(new Label("lastUpdate", SyncopeConsoleSession.get().getDateFormat().format(lastUpdate)));

    ListView<ProgressBean> progresses = new ListView<ProgressBean>("progresses", progressBeans) {

        private static final long serialVersionUID = -9180479401817023838L;

        @Override
        protected void populateItem(final ListItem<ProgressBean> item) {
            item.add(new ProgressPanel("progress", item.getModelObject()));
        }
    };
    progresses.setOutputMarkupId(true);
    add(progresses);
}
 
Example 6
Project: midpoint   File: SimpleRoleSelector.java   Source Code and License Vote up 6 votes
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 7
Project: midpoint   File: DelegationEditorPanel.java   Source Code and License Vote up 6 votes
private void addPrivilegesPanel(WebMarkupContainer body){
    privilegesNames = getPrivilegesNamesList();
    ListView<String> privilegesListComponent = new ListView<String>(ID_PRIVILEGES_LIST, privilegesNames){
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<String> item) {
            Label privilageNameLabel = new Label(ID_PRIVILEGE, item.getModel());
            item.add(privilageNameLabel);
        }
    };
    privilegesListComponent.setOutputMarkupId(true);
    privilegesListComponent.add(new VisibleEnableBehaviour(){
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible(){
            if (!UserDtoStatus.ADD.equals(getModelObject().getStatus())){
                return true;
            }
           return false;
        }
    });
    body.addOrReplace(privilegesListComponent);
}
 
Example 8
Project: engerek   File: RunReportPopupPanel.java   Source Code and License Vote up 5 votes
private WebMarkupContainer createParameterPanel(final IModel<JasperReportParameterDto> parameterModel) {
  	WebMarkupContainer paramPanel = new WebMarkupContainer("paramPanel");
  	paramPanel.setOutputMarkupId(true);
  	String paramValue = new PropertyModel<String>(parameterModel, "name").getObject();
      StringResourceModel paramDisplay = PageBase.createStringResourceStatic(RunReportPopupPanel.this, "runReportPopupContent.param.name." + paramValue, new Object[]{});

      paramPanel.add(new Label("name", paramDisplay)); // use display name rather than property name

      String paramClass = new PropertyModel<String>(parameterModel, "nestedTypeAsString").getObject();
      if (StringUtils.isBlank(paramClass)) {
      	paramClass = new PropertyModel<String>(parameterModel, "typeAsString").getObject();
      }
      paramClass = paramClass == null ? "" : paramClass.substring(paramClass.lastIndexOf(".") + 1);
      paramPanel.add(new Label("type", paramClass));
      
      ListView<JasperReportValueDto> listView = new ListView<JasperReportValueDto>(ID_VALUE_LIST, new PropertyModel<>(parameterModel, "value")) {

  		private static final long serialVersionUID = 1L;

	@Override
  		protected void populateItem(ListItem<JasperReportValueDto> item) {
  			item.add(createInputMarkup(item.getModel(), parameterModel.getObject()));
  			
  		}

  	};
  	listView.setOutputMarkupId(true);
      
      paramPanel.add(listView);
return paramPanel;
  }
 
Example 9
Project: engerek   File: OperationResultPanel.java   Source Code and License Vote up 5 votes
private void initContexts(WebMarkupContainer operationContent, final IModel<OpResult> model, Page parentPage) {

		Label contextsLabel = new Label("contextsLabel", parentPage.getString("FeedbackAlertMessageDetails.contexts"));
		contextsLabel.setOutputMarkupId(true);
		contextsLabel.add(new VisibleEnableBehaviour() {
			private static final long serialVersionUID = 1L;

			@Override
			public boolean isVisible() {
				return CollectionUtils.isNotEmpty(model.getObject().getContexts());
			}
		});

		operationContent.add(contextsLabel);

		ListView<Context> contexts = new ListView<Context>("contexts", createContextsModel(model)) {
			private static final long serialVersionUID = 1L;
			
			@Override
			protected void populateItem(ListItem<Context> item) {
				item.add(new Label("contextName", new PropertyModel<Object>(item.getModel(), "name")));
				item.add(new Label("contextValue", new PropertyModel<Object>(item.getModel(), "value")));
			}
		};
		contexts.setOutputMarkupId(true);
		contexts.add(new VisibleEnableBehaviour() {
			private static final long serialVersionUID = 1L;

			@Override
			public boolean isVisible() {
				return CollectionUtils.isNotEmpty(model.getObject().getContexts());
			}
		});
		operationContent.add(contexts);
	}
 
Example 10
Project: midpoint   File: RunReportPopupPanel.java   Source Code and License Vote up 5 votes
private WebMarkupContainer createParameterPanel(final IModel<JasperReportParameterDto> parameterModel) {
  	WebMarkupContainer paramPanel = new WebMarkupContainer("paramPanel");
  	paramPanel.setOutputMarkupId(true);
  	String paramValue = new PropertyModel<String>(parameterModel, "name").getObject();
      StringResourceModel paramDisplay = PageBase.createStringResourceStatic(RunReportPopupPanel.this, "runReportPopupContent.param.name." + paramValue, new Object[]{});

      paramPanel.add(new Label("name", paramDisplay)); // use display name rather than property name

      String paramClass = new PropertyModel<String>(parameterModel, "nestedTypeAsString").getObject();
      if (StringUtils.isBlank(paramClass)) {
      	paramClass = new PropertyModel<String>(parameterModel, "typeAsString").getObject();
      }
      paramClass = paramClass == null ? "" : paramClass.substring(paramClass.lastIndexOf(".") + 1);
      paramPanel.add(new Label("type", paramClass));

      ListView<JasperReportValueDto> listView = new ListView<JasperReportValueDto>(ID_VALUE_LIST, new PropertyModel<>(parameterModel, "value")) {

  		private static final long serialVersionUID = 1L;

	@Override
  		protected void populateItem(ListItem<JasperReportValueDto> item) {
  			item.add(createInputMarkup(item.getModel(), parameterModel.getObject()));

  		}

  	};
  	listView.setOutputMarkupId(true);

      paramPanel.add(listView);
return paramPanel;
  }
 
Example 11
Project: midpoint   File: OperationResultPanel.java   Source Code and License Vote up 5 votes
private void initContexts(WebMarkupContainer operationContent, final IModel<OpResult> model, Page parentPage) {

		Label contextsLabel = new Label("contextsLabel", parentPage.getString("FeedbackAlertMessageDetails.contexts"));
		contextsLabel.setOutputMarkupId(true);
		contextsLabel.add(new VisibleEnableBehaviour() {
			private static final long serialVersionUID = 1L;

			@Override
			public boolean isVisible() {
				return CollectionUtils.isNotEmpty(model.getObject().getContexts());
			}
		});

		operationContent.add(contextsLabel);

		ListView<Context> contexts = new ListView<Context>("contexts", createContextsModel(model)) {
			private static final long serialVersionUID = 1L;

			@Override
			protected void populateItem(ListItem<Context> item) {
				item.add(new Label("contextName", new PropertyModel<Object>(item.getModel(), "name")));
				item.add(new Label("contextValue", new PropertyModel<Object>(item.getModel(), "value")));
			}
		};
		contexts.setOutputMarkupId(true);
		contexts.add(new VisibleEnableBehaviour() {
			private static final long serialVersionUID = 1L;

			@Override
			public boolean isVisible() {
				return CollectionUtils.isNotEmpty(model.getObject().getContexts());
			}
		});
		operationContent.add(contexts);
	}
 
Example 12
Project: edemocracia   File: MoveTopicosWizard.java   Source Code and License Vote up 5 votes
public TopicoStep(IDynamicWizardStep previous) {
	super(previous,"Escolha o Tópico","CLique no tópico a mover");
	setComplete(false);
	

	ListView<Topico> topicos = new ListView<Topico>("topicos",
			new ModeloListaTopicosDeForum(info.getIdComunidadeOrigem(), info.getIdForumOrigem())) {

		private static final long serialVersionUID = -5113198906301138306L;

		@Override
		protected void populateItem(final ListItem<Topico> item) {
			Link<Void> linkTopico = new AjaxFallbackLink<Void>(
					"link_topico") {

				private static final long serialVersionUID = 2729459814700718807L;

				@Override
				public void onClick(AjaxRequestTarget target) {
					info.setIdTopico(item.getModelObject().getId());
					info.setNomeTopico(item.getModelObject().getAssunto());
					setComplete(true);

				}
			};
			
			Label nomeTopico = new Label("nome_topico", item.getModelObject().toString());
			linkTopico.setOutputMarkupId(true);
			linkTopico.add(nomeTopico);
			item.add(linkTopico);

		}
	};
	topicos.setOutputMarkupId(true);
	add(topicos);

}
 
Example 13
Project: edemocracia   File: MoveTopicosWizard.java   Source Code and License Vote up 5 votes
public ComunidadeDestinoStep(IDynamicWizardStep previousStep) {
	super(previousStep,"Escolha a Comunidade de Destino","Clique na comunidade para onde o tópico será movido");
	
	ListView<Group> comunidades = new ListView<Group>("comunidades",
			new ModeloListaComunidadesDestino(info.getIdUsuario(),info.getIdComunidadeOrigem())) {

		private static final long serialVersionUID = -5113198906301138306L;

		@Override
		protected void populateItem(final ListItem<Group> item) {
			Link<Void> linkComunidade = new AjaxFallbackLink<Void>(
					"link_comunidade") {

				private static final long serialVersionUID = 2729459814700718807L;

				@Override
				public void onClick(AjaxRequestTarget target) {
					Group comunidade = item.getModelObject();
					info.setIdComunidadeDestino(comunidade.getGroupId());
					info.setUrlComunidadeDestino(comunidade.getFriendlyURL());
					info.setNomeComunidadeDestino(comunidade.getName());
					setComplete(true);
				}
			};
			
			Label nomeComunidade = new Label("nome_comunidade", item.getModelObject().getName());
			linkComunidade.setOutputMarkupId(true);
			linkComunidade.add(nomeComunidade);
			item.add(linkComunidade);

		}
	};
	comunidades.setOutputMarkupId(true);
	add(comunidades);

	
}
 
Example 14
Project: midpoint   File: RunReportPopupPanel.java   Source Code and License Vote up 5 votes
private WebMarkupContainer createParameterPanel(final IModel<JasperReportParameterDto> parameterModel) {
  	WebMarkupContainer paramPanel = new WebMarkupContainer("paramPanel");
  	paramPanel.setOutputMarkupId(true);
  	String paramValue = new PropertyModel<String>(parameterModel, "name").getObject();
      StringResourceModel paramDisplay = PageBase.createStringResourceStatic(RunReportPopupPanel.this, "runReportPopupContent.param.name." + paramValue, new Object[]{});

      paramPanel.add(new Label("name", paramDisplay)); // use display name rather than property name

      String paramClass = new PropertyModel<String>(parameterModel, "nestedTypeAsString").getObject();
      if (StringUtils.isBlank(paramClass)) {
      	paramClass = new PropertyModel<String>(parameterModel, "typeAsString").getObject();
      }
      paramClass = paramClass == null ? "" : paramClass.substring(paramClass.lastIndexOf(".") + 1);
      paramPanel.add(new Label("type", paramClass));

      ListView<JasperReportValueDto> listView = new ListView<JasperReportValueDto>(ID_VALUE_LIST, new PropertyModel<>(parameterModel, "value")) {

  		private static final long serialVersionUID = 1L;

	@Override
  		protected void populateItem(ListItem<JasperReportValueDto> item) {
  			item.add(createInputMarkup(item.getModel(), parameterModel.getObject()));

  		}

  	};
  	listView.setOutputMarkupId(true);

      paramPanel.add(listView);
return paramPanel;
  }
 
Example 15
Project: midpoint   File: OperationResultPanel.java   Source Code and License Vote up 5 votes
private void initContexts(WebMarkupContainer operationContent, final IModel<OpResult> model, Page parentPage) {

		Label contextsLabel = new Label("contextsLabel", parentPage.getString("FeedbackAlertMessageDetails.contexts"));
		contextsLabel.setOutputMarkupId(true);
		contextsLabel.add(new VisibleEnableBehaviour() {
			private static final long serialVersionUID = 1L;

			@Override
			public boolean isVisible() {
				return CollectionUtils.isNotEmpty(model.getObject().getContexts());
			}
		});

		operationContent.add(contextsLabel);

		ListView<Context> contexts = new ListView<Context>("contexts", createContextsModel(model)) {
			private static final long serialVersionUID = 1L;

			@Override
			protected void populateItem(ListItem<Context> item) {
				item.add(new Label("contextName", new PropertyModel<Object>(item.getModel(), "name")));
				item.add(new Label("contextValue", new PropertyModel<Object>(item.getModel(), "value")));
			}
		};
		contexts.setOutputMarkupId(true);
		contexts.add(new VisibleEnableBehaviour() {
			private static final long serialVersionUID = 1L;

			@Override
			public boolean isVisible() {
				return CollectionUtils.isNotEmpty(model.getObject().getContexts());
			}
		});
		operationContent.add(contexts);
	}
 
Example 16
Project: engerek   File: MultiValueDropDownPanel.java   Source Code and License Vote up 4 votes
private void initLayout(final boolean nullValid, final NonEmptyModel<Boolean> readOnlyModel) {
      WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return getModel().getObject().isEmpty();
          }
      });
      add(placeholderContainer);

      AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {

          @Override
          public void onClick(AjaxRequestTarget target) {
              addValuePerformed(target);
          }
      };
      placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

          @Override
          public String getObject() {
              if (buttonsDisabled()) {
                  return " " + CSS_DISABLED;
              }

              return "";
          }
      }));
      placeholderAdd.setOutputMarkupId(true);
      placeholderAdd.setOutputMarkupPlaceholderTag(true);
placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
      placeholderContainer.add(placeholderAdd);

      ListView repeater = new ListView<T>(ID_REPEATER, getModel()){

          @Override
          protected void populateItem(final ListItem<T> item) {

              DropDownChoice choice = new DropDownChoice<>(ID_INPUT, createDropDownItemModel(item.getModel()),
                      createChoiceList(), createRenderer());
              choice.setNullValid(nullValid);
		choice.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
              item.add(choice);

              WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
              item.add(buttonGroup);
              initButtons(buttonGroup, item, readOnlyModel);
          }
      };
      repeater.setOutputMarkupId(true);
      repeater.setOutputMarkupPlaceholderTag(true);
      repeater.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return !getModel().getObject().isEmpty();
          }
      });
      add(repeater);
  }
 
Example 17
Project: engerek   File: MultiValueTextEditPanel.java   Source Code and License Vote up 4 votes
private void initLayout(final boolean inputEnabled, final boolean showPlaceholder, final NonEmptyModel<Boolean> readOnlyModel) {
      WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return showPlaceholder && (getModel().getObject() == null || getModel().getObject().isEmpty());
          }
      });
      add(placeholderContainer);

      AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {

          @Override
          public void onClick(AjaxRequestTarget target) {
              addValuePerformed(target);
          }
      };
      placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

          @Override
          public String getObject() {
              if (buttonsDisabled()) {
                  return " " + CSS_DISABLED;
              }

              return "";
          }
      }));
placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
      placeholderAdd.setOutputMarkupId(true);
      placeholderAdd.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.add(placeholderAdd);

      ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {

          @Override
          protected void populateItem(final ListItem<T> item) {
              TextField text = new TextField<>(ID_TEXT, createTextModel(item.getModel()));
              text.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
              text.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder()));
		if (selectedModel != null && item.getModelObject() == selectedModel.getObject()) {
			text.add(AttributeAppender.append("style", "background-color: #FFFFD0;"));			// TODO color constant
		}

		if (!inputEnabled) {
			text.add(new AttributeModifier("disabled", "disabled"));
		}
		item.add(text);

              WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
              item.add(buttonGroup);
              initButtons(buttonGroup, item, readOnlyModel);
          }
      };
      repeater.setOutputMarkupId(true);
      repeater.setOutputMarkupPlaceholderTag(true);
      repeater.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return getModel().getObject() != null && !getModel().getObject().isEmpty();
          }
      });
      add(repeater);
  }
 
Example 18
Project: engerek   File: LimitationsEditorDialog.java   Source Code and License Vote up 4 votes
public void initLayout(WebMarkupContainer content) {
    Form form = new Form(ID_MAIN_FORM);
    form.setOutputMarkupId(true);
    content.add(form);

    ListView repeater = new ListView<PropertyLimitationsTypeDto>(ID_REPEATER, model){

        @Override
        protected void populateItem(final ListItem<PropertyLimitationsTypeDto> item){
            WebMarkupContainer linkContainer = new WebMarkupContainer(ID_LIMITATIONS_LINK);
            linkContainer.setOutputMarkupId(true);
            linkContainer.add(new AttributeModifier("href", createCollapseItemId(item, true)));
            item.add(linkContainer);

            Label linkLabel = new Label(ID_LIMITATIONS_LABEL, createLimitationsLabelModel(item));
            linkContainer.add(linkLabel);

            AjaxLink delete = new AjaxLink(ID_LIMITATION_DELETE) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    deleteLimitationPerformed(target, item);
                }
            };
delete.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
linkContainer.add(delete);

            WebMarkupContainer limitationBody = new WebMarkupContainer(ID_BODY);
            limitationBody.setOutputMarkupId(true);
            limitationBody.setMarkupId(createCollapseItemId(item, false).getObject());
            if (changeState != ChangeState.SKIP) {
                limitationBody.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

                    @Override
                    public String getObject() {
                        if (changeState == ChangeState.FIRST && item.getIndex() == 0) {
                            return "panel-collapse collapse in";
                        } else if (changeState == ChangeState.LAST && item.getIndex() == (getModelObject().size()-1)) {
                            return "panel-collapse collapse in";
                        } else {
                            return "panel-collapse collapse";
                        }
                    }
                }));
            }
limitationBody.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
            item.add(limitationBody);
            initLimitationBody(limitationBody, item);

        }
    };
    repeater.setOutputMarkupId(true);
    form.add(repeater);

    initButtons(form);
}
 
Example 19
Project: sakai   File: BaseTreePage.java   Source Code and License Vote up 4 votes
private void createInheritedSpan(){
	WebMarkupContainer inheritedSpan = new WebMarkupContainer("inheritedSpan");
	inheritedSpan.setOutputMarkupId(true);
	final String inheritedSpanId = inheritedSpan.getMarkupId();
	add(inheritedSpan);
	
	AbstractReadOnlyModel<List<? extends ListOptionSerialized>> inheritedRestrictedToolsModel = new AbstractReadOnlyModel<List<? extends ListOptionSerialized>>(){
		private static final long serialVersionUID = 1L;

		@Override
		public List<? extends ListOptionSerialized> getObject() {
			return new ArrayList<ListOptionSerialized>();
		}

	};
	
	final ListView<ListOptionSerialized> inheritedListView = new ListView<ListOptionSerialized>("inheritedRestrictedTools",inheritedRestrictedToolsModel){
		private static final long serialVersionUID = 1L;
		@Override
		protected void populateItem(ListItem<ListOptionSerialized> item) {
			ListOptionSerialized tool = (ListOptionSerialized) item.getModelObject();
			Label name = new Label("name", tool.getName());
			item.add(name);
		}
	};
	inheritedListView.setOutputMarkupId(true);
	inheritedSpan.add(inheritedListView);
	
	
	AjaxLink<Void> closeInheritedSpanLink = new AjaxLink("closeInheritedSpanLink"){
		@Override
		public void onClick(AjaxRequestTarget arg0) {
		}
	};
	inheritedSpan.add(closeInheritedSpanLink);

	Label inheritedNodeTitle = new Label("inheritedNodeTitle", "");
	inheritedSpan.add(inheritedNodeTitle);
	
	
	
	Label noInheritedToolsLabel = new Label("noToolsInherited", new StringResourceModel("inheritedNothing", null));
	inheritedSpan.add(noInheritedToolsLabel);

}
 
Example 20
Project: midpoint   File: MultiValueDropDownPanel.java   Source Code and License Vote up 4 votes
private void initLayout(final boolean nullValid, final NonEmptyModel<Boolean> readOnlyModel) {
      WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return getModel().getObject().isEmpty();
          }
      });
      add(placeholderContainer);

      AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {

          @Override
          public void onClick(AjaxRequestTarget target) {
              addValuePerformed(target);
          }
      };
      placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

          @Override
          public String getObject() {
              if (buttonsDisabled()) {
                  return " " + CSS_DISABLED;
              }

              return "";
          }
      }));
      placeholderAdd.setOutputMarkupId(true);
      placeholderAdd.setOutputMarkupPlaceholderTag(true);
placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
      placeholderContainer.add(placeholderAdd);

      ListView repeater = new ListView<T>(ID_REPEATER, getModel()){

          @Override
          protected void populateItem(final ListItem<T> item) {

              DropDownChoice choice = new DropDownChoice<>(ID_INPUT, createDropDownItemModel(item.getModel()),
                      createChoiceList(), createRenderer());
              choice.setNullValid(nullValid);
		choice.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
              item.add(choice);

              WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
              item.add(buttonGroup);
              initButtons(buttonGroup, item, readOnlyModel);
          }
      };
      repeater.setOutputMarkupId(true);
      repeater.setOutputMarkupPlaceholderTag(true);
      repeater.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return !getModel().getObject().isEmpty();
          }
      });
      add(repeater);
  }
 
Example 21
Project: midpoint   File: MultiValueTextEditPanel.java   Source Code and License Vote up 4 votes
private void initLayout(final boolean inputEnabled, final boolean showPlaceholder, final NonEmptyModel<Boolean> readOnlyModel) {
      WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return showPlaceholder && (getModel().getObject() == null || getModel().getObject().isEmpty());
          }
      });
      add(placeholderContainer);

      AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {

          @Override
          public void onClick(AjaxRequestTarget target) {
              addValuePerformed(target);
          }
      };
      placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

          @Override
          public String getObject() {
              if (buttonsDisabled()) {
                  return " " + CSS_DISABLED;
              }

              return "";
          }
      }));
placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
      placeholderAdd.setOutputMarkupId(true);
      placeholderAdd.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.add(placeholderAdd);

      ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {

          @Override
          protected void populateItem(final ListItem<T> item) {
              TextField text = new TextField<>(ID_TEXT, createTextModel(item.getModel()));
              text.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
              text.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder()));
		if (selectedModel != null && item.getModelObject() == selectedModel.getObject()) {
			text.add(AttributeAppender.append("style", "background-color: #FFFFD0;"));			// TODO color constant
		}

		if (!inputEnabled) {
			text.add(new AttributeModifier("disabled", "disabled"));
		}
		item.add(text);

              WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
              item.add(buttonGroup);
              initButtons(buttonGroup, item, readOnlyModel);
          }
      };
      repeater.setOutputMarkupId(true);
      repeater.setOutputMarkupPlaceholderTag(true);
      repeater.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return getModel().getObject() != null && !getModel().getObject().isEmpty();
          }
      });
      add(repeater);
  }
 
Example 22
Project: midpoint   File: LimitationsEditorDialog.java   Source Code and License Vote up 4 votes
public void initLayout(WebMarkupContainer content) {
    Form form = new com.evolveum.midpoint.web.component.form.Form(ID_MAIN_FORM);
    form.setOutputMarkupId(true);
    content.add(form);

    ListView repeater = new ListView<PropertyLimitationsTypeDto>(ID_REPEATER, model){

        @Override
        protected void populateItem(final ListItem<PropertyLimitationsTypeDto> item){
            WebMarkupContainer linkContainer = new WebMarkupContainer(ID_LIMITATIONS_LINK);
            linkContainer.setOutputMarkupId(true);
            linkContainer.add(new AttributeModifier("href", createCollapseItemId(item, true)));
            item.add(linkContainer);

            Label linkLabel = new Label(ID_LIMITATIONS_LABEL, createLimitationsLabelModel(item));
            linkContainer.add(linkLabel);

            AjaxLink delete = new AjaxLink(ID_LIMITATION_DELETE) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    deleteLimitationPerformed(target, item);
                }
            };
delete.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
linkContainer.add(delete);

            WebMarkupContainer limitationBody = new WebMarkupContainer(ID_BODY);
            limitationBody.setOutputMarkupId(true);
            limitationBody.setMarkupId(createCollapseItemId(item, false).getObject());
            if (changeState != ChangeState.SKIP) {
                limitationBody.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

                    @Override
                    public String getObject() {
                        if (changeState == ChangeState.FIRST && item.getIndex() == 0) {
                            return "panel-collapse collapse in";
                        } else if (changeState == ChangeState.LAST && item.getIndex() == (getModelObject().size()-1)) {
                            return "panel-collapse collapse in";
                        } else {
                            return "panel-collapse collapse";
                        }
                    }
                }));
            }
limitationBody.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
            item.add(limitationBody);
            initLimitationBody(limitationBody, item);

        }
    };
    repeater.setOutputMarkupId(true);
    form.add(repeater);

    initButtons(form);
}
 
Example 23
Project: sakai   File: BaseTreePage.java   Source Code and License Vote up 4 votes
private void createInheritedSpan(){
	WebMarkupContainer inheritedSpan = new WebMarkupContainer("inheritedSpan");
	inheritedSpan.setOutputMarkupId(true);
	final String inheritedSpanId = inheritedSpan.getMarkupId();
	add(inheritedSpan);
	
	AbstractReadOnlyModel<List<? extends ListOptionSerialized>> inheritedRestrictedToolsModel = new AbstractReadOnlyModel<List<? extends ListOptionSerialized>>(){
		private static final long serialVersionUID = 1L;

		@Override
		public List<? extends ListOptionSerialized> getObject() {
			return new ArrayList<ListOptionSerialized>();
		}

	};
	
	final ListView<ListOptionSerialized> inheritedListView = new ListView<ListOptionSerialized>("inheritedRestrictedTools",inheritedRestrictedToolsModel){
		private static final long serialVersionUID = 1L;
		@Override
		protected void populateItem(ListItem<ListOptionSerialized> item) {
			ListOptionSerialized tool = (ListOptionSerialized) item.getModelObject();
			Label name = new Label("name", tool.getName());
			item.add(name);
		}
	};
	inheritedListView.setOutputMarkupId(true);
	inheritedSpan.add(inheritedListView);
	
	
	AjaxLink<Void> closeInheritedSpanLink = new AjaxLink("closeInheritedSpanLink"){
		@Override
		public void onClick(AjaxRequestTarget arg0) {
		}
	};
	inheritedSpan.add(closeInheritedSpanLink);

	Label inheritedNodeTitle = new Label("inheritedNodeTitle", "");
	inheritedSpan.add(inheritedNodeTitle);
	
	
	
	Label noInheritedToolsLabel = new Label("noToolsInherited", new StringResourceModel("inheritedNothing", null));
	inheritedSpan.add(noInheritedToolsLabel);

}
 
Example 24
Project: midpoint   File: MultiValueDropDownPanel.java   Source Code and License Vote up 4 votes
private void initLayout(final boolean nullValid, final NonEmptyModel<Boolean> readOnlyModel) {
      WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return getModel().getObject().isEmpty();
          }
      });
      add(placeholderContainer);

      AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {

          @Override
          public void onClick(AjaxRequestTarget target) {
              addValuePerformed(target);
          }
      };
      placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

          @Override
          public String getObject() {
              if (buttonsDisabled()) {
                  return " " + CSS_DISABLED;
              }

              return "";
          }
      }));
      placeholderAdd.setOutputMarkupId(true);
      placeholderAdd.setOutputMarkupPlaceholderTag(true);
placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
      placeholderContainer.add(placeholderAdd);

      ListView repeater = new ListView<T>(ID_REPEATER, getModel()){

          @Override
          protected void populateItem(final ListItem<T> item) {

              DropDownChoice choice = new DropDownChoice<>(ID_INPUT, createDropDownItemModel(item.getModel()),
                      createChoiceList(), createRenderer());
              choice.setNullValid(nullValid);
		choice.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
              item.add(choice);

              WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
              item.add(buttonGroup);
              initButtons(buttonGroup, item, readOnlyModel);
          }
      };
      repeater.setOutputMarkupId(true);
      repeater.setOutputMarkupPlaceholderTag(true);
      repeater.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return !getModel().getObject().isEmpty();
          }
      });
      add(repeater);
  }
 
Example 25
Project: midpoint   File: MultiValueTextEditPanel.java   Source Code and License Vote up 4 votes
private void initLayout(final boolean inputEnabled, final boolean showPlaceholder, final NonEmptyModel<Boolean> readOnlyModel) {
      WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return showPlaceholder && (getModel().getObject() == null || getModel().getObject().isEmpty());
          }
      });
      add(placeholderContainer);

      AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {

          @Override
          public void onClick(AjaxRequestTarget target) {
              addValuePerformed(target);
          }
      };
      placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

          @Override
          public String getObject() {
              if (buttonsDisabled()) {
                  return " " + CSS_DISABLED;
              }

              return "";
          }
      }));
placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
      placeholderAdd.setOutputMarkupId(true);
      placeholderAdd.setOutputMarkupPlaceholderTag(true);
      placeholderContainer.add(placeholderAdd);

      ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {

          @Override
          protected void populateItem(final ListItem<T> item) {
              TextField text = new TextField<>(ID_TEXT, createTextModel(item.getModel()));
              text.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
              text.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder()));
		if (selectedModel != null && item.getModelObject() == selectedModel.getObject()) {
			text.add(AttributeAppender.append("style", "background-color: #FFFFD0;"));			// TODO color constant
		}

		if (!inputEnabled) {
			text.add(new AttributeModifier("disabled", "disabled"));
		}
		item.add(text);

              WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
              item.add(buttonGroup);
              initButtons(buttonGroup, item, readOnlyModel);
          }
      };
      repeater.setOutputMarkupId(true);
      repeater.setOutputMarkupPlaceholderTag(true);
      repeater.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return getModel().getObject() != null && !getModel().getObject().isEmpty();
          }
      });
      add(repeater);
  }
 
Example 26
Project: midpoint   File: LimitationsEditorDialog.java   Source Code and License Vote up 4 votes
public void initLayout(WebMarkupContainer content) {
    Form form = new com.evolveum.midpoint.web.component.form.Form(ID_MAIN_FORM);
    form.setOutputMarkupId(true);
    content.add(form);

    ListView repeater = new ListView<PropertyLimitationsTypeDto>(ID_REPEATER, model){

        @Override
        protected void populateItem(final ListItem<PropertyLimitationsTypeDto> item){
            WebMarkupContainer linkContainer = new WebMarkupContainer(ID_LIMITATIONS_LINK);
            linkContainer.setOutputMarkupId(true);
            linkContainer.add(new AttributeModifier("href", createCollapseItemId(item, true)));
            item.add(linkContainer);

            Label linkLabel = new Label(ID_LIMITATIONS_LABEL, createLimitationsLabelModel(item));
            linkContainer.add(linkLabel);

            AjaxLink delete = new AjaxLink(ID_LIMITATION_DELETE) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    deleteLimitationPerformed(target, item);
                }
            };
delete.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
linkContainer.add(delete);

            WebMarkupContainer limitationBody = new WebMarkupContainer(ID_BODY);
            limitationBody.setOutputMarkupId(true);
            limitationBody.setMarkupId(createCollapseItemId(item, false).getObject());
            if (changeState != ChangeState.SKIP) {
                limitationBody.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

                    @Override
                    public String getObject() {
                        if (changeState == ChangeState.FIRST && item.getIndex() == 0) {
                            return "panel-collapse collapse in";
                        } else if (changeState == ChangeState.LAST && item.getIndex() == (getModelObject().size()-1)) {
                            return "panel-collapse collapse in";
                        } else {
                            return "panel-collapse collapse";
                        }
                    }
                }));
            }
limitationBody.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
            item.add(limitationBody);
            initLimitationBody(limitationBody, item);

        }
    };
    repeater.setOutputMarkupId(true);
    form.add(repeater);

    initButtons(form);
}