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

The following examples show how to use org.apache.wicket.markup.html.list.ListView#setReuseItems() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilterPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
private void addFilterPanels(WebMarkupContainer container, List<AbstractFilterPanel<?, ?>> panels, final List<FilterTab> tabs) {
    ListView<AbstractFilterPanel<?, ?>> listView = new ListView<AbstractFilterPanel<?, ?>>("filterPanels", panels) {
        private boolean first = true;
        @Override
        protected void populateItem(ListItem<AbstractFilterPanel<?, ?>> item) {
            if (first) {
                first = false;
                item.add(AttributeModifier.append("class", TAB_PANE_ACTIVE));
            } else item.add(AttributeModifier.append("class", TAB_PANE));
            item.add(AttributeModifier.append("class", FILTER_WIDTH));
            AbstractFilterPanel panel = item.getModelObject();
            for (FilterTab tab : tabs) {
                if (tab.getType().equals(panel.getFilterCriteriaType())) {
                    tab.setTabId(item.getMarkupId());
                    break;
                }
            }
            item.add(panel);
        }
    };
    listView.setOutputMarkupPlaceholderTag(true);
    listView.setReuseItems(true);
    container.add(listView);
}
 
Example 2
Source File: FilterPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
private void addFilterSwitches(WebMarkupContainer container, List<FilterTab> switches) {
    ListView<FilterTab> listView = new ListView<FilterTab>("panelSwitches", switches) {

        private boolean first = true;

        @Override
        protected void populateItem(ListItem<FilterTab> item) {
            if (first) {
                first = false;
                item.getModelObject().add(AttributeModifier.append("class", ACTIVE));
            }
            item.add(item.getModelObject());
        }
    };
    listView.setOutputMarkupPlaceholderTag(true);
    listView.setReuseItems(true);
    container.add(listView);
}
 
Example 3
Source File: TypeBrowser.java    From oodt with Apache License 2.0 6 votes vote down vote up
/**
 * @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 4
Source File: JasperRuntimePanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@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));                
}