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

The following are Jave code examples for showing how to use setReuseItems() 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: PrismObjectPanel.java   Source Code and License Vote up 6 votes
private void addOrReplaceContainers(IModel<ObjectWrapper<O>> model, final Form form, boolean isToBeReplaced){
    ListView<ContainerWrapper> containers = new ListView<ContainerWrapper>(ID_CONTAINERS,
            createContainerModel(model)) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<ContainerWrapper> item) {
            PrismContainerPanel containerPanel = createContainerPanel(item, form);
            createMetadataPanel(model, item, containerPanel);
        }
    };
    containers.setReuseItems(true);

    if (isToBeReplaced) {
        replace(containers);
    } else {
        add(containers);
    }
}
 
Example 2
Project: engerek   File: PrismContainerPanel.java   Source Code and License Vote up 6 votes
private void addOrReplaceProperties(IModel<ContainerWrapper> model, final Form form, boolean isToBeReplaced){
     ListView<ItemWrapper> properties = new ListView<ItemWrapper>("properties",
             new PropertyModel(model, "properties")) {
private static final long serialVersionUID = 1L;

@Override
         protected void populateItem(final ListItem<ItemWrapper> item) {
             item.add(new PrismPropertyPanel("property", item.getModel(), form, pageBase));
             item.add(new VisibleEnableBehaviour() {
             	private static final long serialVersionUID = 1L;
             	
             	@Override
             	public boolean isVisible() {
             		return item.getModel().getObject().isVisible();
             	}
             });
             item.add(AttributeModifier.append("class", createStyleClassModel(item.getModel())));
         }
     };
     properties.setReuseItems(true);
     if (isToBeReplaced) {
         replace(properties);
     } else {
         add(properties);
     }
 }
 
Example 3
Project: midpoint   File: PrismPanel.java   Source Code and License Vote up 6 votes
private void addOrReplaceContainers(final Form form, ItemVisibilityHandler isPanelVisible, boolean isToBeReplaced){
    ListView<ContainerWrapper<C>> containers = new ListView<ContainerWrapper<C>>(ID_CONTAINERS,
            getModel()) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<ContainerWrapper<C>> item) {
            createContainerPanel(item, isPanelVisible, form);
        }
    };
    containers.setReuseItems(true);

    if (isToBeReplaced) {
        replace(containers);
    } else {
        add(containers);
    }
}
 
Example 4
Project: midpoint   File: PrismPanel.java   Source Code and License Vote up 6 votes
private void addOrReplaceContainers(final Form form, ItemVisibilityHandler isPanelVisible, boolean isToBeReplaced){
    ListView<ContainerWrapper<C>> containers = new ListView<ContainerWrapper<C>>(ID_CONTAINERS,
            getModel()) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<ContainerWrapper<C>> item) {
            createContainerPanel(item, isPanelVisible, form);
        }
    };
    containers.setReuseItems(true);

    if (isToBeReplaced) {
        replace(containers);
    } else {
        add(containers);
    }
}
 
Example 5
Project: oodt   File: TypeBrowser.java   Source Code and License Vote up 6 votes
/**
 * @param id
 *          The wicket:id identifier of the criteria form.
 */
public ExistingCriteriaForm(String id) {
  super(id);
  ListView<TermQueryCriteria> criteriaView = new ListView<TermQueryCriteria>(
      "criteria_selected_row", criteria) {

    @Override
    protected void populateItem(ListItem<TermQueryCriteria> item) {
      item.add(new Label("criteria_elem_name", item.getModelObject()
          .getElementName()));
      item.add(new Label("criteria_elem_value", item.getModelObject()
          .getValue()));
      item.add(new TermQueryCriteriaRemoveButton("criteria_elem_remove",
          item.getModelObject()));
    }
  };
  criteriaView.setReuseItems(true);
  add(criteriaView);
}
 
Example 6
Project: engerek   File: SceneItemPanel.java   Source Code and License Vote up 5 votes
private void initLayout(final IModel<SceneItemDto> model) {
ListView<SceneItemLineDto> items = new ListView<SceneItemLineDto>(ID_ITEM_LINES,
              new PropertyModel<List<SceneItemLineDto>>(model, SceneItemDto.F_LINES)) {

	@Override
	protected void populateItem(ListItem<SceneItemLineDto> item) {
		SceneItemLinePanel panel = new SceneItemLinePanel(ID_ITEM_LINE, item.getModel());
		item.add(panel);
	}
};
      items.setReuseItems(true);
      add(items);
  }
 
Example 7
Project: midpoint   File: ContainerValuePanel.java   Source Code and License Vote up 5 votes
private <IW extends ItemWrapper> void addOrReplaceProperties(IModel<ContainerValueWrapper<C>> model, final Form form, ItemVisibilityHandler isPanaleVisible, boolean isToBeReplaced){
     ListView<IW> properties = new ListView<IW>("properties",
             new PropertyModel<List<IW>>(model, "properties")) {
private static final long serialVersionUID = 1L;

@Override
         protected void populateItem(final ListItem<IW> item) {
	
	if (item.getModel().getObject() instanceof ContainerWrapper) {
		PrismContainerPanel<C> containerPanel = new PrismContainerPanel("property", (IModel<ContainerWrapper<C>>) item.getModel(), true, form, isPanaleVisible, pageBase);
		containerPanel.setOutputMarkupId(true);
		item.add(new VisibleEnableBehaviour(){
                     private static final long serialVersionUID = 1L;

                     public boolean isVisible(){
                         return containerPanel.isVisible();
                     }
                 });
		item.add(containerPanel);
		return;
	}
	
	PrismPropertyPanel propertyPanel = new PrismPropertyPanel("property", item.getModel(), form, isPanaleVisible, pageBase);
	propertyPanel.setOutputMarkupId(true);
             item.add(propertyPanel);
             item.add(AttributeModifier.append("class", createStyleClassModel((IModel<ItemWrapper>) item.getModel())));
            
         }
     };
     properties.setReuseItems(true);
     if (isToBeReplaced) {
         replace(properties);
     } else {
         add(properties);
     }
 }
 
Example 8
Project: midpoint   File: SceneItemPanel.java   Source Code and License Vote up 5 votes
private void initLayout(final IModel<SceneItemDto> model) {
ListView<SceneItemLineDto> items = new ListView<SceneItemLineDto>(ID_ITEM_LINES,
              new PropertyModel<List<SceneItemLineDto>>(model, SceneItemDto.F_LINES)) {

	@Override
	protected void populateItem(ListItem<SceneItemLineDto> item) {
		SceneItemLinePanel panel = new SceneItemLinePanel(ID_ITEM_LINE, item.getModel());
		item.add(panel);
	}
};
      items.setReuseItems(true);
      add(items);
  }
 
Example 9
Project: midpoint   File: ContainerValuePanel.java   Source Code and License Vote up 5 votes
private <IW extends ItemWrapper> void addOrReplaceProperties(IModel<ContainerValueWrapper<C>> model, final Form form, ItemVisibilityHandler isPanaleVisible, boolean isToBeReplaced){
     ListView<IW> properties = new ListView<IW>("properties",
             new PropertyModel<List<IW>>(model, "properties")) {
private static final long serialVersionUID = 1L;

@Override
         protected void populateItem(final ListItem<IW> item) {
	
	if (item.getModel().getObject() instanceof ContainerWrapper) {
		PrismContainerPanel<C> containerPanel = new PrismContainerPanel("property", (IModel<ContainerWrapper<C>>) item.getModel(), true, form, isPanaleVisible, pageBase);
		containerPanel.setOutputMarkupId(true);
		item.add(new VisibleEnableBehaviour(){
                     private static final long serialVersionUID = 1L;

                     public boolean isVisible(){
                         return containerPanel.isVisible();
                     }
                 });
		item.add(containerPanel);
		return;
	}
	
	PrismPropertyPanel propertyPanel = new PrismPropertyPanel("property", item.getModel(), form, isPanaleVisible, pageBase);
	propertyPanel.setOutputMarkupId(true);
             item.add(propertyPanel);
             item.add(AttributeModifier.append("class", createStyleClassModel((IModel<ItemWrapper>) item.getModel())));
            
         }
     };
     properties.setReuseItems(true);
     if (isToBeReplaced) {
         replace(properties);
     } else {
         add(properties);
     }
 }
 
Example 10
Project: midpoint   File: SceneItemPanel.java   Source Code and License Vote up 5 votes
private void initLayout(final IModel<SceneItemDto> model) {
ListView<SceneItemLineDto> items = new ListView<SceneItemLineDto>(ID_ITEM_LINES,
              new PropertyModel<List<SceneItemLineDto>>(model, SceneItemDto.F_LINES)) {

	@Override
	protected void populateItem(ListItem<SceneItemLineDto> item) {
		SceneItemLinePanel panel = new SceneItemLinePanel(ID_ITEM_LINE, item.getModel());
		item.add(panel);
	}
};
      items.setReuseItems(true);
      add(items);
  }
 
Example 11
Project: Jouve-Project   File: AddEditCredentialGroupPanel.java   Source Code and License Vote up 5 votes
public AddEditCredentialGroupPanel(String id, CredentialGroup credentialGroup) {
    super(id, true);
    this.credentialGroupModel = new EntityModel<CredentialGroup>(credentialGroup);
    this.isCreation = credentialGroup.getId() == null;

    Form form = getForm();
    form.setModel(new CompoundPropertyModel(credentialGroupModel));
    form.add(new SetFocusBehavior(form));

    nameField = new RequiredTextField("name");
    nameField.add(new StringValidator.MaximumLengthValidator(255));

    connectorInstancesCheckGroup = new CheckGroup("connectorInstances", new PropertyModel(
        credentialGroupModel, "connectorInstances"));

    IModel connectorInstancesModel = new LoadableDetachableModel() {
        @Override
        protected Object load() {
            AdminCollectionPanel adminCollectionPanel = (AdminCollectionPanel) findParent(AdminCollectionPanel.class);
            RecordCollection collection = adminCollectionPanel.getCollection();
            return new ArrayList<ConnectorInstance>(collection.getConnectorInstances());
        }
    };
    connectorInstancesListView = new ListView("connectorInstancesListView", connectorInstancesModel) {
        @Override
        protected void populateItem(ListItem item) {
            ConnectorInstance connectorInstance = (ConnectorInstance) item.getModelObject();
            Check check = new Check("check", new ReloadableEntityModel<ConnectorInstance>(
                connectorInstance));
            Label label = new Label("label", connectorInstance.getDisplayName());
            item.add(check);
            item.add(label);
        }
    };
    connectorInstancesListView.setReuseItems(true);

    form.add(nameField);
    form.add(connectorInstancesCheckGroup);
    connectorInstancesCheckGroup.add(connectorInstancesListView);
}
 
Example 12
Project: nextreports-server   File: JasperRuntimePanel.java   Source Code and License Vote up 5 votes
@SuppressWarnings("unchecked")
private void addComponents() {

    // initialize model
    for (QueryParameter parameter : convertList) {
        if (!runtimeModel.isEdit() || (USER_PARAM.equals(parameter.getName()))) {
            JasperRuntimeParameterModel jasperRuntimeModel = createRuntimeModel(parameter);
            runtimeModel.getParameters().put(parameter.getName(), jasperRuntimeModel);
        }
    }
    if (!runtimeModel.isEdit()) {
        // if some parameters initialized have default values, their dependent parameters
        // have to be initialized too
        for (QueryParameter qp : depParameters) {
            populateDependentParameters(qp, null);
        }
    }

    ListView<QueryParameter> listView = new ListView<QueryParameter>("params", new ArrayList<QueryParameter>(convertMap.values())) {

        @Override
        protected void populateItem(ListItem<QueryParameter> item) {
            createItem(item);
        }

    };
    listView.setReuseItems(true);
    add(listView);

    add(new DropDownChoice("exportType", new PropertyModel(runtimeModel, "exportType"), typeList).setRequired(true));                
}
 
Example 13
Project: engerek   File: MultiValueChoosePanel.java   Source Code and License Vote up 4 votes
private void initLayout(final IModel<List<T>> chosenValues, final List<PrismReferenceValue> filterValues,
	final boolean required, final boolean multiselect) {

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

	@Override
	public void onClick(AjaxRequestTarget target) {
		editValuePerformed(chosenValues.getObject(), filterValues, target, multiselect);
	}
};
edit.setOutputMarkupPlaceholderTag(true);
add(edit);

ListView<T> selectedRowsList = new ListView<T>(ID_SELECTED_ROWS, chosenValues) {

	@Override
	protected void populateItem(ListItem<T> item) {
		WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
		
		textWrapper.setOutputMarkupPlaceholderTag(true);

		TextField<String> text = new TextField<String>(ID_TEXT, createTextModel(item.getModel())); //was value
		text.add(new AjaxFormComponentUpdatingBehavior("blur") {
			private static final long serialVersionUID = 1L;

			@Override
			protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
			}
		});
		text.setRequired(required);
		text.setEnabled(false);
		text.setOutputMarkupPlaceholderTag(true);
		textWrapper.add(text);

		FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
		feedback.setOutputMarkupPlaceholderTag(true);
		textWrapper.add(feedback);

        initButtons(item, item);
        
        item.add(textWrapper);
	}
};
selectedRowsList.setReuseItems(true);
add(selectedRowsList);
  }
 
Example 14
Project: midpoint   File: MultiValueChoosePanel.java   Source Code and License Vote up 4 votes
private void initLayout(final IModel<List<T>> chosenValues, final List<PrismReferenceValue> filterValues,
	final boolean required, final boolean multiselect) {

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

	@Override
	public void onClick(AjaxRequestTarget target) {
		editValuePerformed(chosenValues.getObject(), filterValues, target, multiselect);
	}
};
edit.setOutputMarkupPlaceholderTag(true);
add(edit);

ListView<T> selectedRowsList = new ListView<T>(ID_SELECTED_ROWS, chosenValues) {

	@Override
	protected void populateItem(ListItem<T> item) {
		WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);

		textWrapper.setOutputMarkupPlaceholderTag(true);

		TextField<String> text = new TextField<String>(ID_TEXT, createTextModel(item.getModel())); //was value
		text.add(new AjaxFormComponentUpdatingBehavior("blur") {
			private static final long serialVersionUID = 1L;

			@Override
			protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
			}
		});
		text.setRequired(required);
		text.setEnabled(false);
		text.setOutputMarkupPlaceholderTag(true);
		textWrapper.add(text);

		FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
		feedback.setOutputMarkupPlaceholderTag(true);
		textWrapper.add(feedback);

        initButtons(item, item);

        item.add(textWrapper);
	}
};
selectedRowsList.setReuseItems(true);
add(selectedRowsList);
  }
 
Example 15
Project: midpoint   File: PrismContainerPanel.java   Source Code and License Vote up 4 votes
private void addOrReplaceProperties(IModel<ContainerWrapper<C>> model, final Form form, ItemVisibilityHandler isPanelVisible, boolean isToBeReplaced){
  	
  	
  	ListView<ContainerValueWrapper<C>> values = new ListView<ContainerValueWrapper<C>>("values", new PropertyModel<List<ContainerValueWrapper<C>>>(model, "values")) {
	
	private static final long serialVersionUID = 1L;

	@Override
	protected void populateItem(ListItem<ContainerValueWrapper<C>> item) {
		ContainerValuePanel<C> containerPanel = new ContainerValuePanel<C>("value", item.getModel(), true, form, isPanelVisible, pageBase);
		containerPanel.setOutputMarkupId(true);
		item.add(containerPanel);
		
		
	}
	
};
  	
  	values.setReuseItems(true);
      if (isToBeReplaced) {
          replace(values);
      } else {
          add(values);
      }
  }
 
Example 16
Project: midpoint   File: MultiValueChoosePanel.java   Source Code and License Vote up 4 votes
private void initLayout(final IModel<List<T>> chosenValues, final List<PrismReferenceValue> filterValues,
	final boolean required, final boolean multiselect) {

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

	@Override
	public void onClick(AjaxRequestTarget target) {
		editValuePerformed(chosenValues.getObject(), filterValues, target, multiselect);
	}
};
edit.setOutputMarkupPlaceholderTag(true);
add(edit);

ListView<T> selectedRowsList = new ListView<T>(ID_SELECTED_ROWS, chosenValues) {

	@Override
	protected void populateItem(ListItem<T> item) {
		WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);

		textWrapper.setOutputMarkupPlaceholderTag(true);

		TextField<String> text = new TextField<String>(ID_TEXT, createTextModel(item.getModel())); //was value
		text.add(new AjaxFormComponentUpdatingBehavior("blur") {
			private static final long serialVersionUID = 1L;

			@Override
			protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
			}
		});
		text.setRequired(required);
		text.setEnabled(false);
		text.setOutputMarkupPlaceholderTag(true);
		textWrapper.add(text);

		FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
		feedback.setOutputMarkupPlaceholderTag(true);
		textWrapper.add(feedback);

        initButtons(item, item);

        item.add(textWrapper);
	}
};
selectedRowsList.setReuseItems(true);
add(selectedRowsList);
  }
 
Example 17
Project: midpoint   File: PrismContainerPanel.java   Source Code and License Vote up 4 votes
private void addOrReplaceProperties(IModel<ContainerWrapper<C>> model, final Form form, ItemVisibilityHandler isPanelVisible, boolean isToBeReplaced){
  	
  	
  	ListView<ContainerValueWrapper<C>> values = new ListView<ContainerValueWrapper<C>>("values", new PropertyModel<List<ContainerValueWrapper<C>>>(model, "values")) {
	
	private static final long serialVersionUID = 1L;

	@Override
	protected void populateItem(ListItem<ContainerValueWrapper<C>> item) {
		ContainerValuePanel<C> containerPanel = new ContainerValuePanel<C>("value", item.getModel(), true, form, isPanelVisible, pageBase);
		containerPanel.setOutputMarkupId(true);
		item.add(containerPanel);
		
		
	}
	
};
  	
  	values.setReuseItems(true);
      if (isToBeReplaced) {
          replace(values);
      } else {
          add(values);
      }
  }