org.apache.wicket.markup.repeater.Item Java Examples
The following examples show how to use
org.apache.wicket.markup.repeater.Item.
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: AnalysisTablePanel.java From nextreports-server with Apache License 2.0 | 6 votes |
private List<IColumn<AnalysisRow, String>> getPropertyColumns(List<String> header) { List<IColumn<AnalysisRow, String>> columns = new ArrayList<IColumn<AnalysisRow, String>>(); int columnCount = header.size(); for (int i = 0; i < columnCount; i++) { final int j = i; columns.add(new PropertyColumn<AnalysisRow, String>(new Model<String>(header.get(i)), header.get(i), "cellValues." + i) { public void populateItem(Item cellItem, String componentId, IModel rowModel) { setCellStyle(cellItem, rowModel, j); super.populateItem(cellItem, componentId, rowModel); } }); } // critical case when someone deleted the database folder if (columns.size() == 0) { columns.add(new PropertyColumn<AnalysisRow, String>(new Model<String>(""), "")); } return columns; }
Example #2
Source File: TopologyPage.java From JPPF with Apache License 2.0 | 6 votes |
@Override public void populateItem(final Item<ICellPopulator<DefaultMutableTreeNode>> cellItem, final String componentId, final IModel<DefaultMutableTreeNode> rowModel) { final NodeModel<DefaultMutableTreeNode> nodeModel = (NodeModel<DefaultMutableTreeNode>) rowModel; final DefaultMutableTreeNode treeNode = nodeModel.getObject(); final AbstractTopologyComponent comp = (AbstractTopologyComponent) treeNode.getUserObject(); final String value = (String) treeModel.getValueAt(treeNode, index); cellItem.add(new Label(componentId, value)); if (traceEnabled) log.trace(String.format("index %d populating value=%s, treeNode=%s", index, value, treeNode)); String cssClass = "default_cursor "; final boolean selected = selectionHandler.isSelected(comp.getUuid()); if (comp.isNode()) { final TopologyNode data = (TopologyNode) treeNode.getUserObject(); if (data.isNode()) cssClass += ((data.getStatus() == TopologyNodeStatus.UP) ? "node_up " : "node_down ") + getCssClass(); } else if (!selected) cssClass += "empty "; if (selected && !comp.isPeer()) cssClass += "tree_selected "; cellItem.add(new AttributeModifier("class", cssClass)); }
Example #3
Source File: TaskPropertyColumn.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
@Override public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel) { final TaskDO task = getTask(rowModel); if (task == null) { item.add(new Label(componentId, "")); } else { final Label label = new Label(componentId, task.getTitle()); final String taskPath = getTaskFormatter().getTaskPath(task.getId(), false, OutputType.PLAIN); WicketUtils.addTooltip(label, taskPath); label.setEscapeModelStrings(false); item.add(label); } if (cellItemListener != null) cellItemListener.populateItem(item, componentId, rowModel); }
Example #4
Source File: EmbeddedCollectionFilterPanel.java From Orienteer with Apache License 2.0 | 6 votes |
private void createAndAddFiltersList(final List<CollectionInputPanel<String>> filterComponents) { final RefreshingView<Component> filters = new RefreshingView<Component>("filters") { @Override protected Iterator<IModel<Component>> getItemModels() { List<IModel<Component>> components = Lists.newArrayList(); for (Component component : filterComponents) { components.add(Model.of(component)); } return components.iterator(); } @Override protected void populateItem(Item<Component> item) { item.add(item.getModelObject()); } }; filters.setOutputMarkupPlaceholderTag(true); filters.setItemReuseStrategy(new ReuseIfModelsEqualStrategy()); add(filters); }
Example #5
Source File: SchemaOClassesModalPanel.java From Orienteer with Apache License 2.0 | 6 votes |
private IColumn<OClass, String> createCheckBoxColumn() { return new CheckBoxColumn<OClass, String, String>(OClassClassNameConverter.INSTANCE) { @Override public void populateItem(Item<ICellPopulator<OClass>> cellItem, String componentId, final IModel<OClass> rowModel) { cellItem.add(new BooleanEditPanel(componentId, getCheckBoxModel(rowModel)) { @Override protected void onConfigure() { super.onConfigure(); List<OArchitectOClass> classes = existClasses.getObject(); if (classes != null) { setEnabled(!OArchitectClassesUtils.isClassContainsIn(rowModel.getObject().getName(), classes)); } } }); } }; }
Example #6
Source File: InfinitePagingDataTable.java From sakai with Educational Community License v2.0 | 6 votes |
@Override protected Item newCellItem(final String id, final int index, final IModel model) { Item item = InfinitePagingDataTable.this.newCellItem(id, index, model); final IColumn<T, S> column = InfinitePagingDataTable.this.columns.get(index); if (column instanceof IStyledColumn) { item.add(new CssAttributeBehavior() { private static final long serialVersionUID = 1L; @Override protected String getCssClass() { return ((IStyledColumn<T, S>)column).getCssClass(); } }); } return item; }
Example #7
Source File: CheckTablePanel.java From nextreports-server with Apache License 2.0 | 6 votes |
public CheckTablePanel(String id, List<IColumn<T, String>> columns, ISortableDataProvider<T, String> provider, int rows) { super(id); group = new CheckGroup<T>("group", marked); this.dataTable = new BaseTable<T>("table", createTableColumns(columns), provider, rows) { @Override protected Item<T> newRowItem(String s, int i, IModel<T> entityIModel) { Item<T> item = super.newRowItem(s, i, entityIModel); return newRowTableItem(entityIModel, item); } }; Form<T> form = new Form<T>("form"); group.add(dataTable); form.add(group); add(form); }
Example #8
Source File: OrienteerCloudOModulesConfigurationsPanel.java From Orienteer with Apache License 2.0 | 6 votes |
private List<IColumn<OArtifact, String>> getColumns(IModel<DisplayMode> modeModel) { List<IColumn<OArtifact, String>> columns = Lists.newArrayList(); columns.add(new CheckBoxColumn<OArtifact, OArtifact, String>(new IdentityConverter<OArtifact>()) { @Override public void populateItem(Item<ICellPopulator<OArtifact>> cellItem, String componentId, final IModel<OArtifact> rowModel) { cellItem.add(new BooleanEditPanel(componentId, getCheckBoxModel(rowModel)) { @Override public boolean isEnabled() { return rowModel.getObject() != null && !rowModel.getObject().isDownloaded(); } }); } }); columns.add(new OArtifactColumn(OArtifactField.GROUP.asModel(), modeModel)); columns.add(new OArtifactColumn(OArtifactField.ARTIFACT.asModel(), modeModel)); columns.add(new OArtifactColumn(OArtifactField.VERSION.asModel(), DisplayMode.EDIT.asModel())); columns.add(new OArtifactColumn(OArtifactField.DESCRIPTION.asModel(), modeModel)); columns.add(new OArtifactColumn(OArtifactField.DOWNLOADED.asModel(), modeModel)); return columns; }
Example #9
Source File: HealthPage.java From JPPF with Apache License 2.0 | 6 votes |
@Override public void populateItem(final Item<ICellPopulator<DefaultMutableTreeNode>> cellItem, final String componentId, final IModel<DefaultMutableTreeNode> rowModel) { super.populateItem(cellItem, componentId, rowModel); final DefaultMutableTreeNode node = rowModel.getObject(); final AbstractTopologyComponent comp = (AbstractTopologyComponent) node.getUserObject(); String cssClass = "default_cursor "; final boolean selected = selectionHandler.isSelected(comp.getUuid()); boolean inactive = false; if (comp.isPeer()) cssClass += "peer "; else if (comp.isNode()) { final TopologyNode data = (TopologyNode) node.getUserObject(); inactive = !data.getManagementInfo().isActive(); if (data.getStatus() == TopologyNodeStatus.UP) { if (inactive) cssClass += selected ? "tree_inactive_selected " : "tree_inactive "; else cssClass += selected ? "tree_selected " : "node_up "; } else cssClass += selected ? "tree_inactive_selected " : "node_tree_down "; } else if (comp.isDriver()) { final TopologyDriver driver = (TopologyDriver) node.getUserObject(); if (driver.getConnection().getStatus().isWorkingStatus()) cssClass += (selected) ? "tree_selected " : "driver_up "; else cssClass = (selected) ? "tree_inactive_selected" : "driver_down"; } cellItem.add(new AttributeModifier("class", cssClass)); }
Example #10
Source File: CheckTablePanel.java From nextreports-server with Apache License 2.0 | 6 votes |
private IColumn<T, String> createCheckColumn() { return new AbstractColumn<T, String>(new Model<String>("Select")) { private static final long serialVersionUID = 1L; public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> rowModel) { item.add(new CheckBoxPanel(componentId, rowModel, item)); item.add(AttributeAppender.append("class", "checkboxColumn")); } @Override public Component getHeader(String s) { return new CheckBoxHeaderPanel(s); } }; }
Example #11
Source File: AjaxCheckTablePanel.java From nextreports-server with Apache License 2.0 | 6 votes |
public AjaxCheckTablePanel(String id, List<IColumn<T, String>> columns, ISortableDataProvider<T, String> dataProvider, int rowsPerPage) { super(id); this.setOutputMarkupId(true); selectedObjects = new ArrayList<T>(); columns.add(0, new CheckableTableColumn(new Model<String>(), "id")); dataTable = new BaseTable<T>(TABLE_ID, columns, dataProvider, rowsPerPage) { private static final long serialVersionUID = 1L; @Override protected Item<T> newRowItem(String id, int index, IModel<T> model) { return newRowTableItem(model, new HighlitableDataItem(id, index, model)); } }; // ItemReuseStrategy is usefull to refresh only modified row, but it uses hash code and equals of the model // (EntityModel in this case which contains only the id) // So if we do a rename with this strategy, the change will not be seen (as when adding a new report for example) //dataTable.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance()); add(dataTable); }
Example #12
Source File: CustomerListIntTest.java From wicket-spring-boot with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings({ "rawtypes", "unchecked" }) public void assert_start_customer_list_page(){ getTester().startPage(CustomerListPage.class); getTester().assertRenderedPage(CustomerListPage.class); getTester().assertComponent("filterForm:table", DataTable.class); DataTable<Customer, CustomerSort> dataTable = (DataTable) getTester().getComponentFromLastRenderedPage("filterForm:table"); assertThat(dataTable.getItemCount(), equalTo(5L)); //id, username, firstname, lastname, active, actions assertThat(dataTable.getColumns().size(), equalTo(6)); //get third row Item<Customer> item3 = (Item) getTester().getComponentFromLastRenderedPage("filterForm:table:body:rows:3"); assertThat(item3.getModelObject().getId(), equalTo(3L)); assertThat(item3.getModelObject().getUsername(), equalTo("adalgrim")); Item<Customer> item5 = (Item) getTester().getComponentFromLastRenderedPage("filterForm:table:body:rows:5"); assertThat(item5.getModelObject().getId(), equalTo(5L)); assertThat(item5.getModelObject().getUsername(), equalTo("tuk")); }
Example #13
Source File: CustomerListPageTest.java From wicket-spring-boot with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings({ "rawtypes", "unchecked" }) public void assert_start_customer_list_page(){ getTester().startPage(CustomerListPage.class); getTester().assertRenderedPage(CustomerListPage.class); getTester().assertComponent("filterForm:table", DataTable.class); DataTable<Customer, CustomerSort> dataTable = (DataTable) getTester().getComponentFromLastRenderedPage("filterForm:table"); assertThat(dataTable.getItemCount(), equalTo(CUSTOMERS_COUNT)); //id, username, firstname, lastname, active, actions assertThat(dataTable.getColumns().size(), equalTo(6)); //get third row Item<Customer> item3 = (Item) getTester().getComponentFromLastRenderedPage("filterForm:table:body:rows:3"); assertThat(item3.getModelObject().getId(), equalTo(3L)); assertThat(item3.getModelObject().getUsername(), equalTo("username3")); Item<Customer> item5 = (Item) getTester().getComponentFromLastRenderedPage("filterForm:table:body:rows:5"); assertThat(item5.getModelObject().getId(), equalTo(5L)); assertThat(item5.getModelObject().getUsername(), equalTo("username5")); }
Example #14
Source File: GanttChartEditTreeTablePanel.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("serial") private void addEndDateColumns(final Item<GanttTreeTableNode> item, final GanttTreeTableNode node, final GanttTask ganttObject, final TaskDO task) { final DatePanel endDatePanel = new DatePanel("endDate", new PropertyModel<Date>(ganttObject, "endDate"), DatePanelSettings.get() .withSelectProperty("endDate:" + node.getHashId())); addColumn(item, endDatePanel, "white-space: nowrap;"); endDatePanelMap.put(ganttObject.getId(), endDatePanel); new RejectSaveLinksFragment("rejectSaveEndDate", item, endDatePanel, task, task != null ? DateTimeFormatter.instance() .getFormattedDate(task.getEndDate()) : "") { @Override protected void onSave() { task.setEndDate(ganttObject.getEndDate()); taskDao.update(task); } @Override protected void onReject() { ganttObject.setEndDate(task.getEndDate()); } }; }
Example #15
Source File: ParametersDirectoryPanel.java From syncope with Apache License 2.0 | 6 votes |
@Override protected List<IColumn<ConfParam, String>> getColumns() { final List<IColumn<ConfParam, String>> columns = new ArrayList<>(); columns.add(new PropertyColumn<>(new ResourceModel("schema"), "schema")); columns.add(new PropertyColumn<ConfParam, String>(new ResourceModel("values"), "values") { private static final long serialVersionUID = -1822504503325964706L; @Override public void populateItem( final Item<ICellPopulator<ConfParam>> item, final String componentId, final IModel<ConfParam> rowModel) { if (rowModel.getObject().getValues().toString().length() > 96) { item.add(new Label(componentId, getString("tooLong")). add(new AttributeModifier("style", "font-style:italic"))); } else { super.populateItem(item, componentId, rowModel); } } }); return columns; }
Example #16
Source File: ConnObjectAttrColumn.java From syncope with Apache License 2.0 | 6 votes |
@Override public void populateItem( final Item<ICellPopulator<ConnObjectTO>> cellItem, final String componentId, final IModel<ConnObjectTO> rowModel) { Optional<Attr> attr = rowModel.getObject().getAttr(name); List<String> values = attr.map(Attr::getValues).orElse(null); if (values == null || values.isEmpty()) { cellItem.add(new Label(componentId, "")); } else if (values.size() == 1) { cellItem.add(new Label(componentId, values.get(0))); } else { cellItem.add(new Label(componentId, values.toString())); } }
Example #17
Source File: InfinitePagingDataTable.java From sakai with Educational Community License v2.0 | 6 votes |
@Override protected Item newCellItem(final String id, final int index, final IModel model) { Item item = InfinitePagingDataTable.this.newCellItem(id, index, model); final IColumn<T, S> column = InfinitePagingDataTable.this.columns.get(index); if (column instanceof IStyledColumn) { item.add(new CssAttributeBehavior() { private static final long serialVersionUID = 1L; @Override protected String getCssClass() { return ((IStyledColumn<T, S>)column).getCssClass(); } }); } return item; }
Example #18
Source File: DeleteRowCommandColumn.java From Orienteer with Apache License 2.0 | 6 votes |
@Override public void populateItem(Item<ICellPopulator<ODocument>> cellItem, String componentId, final IModel<ODocument> rowModel) { cellItem.add(new AjaxFormCommand<ODocument>(componentId, "command.remove") { @Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { super.onClick(targetOptional); rowModel.getObject().delete(); DataTable<?, ?> table = findParent(DataTable.class); if(table!=null && targetOptional.isPresent()) targetOptional.get().add(table); } @Override protected void onConfigure() { super.onConfigure(); setVisibilityAllowed(modeModel.getObject().equals(DisplayMode.EDIT)); } }.setBootstrapSize(BootstrapSize.EXTRA_SMALL) .setBootstrapType(BootstrapType.DANGER) .setIcon((String) null)); }
Example #19
Source File: ProjectPortfolioPanel.java From artifact-listener with Apache License 2.0 | 5 votes |
@Override protected void addItemColumns(Item<Project> item, IModel<? extends Project> projectModel) { Link<Void> projectLink = ProjectDescriptionPage.linkDescriptor(ReadOnlyModel.of(projectModel)).link("projectLink"); projectLink.add(new Label("name", BindingModel.of(projectModel, Binding.project().name()))); item.add(projectLink); item.add(new Label("nbVersions", BindingModel.of(projectModel, Binding.project().versions().size()))); item.add(new Label("nbArtifacts", BindingModel.of(projectModel, Binding.project().artifacts().size()))); }
Example #20
Source File: OrienteerDataTable.java From Orienteer with Apache License 2.0 | 5 votes |
@Override protected Item<IColumn<T, S>> newCellItem(String id, int index, final IModel<IColumn<T, S>> model) { return new Item<IColumn<T, S>>(id, index, model) { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); headersToolbar.changeColorForFilteredColumn(tag, model.getObject()); } }; }
Example #21
Source File: DatePropertyColumn.java From syncope with Apache License 2.0 | 5 votes |
@Override public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel) { IModel<?> date = getDataModel(rowModel); String convertedDate = ""; if (date.getObject() instanceof Date) { convertedDate = SyncopeConsoleSession.get().getDateFormat().format(date.getObject()); } item.add(new Label(componentId, convertedDate)); }
Example #22
Source File: BooleanImageLinkPropertyColumn.java From nextreports-server with Apache License 2.0 | 5 votes |
@Override public void populateItem(Item<ICellPopulator<T>> item, String componentId, final IModel<T> rowModel) { item.add(new AbstractImageAjaxLinkPanel(componentId) { private static final long serialVersionUID = 1L; @Override public String getImageName() { if ((Boolean) PropertyResolver.getValue(getPropertyExpression(), rowModel.getObject())) { String theme = settings.getSettings().getColorTheme(); return "images/" + ThemesManager.getTickImage(theme, (NextServerApplication)getApplication()); } else { return "images/delete.gif"; } } @Override public String getDisplayString() { return ""; } @Override public void onClick(AjaxRequestTarget target) { onImageClick(rowModel.getObject(), target); } }); }
Example #23
Source File: TokenColumn.java From syncope with Apache License 2.0 | 5 votes |
@Override public void populateItem( final Item<ICellPopulator<T>> cellItem, final String componentId, final IModel<T> rowModel) { if (rowModel.getObject() instanceof UserTO) { if (StringUtils.isNotBlank(((UserTO) rowModel.getObject()).getToken())) { cellItem.add(new Label(componentId, new ResourceModel("tokenValued", "tokenValued"))); } else { cellItem.add(new Label(componentId, new ResourceModel("tokenNotValued", "tokenNotValued"))); } } }
Example #24
Source File: OClassColumn.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public void populateItem(Item<ICellPopulator<OClass>> cellItem, String componentId, IModel<OClass> rowModel) { if(DisplayMode.EDIT.equals(getModeObject())) { super.populateItem(cellItem, componentId, rowModel); } else { cellItem.add(new OClassViewPanel(componentId, rowModel)); } }
Example #25
Source File: DataTablePanel.java From syncope with Apache License 2.0 | 5 votes |
protected Collection<T> getGroupModelObjects() { final Set<T> res = new HashSet<>(); final Component rows = group.get("dataTable:body:rows"); if (rows instanceof DataGridView) { @SuppressWarnings("unchecked") final Iterator<Item<T>> iter = ((DataGridView<T>) rows).getItems(); while (iter.hasNext()) { res.add(iter.next().getModelObject()); } } return res; }
Example #26
Source File: AccessTokenDirectoryPanel.java From syncope with Apache License 2.0 | 5 votes |
@Override protected List<IColumn<AccessTokenTO, String>> getColumns() { List<IColumn<AccessTokenTO, String>> columns = new ArrayList<>(); columns.add(new KeyPropertyColumn<>( new StringResourceModel(Constants.KEY_FIELD_NAME, this), Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME)); columns.add(new PropertyColumn<>(new ResourceModel("owner"), "owner", "owner")); columns.add(new AbstractColumn<AccessTokenTO, String>(new ResourceModel("issuedAt", "")) { private static final long serialVersionUID = -1822504503325964706L; @Override public void populateItem( final Item<ICellPopulator<AccessTokenTO>> cellItem, final String componentId, final IModel<AccessTokenTO> model) { JwsJwtCompactConsumer consumer = new JwsJwtCompactConsumer(model.getObject().getBody()); cellItem.add(new Label(componentId, SyncopeConsoleSession.get().getDateFormat().format( new Date(consumer.getJwtClaims().getIssuedAt() * 1000)))); } }); columns.add(new DatePropertyColumn<>(new ResourceModel("expiryTime"), "expiryTime", "expiryTime")); return columns; }
Example #27
Source File: ProductCatalogPage.java From AppStash with Apache License 2.0 | 5 votes |
private Component productView(IModel<List<ProductInfo>> model) { return new DataView<ProductInfo>("products", productDataProvider(model)) { @Override protected void populateItem(final Item<ProductInfo> item) { ProductItemPanel productItem = new ProductItemPanel("productItem", feedback, item.getModel()); productItem.setOutputMarkupId(true); item.add(productItem); } }; }
Example #28
Source File: StatisticsTablePanel.java From JPPF with Apache License 2.0 | 5 votes |
@Override public void populateItem(final Item<ICellPopulator<Fields>> cellItem, final String componentId, final IModel<Fields> rowModel) { final Fields field = rowModel.getObject(); final Locale locale = JPPFWebSession.get().getLocale(); String value = null; if (index == 0) { //value = LocalizationUtils.getLocalized(FIELDS_BASE, field.getName(), locale); value = field.getLocalizedName(); } else { final StatsUpdater updater = JPPFWebConsoleApplication.get().getStatsUpdater(); value = updater.formatLatestValue(locale, JPPFWebSession.get().getCurrentDriver(), field); } cellItem.add(new Label(componentId, value)); cellItem.add(new AttributeModifier("class", index == 0 ? "stats_label" : "stats_number")); }
Example #29
Source File: OPropertyDefinitionColumn.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public void populateItem(Item<ICellPopulator<OProperty>> cellItem, String componentId, IModel<OProperty> rowModel) { if(DisplayMode.EDIT.equals(getModeObject())) { super.populateItem(cellItem, componentId, rowModel); } else { cellItem.add(new OPropertyViewPanel(componentId, rowModel)); } }
Example #30
Source File: PolicyRuleDirectoryPanel.java From syncope with Apache License 2.0 | 5 votes |
@Override protected List<IColumn<PolicyRuleWrapper, String>> getColumns() { final List<IColumn<PolicyRuleWrapper, String>> columns = new ArrayList<>(); columns.add(new PropertyColumn<>( new StringResourceModel("rule", this), "implementationKey", "implementationKey")); columns.add(new AbstractColumn<PolicyRuleWrapper, String>( new StringResourceModel("configuration", this)) { private static final long serialVersionUID = -4008579357070833846L; @Override public void populateItem( final Item<ICellPopulator<PolicyRuleWrapper>> cellItem, final String componentId, final IModel<PolicyRuleWrapper> rowModel) { if (rowModel.getObject().getConf() == null) { cellItem.add(new Label(componentId, "")); } else { cellItem.add(new Label(componentId, rowModel.getObject().getConf().getClass().getName())); } } }); return columns; }