Java Code Examples for org.apache.wicket.markup.repeater.Item

The following are top voted examples for showing how to use org.apache.wicket.markup.repeater.Item. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: karate   File: VarsRefreshingView.java   View source code 6 votes vote down vote up
@Override
protected void populateItem(Item<Var> item) {
    String name = item.getModel().getObject().getName();
    item.add(new AjaxLink("show") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            selectedName = name;
            Component headerPanel = getPage().get(BasePage.STICKY_HEADER_ID);
            VarModel varModel = new VarModel(model.getSessionId(), name);
            VarPanel varPanel = new VarPanel(BasePage.STICKY_HEADER_ID, varModel, VarsRefreshingView.this);                
            headerPanel = headerPanel.replaceWith(varPanel);
            target.add(headerPanel);
            Component varsPanel = getPage().get(BasePage.LEFT_NAV_ID);
            target.add(varsPanel);
        }
    }.add(new Label("name", name)));
    String type = item.getModel().getObject().getValue().getTypeAsShortString();
    item.add(new Label("type", type));
    if (name.equals(selectedName)) {
        item.add(new AttributeModifier("class", "success"));
    }
}
 
Example 2
Project: GeoCrawler   File: CrawlsPage.java   View source code 6 votes vote down vote up
private void populateCrawlRow(Item<Crawl> item) {
  item.add(new AjaxLink<Crawl>("edit", item.getModel()) {
    @Override
    public void onClick(AjaxRequestTarget target) {
      editCrawl(target, getModel());
    }
  }.add(new Label("crawlName")));
  item.add(new Label("seedList.name"));

  item.add(new Label("progress"));
  item.add(createStatusLabel());
  item.add(new Link<Crawl>("start", item.getModel()) {
    @Override
    public void onClick() {
      crawlService.startCrawl(getModelObject().getId(), getCurrentInstance());
    }
  });

  item.add(new Link<Crawl>("delete", item.getModel()) {
    @Override
    public void onClick() {
      crawlService.deleteCrawl(getModelObject().getId());
    }
  });
}
 
Example 3
Project: GeoCrawler   File: SettingsPage.java   View source code 6 votes vote down vote up
public SettingsPage() {
  settingsTable = new WebMarkupContainer("settingsTable");
  settingsTable.setOutputMarkupId(true);
  RefreshingView<NutchConfig> nutchConfig = new RefreshingView<NutchConfig>(
      "settings") {

    @Override
    protected Iterator<IModel<NutchConfig>> getItemModels() {
      return new CpmIteratorAdapter<NutchConfig>(
          convertNutchConfig(nutchService.getNutchConfig(getCurrentInstance()
              .getId())));
    }

    @Override
    protected void populateItem(Item<NutchConfig> item) {
      item.add(new Label("name"));
      item.add(new TextField<String>("value"));
    }
  };
  settingsTable.add(nutchConfig);
  add(settingsTable);
}
 
Example 4
Project: GeoCrawler   File: InstancesPage.java   View source code 6 votes vote down vote up
private RefreshingView<NutchInstance> refreshingView() {
  RefreshingView<NutchInstance> instances = new RefreshingView<NutchInstance>(
      "instances") {

    @Override
    protected Iterator<IModel<NutchInstance>> getItemModels() {
      return new CpmIteratorAdapter<NutchInstance>(
          instanceService.getInstances());
    }

    @Override
    protected void populateItem(Item<NutchInstance> item) {
      populateInstanceRow(item);
    }
  };
  return instances;
}
 
Example 5
Project: engerek   File: LinkColumn.java   View source code 6 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId,
                         final IModel<T> rowModel) {
	
	IModel model = createLinkModel(rowModel);
    cellItem.add(new LinkPanel(componentId, model) {
    	private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            LinkColumn.this.onClick(target, rowModel);
        }

        @Override
        public boolean isEnabled() {
            return LinkColumn.this.isEnabled(rowModel);
        }
    });
}
 
Example 6
Project: engerek   File: ColumnUtils.java   View source code 6 votes vote down vote up
private static <T> PropertyColumn<T, String> createPropertyColumn(String name, String sortableProperty,
		final String expression, final boolean multivalue) {

	return new PropertyColumn<T, String>(createStringResource(name), sortableProperty, expression) {
		private static final long serialVersionUID = 1L;

		@Override
		public void populateItem(Item item, String componentId, IModel rowModel) {
			if (multivalue) {
				IModel<List> values = new PropertyModel<List>(rowModel, expression);
				RepeatingView repeater = new RepeatingView(componentId);
				for (final Object task : values.getObject()) {
					repeater.add(new Label(repeater.newChildId(), task.toString()));
				}
				item.add(repeater);
				return;
			}

			super.populateItem(item, componentId, rowModel);
		}
	};

}
 
Example 7
Project: engerek   File: ObjectLinkColumn.java   View source code 6 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId,
                         final IModel<T> rowModel) {
	
	IModel<ObjectType> superModel = createLinkModel(rowModel);
	final ObjectType targetObjectType = superModel.getObject();
	IModel<String> nameModel = new PropertyModel<String>(superModel, FocusType.F_NAME.getLocalPart() + ".orig");
    cellItem.add(new LinkPanel(componentId, nameModel) {
    	private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            ObjectLinkColumn.this.onClick(target, rowModel, targetObjectType);
        }

        @Override
        public boolean isEnabled() {
            return ObjectLinkColumn.this.isEnabled(rowModel);
        }
    });
}
 
Example 8
Project: engerek   File: CheckBoxColumn.java   View source code 6 votes vote down vote up
@Override
    public void populateItem(final Item<ICellPopulator<T>> cellItem, String componentId,
                             final IModel<T> rowModel) {
        IModel<Boolean> selected = getCheckBoxValueModel(rowModel);

        CheckBoxPanel check = new CheckBoxPanel(componentId, selected, enabled) {

            @Override
            public void onUpdate(AjaxRequestTarget target) {
                DataTable table = findParent(DataTable.class);
                onUpdateRow(target, table, rowModel);

                //updating table row
//                target.add(cellItem.findParent(SelectableDataTable.SelectableRowItem.class));
            }
        };
        check.setOutputMarkupId(true);

        cellItem.add(check);
    }
 
Example 9
Project: engerek   File: TaskResultTabPanel.java   View source code 6 votes vote down vote up
private List<IColumn<OperationResult, String>> initResultColumns() {
	List<IColumn<OperationResult, String>> columns = new ArrayList<IColumn<OperationResult, String>>();
	columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.token"), "token"));
	columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.operation"), "operation"));
	columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.status"), "status"));
	columns.add(new AbstractColumn<OperationResult, String>(createStringResource("pageTaskEdit.opResult.message"), "message") {
		@Override
		public void populateItem(Item<ICellPopulator<OperationResult>> cellItem, String componentId,
				IModel<OperationResult> rowModel) {
			Label label = new Label(componentId, new AbstractReadOnlyModel<String>() {
				@Override
				public String getObject() {
					return WebComponentUtil.nl2br(rowModel.getObject().getMessage());
				}
			});
			label.setEscapeModelStrings(false);
			cellItem.add(label);
		}
	});
	//columns.add(new PropertyColumn(createStringResource("pageTaskEdit.opResult.message"), "message"));
	return columns;
}
 
Example 10
Project: vlo-curation   File: AvailabilityFacetPanel.java   View source code 6 votes vote down vote up
@Override
protected void populateItem(Item<Count> item) {
    //model for actual value
    final PropertyModel<String> valueModel = new PropertyModel<>(item.getModel(), "name");

    //checkbox
    final Component selector = createValueCheckbox("selector", valueModel.getObject());
    item.add(selector);

    //label
    item.add(new WebMarkupContainer("label")
            //child label
            .add(new FieldValueLabel("name", valueModel, fieldNameModel))
            //count label
            .add(new Label("count", new PropertyModel<String>(item.getModel(), "count")))
            //reference to checkbox
            .add(new AttributeModifier("for", selector.getMarkupId()))
            .add(new AttributeAppender("class", valueModel, " "))
    );

    //description as tooltip (title)
    final IModel<FieldValueDescriptor> descriptorModel = new MapValueModel<>(descriptorsModel, valueModel);
    final IModel<String> descriptionModel = new PropertyModel<>(descriptorModel, "description");
    item.add(new AttributeModifier("title", descriptionModel));
}
 
Example 11
Project: Unicorn   File: SelectableDataTable.java   View source code 6 votes vote down vote up
@Override
protected Item<T> newRowItem(final String id, final int index, final IModel<T> model) {
	final Item<T> rowItem = new Item<T>(id, index, model);
	rowItem.add(

			new AjaxEventBehavior("onclick") {
				private static final long serialVersionUID = 6720512493017210281L;

				@Override
				protected void onEvent(final AjaxRequestTarget target) {
					// callback or do some stuff
				}

			});
	return rowItem;

}
 
Example 12
Project: Unicorn   File: BPMNProcessUploadPanel.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
private Component addProcessModelTable() {
	this.columns = new ArrayList<IColumn<AbstractBPMNElement, String>>();
	this.columns.add(new AbstractColumn<AbstractBPMNElement, String>(new Model("Element")) {

		@Override
		public void populateItem(final Item cellItem, final String componentId, final IModel rowModel) {
			final String elementName = ((AbstractBPMNElement) rowModel.getObject()).toString();
			cellItem.add(new Label(componentId, elementName));
		}
	});
	this.columns.add(new PropertyColumn<AbstractBPMNElement, String>(Model.of("Predecessors"), "predecessors"));
	this.columns.add(new PropertyColumn<AbstractBPMNElement, String>(Model.of("Successors"), "successors"));
	this.columns.add(new PropertyColumn<AbstractBPMNElement, String>(Model.of("Monitoring Points"), "monitoringPoints"));

	this.processModelTable = new DefaultDataTable<AbstractBPMNElement, String>("processModelElements", this.columns, this.processModelProvider, 40);
	this.processModelTable.setOutputMarkupId(true);
	this.processModelTable.setOutputMarkupPlaceholderTag(true);

	return this.processModelTable;
}
 
Example 13
Project: Unicorn   File: AttributeTreePanel.java   View source code 6 votes vote down vote up
private List<IColumn<TypeTreeNode, String>> createColumns() {
	final List<IColumn<TypeTreeNode, String>> columns = new ArrayList<IColumn<TypeTreeNode, String>>();

	columns.add(new PropertyColumn<TypeTreeNode, String>(Model.of("ID"), "ID"));
	columns.add(new TreeColumn<TypeTreeNode, String>(Model.of("Attributes")));

	columns.add(new AbstractColumn<TypeTreeNode, String>(new Model("Select")) {
		@Override
		public void populateItem(final Item cellItem, final String componentId, final IModel rowModel) {
			final TypeTreeNode attribute = ((TypeTreeNode) rowModel.getObject());
			cellItem.add(new AttributeSelectionPanel(componentId, attribute, AttributeTreePanel.this.attributeIdentifiersAndExpressions, AttributeTreePanel.this.attributeIdentifiersWithExternalKnowledge, AttributeTreePanel.this.advancedRuleEditorPanel.getPatternBuilderPanel()));

		}
	});

	return columns;
}
 
Example 14
Project: Unicorn   File: Export.java   View source code 6 votes vote down vote up
@SuppressWarnings({"rawtypes", "unchecked"})
private void addEventTable() {
	this.columns = new ArrayList<IColumn<EapEvent, String>>();
	this.columns.add(new PropertyColumn<EapEvent, String>(Model.of("ID"), "ID"));
	this.columns.add(new PropertyColumn<EapEvent, String>(Model.of("Timestamp"), "timestamp"));
	this.columns.add(new PropertyColumn<EapEvent, String>(Model.of("EventType"), "eventType"));
	this.columns.add(new PropertyColumn<EapEvent, String>(Model.of("Values"), "values"));
	this.columns.add(new PropertyColumn<EapEvent, String>(Model.of("Process Instances"), "processInstances"));

	this.columns.add(new AbstractColumn<EapEvent, String>(new Model("Select")) {
		private static final long serialVersionUID = 1L;

		@Override
		public void populateItem(final Item cellItem, final String componentId, final IModel rowModel) {
			final int entryId = ((EapEvent) rowModel.getObject()).getID();
			cellItem.add(new SelectEntryPanel(componentId, entryId, Export.this.eventProvider));
		}
	});

	this.dataTable = new DefaultDataTable<EapEvent, String>("events", this.columns, this.eventProvider, 20);
	this.dataTable.setOutputMarkupId(true);
	this.add(this.dataTable);
}
 
Example 15
Project: Intercloud   File: NavigationFrame.java   View source code 6 votes vote down vote up
/**
 * Construct.
 * 
 * @param id
 */
public ForAdmins(String id, final BodyFrame index) {
	super(id);
	
	// generate data-view to populate the table
	DataView<NavigationItem> naviView = new DataView<NavigationItem>("adminNavis",
			new ListDataProvider<NavigationItem>(index.getAdminNavigationList())) {

		@Override
		protected void populateItem(Item<NavigationItem> item) {
			NavigationItem naviItem = item.getModelObject();

			// link to the page
			ChangeFramePageLink link = new ChangeFramePageLink("linkToAdminPage", index, naviItem.getPageClass());
			link.add(new Label("adminLinkLabel", naviItem.getPageName()));
			item.add(link);
		}
	};
	
	add(naviView);
}
 
Example 16
Project: u-qasar.platform   File: QMQualityIndicatorSearchResultsPanel.java   View source code 6 votes vote down vote up
@Override
protected void populateDataViewItem(Item<QMQualityIndicator> item) {
    final QMQualityIndicator entity = item.getModelObject();
    BookmarkablePageLink<QMQualityIndicatorEditPage> link = new BookmarkablePageLink<>("link",
            QMQualityIndicatorEditPage.class, QMQualityIndicatorEditPage.forQualityIndicator(entity));
    link.add(new Label("name", Model.of(entity.getName()
            + " (" + entity.getNodeKey() + ")")).setRenderBodyOnly(true));
    item.add(link);
    
    BookmarkablePageLink<QModelViewPage> QMlink = new BookmarkablePageLink<>("qmodel",
    		QModelViewPage.class, QModelViewPage.forQModel(entity.getQModel()));
    QMlink.add(new Label("qmKey", Model.of(entity.getQModel().getNodeKey())));
    item.add(QMlink);
    
    item.add(new Label("value", Model.of(entity.getTargetValue())));
}
 
Example 17
Project: owsi-core-parent   File: NotTreatedObjectsPanel.java   View source code 6 votes vote down vote up
public NotTreatedObjectsPanel(String id, final IModel<ShowcaseBatchReportBean> reportBeanModel) {
	super(id, reportBeanModel);
	
	idsModel = new NotTreatedObjectsIdsModel(reportBeanModel);
	
	add(new CollectionView<Long>("notTreatedObjects", idsModel, Models.<Long>serializableModelFactory()) {
		private static final long serialVersionUID = 1L;
		
		@Override
		protected void populateItem(Item<Long> item) {
			IModel<Long> idModel = item.getModel();
			item.add(
					new Label("id", idModel),
					new CoreLabel("name", new NotTreatedObjectNameModel(reportBeanModel, idModel))
			);
		}
	});
}
 
Example 18
Project: owsi-core-parent   File: SequenceGridView.java   View source code 6 votes vote down vote up
@Override
protected final void populateItem(final Item<T> item) {
	RepeatingView cells = new RepeatingView(CELL_REPEATER_ID);
	item.add(cells);

	int populatorsNumber = populators.size();
	for (int i = 0; i < populatorsNumber; i++) {
		ICellPopulator<T> populator = populators.get(i);
		IModel<ICellPopulator<T>> populatorModel = new Model<>(populator);
		Item<ICellPopulator<T>> cellItem = newCellItem(cells.newChildId(), i, populatorModel);
		cells.add(cellItem);

		populator.populateItem(cellItem, CELL_ITEM_ID, item.getModel());

		if (cellItem.get("cell") == null) {
			throw new WicketRuntimeException(
					populator.getClass().getName()
					+ ".populateItem() failed to add a component with id [" + CELL_ITEM_ID + "] to the provided"
					+ " [cellItem] object. Make sure you call add() on cellItem and make sure you gave the added"
					+ " component passed in 'componentId' id."
					+ " (*cellItem*.add(new MyComponent(*componentId*, rowModel) )");
		}
	}
}
 
Example 19
Project: u-qasar.platform   File: AbstractSearchResultsPanel.java   View source code 6 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    entities = new DataView<T>("entities", getEntityProvider(), getItemsPerPage()) {
        private static final long serialVersionUID = 1918076240043442975L;

        @Override
        protected void populateItem(final Item<T> item) {
            populateDataViewItem(item);
        }
    };
    container.add(entities);
    container.add(new Label("table.head", new StringResourceModel("panel.title", this, null, Model.of(searchTerm))));
    tableFoot.add(new BootstrapAjaxPagingNavigator("navigatorFoot",
            entities));
}
 
Example 20
Project: u-qasar.platform   File: QMQualityObjectiveSearchResultsPanel.java   View source code 6 votes vote down vote up
@Override
protected void populateDataViewItem(Item<QMQualityObjective> item) {
    final QMQualityObjective entity = item.getModelObject();
   BookmarkablePageLink<QMQualityObjectiveEditPage> link = new BookmarkablePageLink<>("link",
            QMQualityObjectiveEditPage.class, QMQualityObjectiveEditPage.forQualityObjective(entity));
    link.add(new Label("name", Model.of(entity.getName()
            + " (" + entity.getNodeKey() + ")")).setRenderBodyOnly(true));
    item.add(link);
    
    BookmarkablePageLink<QModelViewPage> QMlink = new BookmarkablePageLink<>("qmodel",
    		QModelViewPage.class, QModelViewPage.forQModel(entity.getQModel()));
    QMlink.add(new Label("qmKey", Model.of(entity.getQModel().getNodeKey())));
    item.add(QMlink);
    
    item.add(new Label("value", Model.of(entity.getTargetValue())));
}
 
Example 21
Project: owsi-core-parent   File: CoreDataTable.java   View source code 6 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected Item newCellItem(final String id, final int index, final IModel model) {
	Item item = CoreDataTable.this.newCellItem(id, index, model);
	final ICellPopulator<T> column = internalGetPopulators().get(index);
	if (column instanceof IStyledColumn) {
		item.add(new ClassAttributeAppender(new AbstractReadOnlyModel<String>() {
			private static final long serialVersionUID = 1L;

			@Override
			public String getObject() {
				return ((IStyledColumn<T, S>) column).getCssClass();
			}
		}));
	}
	return item;
}
 
Example 22
Project: u-qasar.platform   File: MetricSearchResultsPanel.java   View source code 6 votes vote down vote up
@Override
protected void populateDataViewItem(Item<Metric> item) {
    final Metric entity = item.getModelObject();
    BookmarkablePageLink<MetricEditPage> link = new BookmarkablePageLink<>("link",
            MetricEditPage.class, MetricEditPage.forMetric(entity));
    link.add(new Label("name", Model.of(entity.getName()
            + " (" + entity.getNodeKey() + ")")).setRenderBodyOnly(true));
    item.add(link);
    
    BookmarkablePageLink<ProjectViewPage> projectLink = new BookmarkablePageLink<>("project",
            ProjectViewPage.class, ProjectViewPage.forProject(entity.getProject()));
    projectLink.add(new Label("projectKey", Model.of(entity.getProject().getNodeKey())));
    item.add(projectLink);
    
    item.add(new Label("source", Model.of(entity.getMetricSource())));
    item.add(new Label("value", Model.of(entity.getValue())));
}
 
Example 23
Project: u-qasar.platform   File: LdapUserListPanel.java   View source code 6 votes vote down vote up
@Override
public void populateItem(Item<LdapUser> item, Check<LdapUser> check) {
	LdapUser user = item.getModelObject();
	item.add(new Label("username", new PropertyModel(user, "userName")));
	item.add(new ExternalLink("mail", "mailto:" + user.getMail()).add(new Label("mailText", new PropertyModel(user, "mail"))));
	item.add(new Label("firstName", new PropertyModel(user, "firstName")));
	item.add(new Label("lastName", new PropertyModel(user, "lastName")));
	item.add(new Image("photo", user.hasProfilePicture() ? user.getProfilePictureImage() : anonymousPicture));
	if (isSelectionEnabled()) {
		if (userService.ldapBasedUserExists(user)) {
			check.setVisible(false);
			item.add(new AttributeAppender("class", Model.of("warning")));
			item.add(new AttributeAppender("title", new StringResourceModel("table.users.warning.exists", this, null)));
		} else {
			item.add(new AttributeAppender("class", Model.of("success")));
		}
	}
}
 
Example 24
Project: owsi-core-parent   File: ConsoleMaintenanceQueueManagerNodePanel.java   View source code 6 votes vote down vote up
public ConsoleMaintenanceQueueManagerNodePanel(String id) {
	super(id);
	setOutputMarkupId(true);

	nodesModel = new LoadableDetachableModel<List<INode>>() {
		private static final long serialVersionUID = 1L;
		@Override
		protected List<INode> load() {
			return infinispanClusterService.getAllNodes();
		}
	};

	add(
			new CollectionView<INode>("nodes", nodesModel, Models.<INode>serializableModelFactory()) {
				private static final long serialVersionUID = 1L;
				@Override
				protected void populateItem(Item<INode> item) {
					IModel<INode> nodeModel = item.getModel();
					item.add(
							new NodeFragment("node", nodeModel)
					);
				}
			}
	);
}
 
Example 25
Project: owsi-core-parent   File: TaskResultsPanel.java   View source code 6 votes vote down vote up
@Override
protected void addItemColumns(final Item<QueuedTaskHolder> item, IModel<? extends QueuedTaskHolder> itemModel) {
	item.setOutputMarkupId(true);
	
	Component queue = new CoreLabel("queue", BindingModel.of(itemModel, CoreJpaMoreBindings.queuedTaskHolder().queueId())).hideIfEmpty();
	item.add(
			new TaskStatusPanel("status", BindingModel.of(itemModel, CoreJpaMoreBindings.queuedTaskHolder().status())),
			new TaskResultPanel("result", BindingModel.of(itemModel, CoreJpaMoreBindings.queuedTaskHolder().result())),
			ConsoleMaintenanceTaskDescriptionPage.linkDescriptor(ReadOnlyModel.of(itemModel))
					.link("nameLink")
					.setBody(BindingModel.of(itemModel, CoreJpaMoreBindings.queuedTaskHolder().name())),
			queue,
			new PlaceholderContainer("defaultQueue").condition(Condition.componentVisible(queue)),
			new DateLabel("creationDate", BindingModel.of(itemModel, CoreJpaMoreBindings.queuedTaskHolder().creationDate()),
					DatePattern.SHORT_DATETIME),
			new DateLabel("startDate", BindingModel.of(itemModel, CoreJpaMoreBindings.queuedTaskHolder().startDate()),
					DatePattern.SHORT_DATETIME),
			new DateLabel("endDate", BindingModel.of(itemModel, CoreJpaMoreBindings.queuedTaskHolder().endDate()),
					DatePattern.SHORT_DATETIME));
}
 
Example 26
Project: oldSyncopeIdM   File: DatePropertyColumn.java   View source code 6 votes vote down vote up
@Override
public void populateItem(final Item<ICellPopulator<T>> item,
        final String componentId, final IModel<T> rowModel) {

    IModel date = (IModel<Date>) createLabelModel(rowModel);

    String convertedDate = "";

    if (date.getObject() != null) {
        convertedDate = SyncopeSession.get().
                getDateFormat().format(date.getObject());
        item.add(new Label(componentId, convertedDate));
    } else {
        item.add(new Label(componentId, convertedDate));
    }
}
 
Example 27
Project: u-qasar.platform   File: LdapGroupListPanel.java   View source code 6 votes vote down vote up
@Override
public void populateItem(Item<LdapGroup> item, Check<LdapGroup> check) {
	LdapGroup group = item.getModelObject();
	item.add(new Label("name", new PropertyModel(group, "name")));
	item.add(new Label("description", new PropertyModel(group, "description")));
	item.add(newGroupMembersContainer("members", group));

	if (isSelectionEnabled()) {
		if (teamService.ldapBasedGroupExists(group)) {
			check.setVisible(false);
			item.add(new AttributeAppender("class", Model.of("warning")));
			item.add(new AttributeAppender("title", new StringResourceModel("table.team.warning.exists", this, null)));
		} else {
			item.add(new AttributeAppender("class", Model.of("success")));
		}
	}
}
 
Example 28
Project: invesdwin-nowicket   File: StockChart.java   View source code 6 votes vote down vote up
public StockChart(final String id, final IModel<StockOptions> options, final IModel<Theme> theme) {
    super(id);
    this.options = options;
    this.theme = theme;
    HighstockWebjarInitializer.assertInitialized();
    add(new RefreshingView<StockOptions>("panels") {

        @Override
        protected Iterator<IModel<StockOptions>> getItemModels() {
            return Arrays.asList(options).iterator();
        }

        @Override
        protected void populateItem(final Item<StockOptions> item) {

            item.add(new RefreshingStockChart("panel", item.getModel(), theme));
        }
    });
}
 
Example 29
Project: lumen   File: LinkColumn.java   View source code 6 votes vote down vote up
@Override
	public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
//		log.debug("paramEx '{}' - paramName", paramExpression, paramName);
		
		@Nullable
		final Object paramValue = new PropertyModel<>(model, paramExpression).getObject();
//				"Cannot get '%s' parameter because of null '%s' in %s",
//				paramName, paramExpression, model.getObject());
		if (paramValue != null) {
			final PageParameters params = new PageParameters(paramsTemplate)
					.add(paramName, paramValue);
//			final LinkPanel<T, S> linkPanel = new LinkPanel<T, S>(componentId, pageClass, params,
//					labelModel.or((IModel) getDataModel(model)), tagType);
			final LinkPanel<T, S> linkPanel = new LinkPanel<T, S>(componentId, pageClassModel.getObject(), params,
					labelModel.or((IModel) getDataModel(model)), tagType);
			if (enabled != null) {
				linkPanel.setEnabled(enabled.apply(model.getObject()));
			}
			item.add(linkPanel);
		} else {
			item.add(new Label(componentId));
		}
		if (cssClass != null) {
			item.add(new AttributeAppender("class", new Model<>(cssClass), " "));
		}
	}
 
Example 30
Project: wicket-spring-boot   File: CustomerListIntTest.java   View source code 6 votes vote down vote up
@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 31
Project: wicket-spring-boot   File: CustomerListPageTest.java   View source code 6 votes vote down vote up
@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 32
Project: artifactory   File: GroupPermissionsPanel.java   View source code 6 votes vote down vote up
private SortableTable addTable() {
    List<IColumn<PermissionsRow>> columns = Lists.newArrayList();

    columns.add(new AbstractColumn<PermissionsRow>(
            Model.of("Permission Target"), "permissionTarget.name") {
        @Override
        public void populateItem(Item cellItem, String componentId, IModel rowModel) {
            cellItem.add(new LinkPanel(componentId, rowModel));
        }
    });

    columns.add(new BooleanColumn<PermissionsRow>("Manage", "manage", "manage"));
    columns.add(new BooleanColumn<PermissionsRow>("Delete", "delete", "delete"));
    columns.add(new BooleanColumn<PermissionsRow>("Deploy", "deploy", "deploy"));
    columns.add(new BooleanColumn<PermissionsRow>("Annotate", "annotate", "annotate"));
    columns.add(new BooleanColumn<PermissionsRow>("Read", "read", "read"));
    PermissionsTabTableDataProvider dataProvider = new PermissionsTabTableDataProvider(groupInfo);
    return new SortableTable<>("userPermissionsTable", columns, dataProvider, 10);
}
 
Example 33
Project: artifactory   File: UserPermissionsPanel.java   View source code 6 votes vote down vote up
private SortableTable addTable() {
    List<IColumn<PermissionsRow>> columns = Lists.newArrayList();
    columns.add(
            new AbstractColumn<PermissionsRow>(Model.of("Permission Target"), "permissionTarget.name") {
                @Override
                public void populateItem(Item<ICellPopulator<PermissionsRow>> cellItem, String componentId,
                        IModel<PermissionsRow> rowModel) {
                    cellItem.add(new LinkPanel(componentId, rowModel));
                }
            });

    columns.add(new BooleanColumn<PermissionsRow>("Manage", "manage", "manage"));
    columns.add(new BooleanColumn<PermissionsRow>("Delete", "delete", "delete"));
    columns.add(new BooleanColumn<PermissionsRow>("Deploy", "deploy", "deploy"));
    columns.add(new BooleanColumn<PermissionsRow>("Annotate", "annotate", "annotate"));
    columns.add(new BooleanColumn<PermissionsRow>("Read", "read", "read"));

    PermissionsTabTableDataProvider dataProvider = new PermissionsTabTableDataProvider(userInfo);
    return new SortableTable<>("userPermissionsTable", columns, dataProvider, 10);
}
 
Example 34
Project: artifactory   File: ArchiveSearchPanel.java   View source code 6 votes vote down vote up
@SuppressWarnings({"unchecked"})
@Override
public void populateItem(final Item cellItem, String componentId, IModel model) {
    final ActionableArchiveSearchResult result =
            (ActionableArchiveSearchResult) cellItem.getParent().getParent().getDefaultModelObject();
    final String relDirPath = result.getSearchResult().getRelDirPath();
    Link linkToTreeView = new Link<String>(componentId, Model.of(relDirPath)) {
        @Override
        public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
            replaceComponentTagBody(markupStream, openTag, relDirPath);
        }

        @Override
        public void onClick() {
            RequestCycle.get().setResponsePage(new BrowseRepoPage(result.getArchiveRepoPath()));
        }
    };
    linkToTreeView.add(new CssClass("item-link"));
    cellItem.add(linkToTreeView);
}
 
Example 35
Project: artifactory   File: ModuleArtifactPropertyColumn.java   View source code 6 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<ModuleArtifactActionableItem>> item, String componentId,
        final IModel<ModuleArtifactActionableItem> model) {
    item.add(new Label(componentId, createLabelModel(model)) {
        @Override
        protected void onBeforeRender() {
            super.onBeforeRender();
            BuildsDiffStatus status = model.getObject().getStatus();
            if (BuildsDiffStatus.NEW.equals(status)) {
                add(new CssClass("green-listed-label"));
            } else if (BuildsDiffStatus.UPDATED.equals(status)) {
                add(new CssClass("blue-listed-label"));
            } else if (BuildsDiffStatus.REMOVED.equals(status)) {
                add(new CssClass("light-gray-listed-label"));
            }
        }
    });
}
 
Example 36
Project: artifactory   File: ModuleDependencyGroupableColumn.java   View source code 6 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<ModuleDependencyActionableItem>> item, String componentId,
        final IModel<ModuleDependencyActionableItem> model) {
    item.add(new Label(componentId, createLabelModel(model)) {
        @Override
        protected void onBeforeRender() {
            super.onBeforeRender();
            BuildsDiffStatus status = model.getObject().getStatus();
            if (BuildsDiffStatus.NEW.equals(status)) {
                add(new CssClass("green-listed-label"));
            } else if (BuildsDiffStatus.UPDATED.equals(status)) {
                add(new CssClass("blue-listed-label"));
            } else if (BuildsDiffStatus.REMOVED.equals(status)) {
                add(new CssClass("light-gray-listed-label"));
            }
        }
    });
}
 
Example 37
Project: artifactory   File: ModuleArtifactGroupableColumn.java   View source code 6 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<ModuleArtifactActionableItem>> item, String componentId,
        final IModel<ModuleArtifactActionableItem> model) {
    item.add(new Label(componentId, createLabelModel(model)) {
        @Override
        protected void onBeforeRender() {
            super.onBeforeRender();
            BuildsDiffStatus status = model.getObject().getStatus();
            if (BuildsDiffStatus.NEW.equals(status)) {
                add(new CssClass("green-listed-label"));
            } else if (BuildsDiffStatus.UPDATED.equals(status)) {
                add(new CssClass("blue-listed-label"));
            } else if (BuildsDiffStatus.REMOVED.equals(status)) {
                add(new CssClass("light-gray-listed-label"));
            }
        }
    });
}
 
Example 38
Project: artifactory   File: BuildDiffGroupableColumn.java   View source code 6 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<BuildsDiffActionableItem>> item, String componentId,
        final IModel<BuildsDiffActionableItem> model) {
    item.add(new Label(componentId, createLabelModel(model)) {
        @Override
        protected void onBeforeRender() {
            super.onBeforeRender();
            BuildsDiffStatus status = model.getObject().getStatus();
            if (BuildsDiffStatus.NEW.equals(status)) {
                add(new CssClass("green-listed-label"));
            } else if (BuildsDiffStatus.UPDATED.equals(status)) {
                add(new CssClass("blue-listed-label"));
            } else if (BuildsDiffStatus.REMOVED.equals(status)) {
                add(new CssClass("light-gray-listed-label"));
            }
        }
    });
}
 
Example 39
Project: artifactory   File: BuildDiffPropertyColumn.java   View source code 6 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<BuildsDiffActionableItem>> item, String componentId,
        final IModel<BuildsDiffActionableItem> model) {
    item.add(new Label(componentId, createLabelModel(model)) {
        @Override
        protected void onBeforeRender() {
            super.onBeforeRender();
            BuildsDiffStatus status = model.getObject().getStatus();
            if (BuildsDiffStatus.NEW.equals(status)) {
                add(new CssClass("green-listed-label"));
            } else if (BuildsDiffStatus.UPDATED.equals(status)) {
                add(new CssClass("blue-listed-label"));
            } else if (BuildsDiffStatus.REMOVED.equals(status)) {
                add(new CssClass("light-gray-listed-label"));
            }
        }
    });
}
 
Example 40
Project: artifactory   File: DeletableLabelGroup.java   View source code 6 votes vote down vote up
public DeletableLabelGroup(String id, IModel<Collection<T>> collectionModel, IChoiceRenderer<T> renderer) {
    super(id, collectionModel);
    setRenderer(renderer);
    setOutputMarkupId(true);

    dataView = new DataView<T>("item", new LabelsDataProvider()) {
        @Override
        protected void populateItem(Item<T> item) {
            final T value = item.getModelObject();
            String itemText = getDisplayValue(value);
            item.add(newLabel(value, itemText));
        }
    };
    add(dataView);
    add(new MoreIndicator("more"));
}