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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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"));
}
 
Example 41
Project: GeoCrawler   File: CrawlsPage.java   Source Code and License 5 votes vote down vote up
public CrawlsPage() {
  crawlsTable = new WebMarkupContainer("crawlsTable");
  crawlsTable.setOutputMarkupId(true);
  crawlsTable.add(new AjaxSelfUpdatingTimerBehavior(UPDATE_TIMEOUT));

  RefreshingView<Crawl> crawls = new RefreshingView<Crawl>("crawls") {

    @Override
    protected Iterator<IModel<Crawl>> getItemModels() {
      return new CpmIteratorAdapter<Crawl>(crawlService.getCrawls());
    }

    @Override
    protected void populateItem(Item<Crawl> item) {
      populateCrawlRow(item);
    }
  };

  crawlsTable.add(crawls);
  add(crawlsTable);

  crawlPanel = new CrawlPanel("crawl");
  add(crawlPanel);

  add(new AjaxLink<Crawl>("newCrawl") {
    @Override
    public void onClick(AjaxRequestTarget target) {
      editCrawl(target, new CompoundPropertyModel<Crawl>(createNewCrawl()));
    }
  });
}
 
Example 42
Project: GeoCrawler   File: SeedListsPage.java   Source Code and License 5 votes vote down vote up
public SeedListsPage() {

    RefreshingView<SeedList> seedLists = new RefreshingView<SeedList>(
        "seedLists") {

      @Override
      protected Iterator<IModel<SeedList>> getItemModels() {
        return new CpmIteratorAdapter<SeedList>(seedListService.findAll());
      }

      @Override
      protected void populateItem(final Item<SeedList> item) {
        PageParameters params = new PageParameters();
        params.add("id", item.getModelObject().getId());

        Link<Void> edit = new BookmarkablePageLink<Void>("edit",
            SeedPage.class, params);
        edit.add(new Label("name"));
        item.add(edit);

        item.add(new Label("seedUrlsCount"));

        item.add(new Link<SeedList>("delete", item.getModel()) {
          @Override
          public void onClick() {
            seedListService.delete(item.getModelObject().getId());
          }
        });
      }
    };

    add(seedLists);
    add(new BookmarkablePageLink<Void>("newSeedList", SeedPage.class));
  }
 
Example 43
Project: GeoCrawler   File: SeedPage.java   Source Code and License 5 votes vote down vote up
private void addSeedUrlsList() {
  seedUrlsTable = new WebMarkupContainer("seedUrlsTable");
  seedUrlsTable.setOutputMarkupId(true);

  RefreshingView<SeedUrl> seedUrls = new RefreshingView<SeedUrl>("seedUrls") {

    @Override
    protected Iterator<IModel<SeedUrl>> getItemModels() {
      return new CpmIteratorAdapter<SeedUrl>(getModelObject().getSeedUrls());
    }

    @Override
    protected void populateItem(Item<SeedUrl> item) {
      item.add(new Label("url"));
      item.add(new AjaxLink<SeedUrl>("delete", item.getModel()) {

        @Override
        public void onClick(AjaxRequestTarget target) {
          deleteSeedUrl(getModelObject());
          target.add(seedUrlsTable);
        }
      });
    }
  };
  seedUrlsTable.add(seedUrls);
  add(seedUrlsTable);
}
 
Example 44
Project: engerek   File: BoxedTablePanel.java   Source Code and License 5 votes vote down vote up
private void initLayout(List<IColumn<T, String>> columns, ISortableDataProvider provider, int pageSize) {
       setOutputMarkupId(true);
	WebMarkupContainer box = new WebMarkupContainer(ID_BOX);
	box.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {
		private static final long serialVersionUID = 1L;

		@Override
		public String getObject() {
			String boxCssClasses = getAdditionalBoxCssClasses();
			if (boxCssClasses == null) {
				return "";
			} else {
				return " " + boxCssClasses;
			}
		}
	}));
	add(box);

	WebMarkupContainer tableContainer = new WebMarkupContainer(ID_TABLE_CONTAINER);
	tableContainer.setOutputMarkupId(true);

	DataTable<T, String> table = new SelectableDataTable<T>(ID_TABLE, columns, provider, pageSize) {
		@Override
		protected Item<T> newRowItem(String id, int index, IModel<T> rowModel) {
			Item<T> item = super.newRowItem(id, index, rowModel);
			return customizeNewRowItem(item, rowModel);
		}
	};
	table.setOutputMarkupId(true);
	tableContainer.add(table);
	box.add(tableContainer);

	TableHeadersToolbar headersTop = new TableHeadersToolbar(table, provider);
	headersTop.setOutputMarkupId(true);
	table.addTopToolbar(headersTop);

	box.add(createHeader(ID_HEADER));
	box.add(createFooter(ID_FOOTER));
}
 
Example 45
Project: engerek   File: LinkIconColumn.java   Source Code and License 5 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, final IModel<T> rowModel) {
    cellItem.add(new LinkIconPanel(componentId, createIconModel(rowModel), createTitleModel(rowModel)) {

        @Override
        protected void onClickPerformed(AjaxRequestTarget target) {
            LinkIconColumn.this.onClickPerformed(target, rowModel, getLink());
        }
    });
}
 
Example 46
Project: engerek   File: EditableLinkColumn.java   Source Code and License 5 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId,
        final IModel<T> rowModel) {
    Editable editable = rowModel.getObject();
    if (!editable.isEditing()) {
        super.populateItem(cellItem, componentId, rowModel);
    } else {
        cellItem.add(createInputPanel(componentId, rowModel));
    }
}
 
Example 47
Project: engerek   File: EditableCheckboxColumn.java   Source Code and License 5 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId,
                         final IModel<T> rowModel) {

    if (!isEditing(rowModel)) {
        super.populateItem(cellItem, componentId, rowModel);
    } else {
        cellItem.add(createInputPanel(componentId, rowModel));
    }
}
 
Example 48
Project: engerek   File: EditablePropertyColumn.java   Source Code and License 5 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId,
        final IModel<T> rowModel) {

    if (!isEditing(rowModel)) {
        super.populateItem(cellItem, componentId, rowModel);
    } else {
        cellItem.add(createInputPanel(componentId, rowModel));
    }
}
 
Example 49
Project: engerek   File: SingleButtonColumn.java   Source Code and License 5 votes vote down vote up
@Override
public void populateItem(final Item<ICellPopulator<T>> cellItem, String componentId,
                         final IModel<T> rowModel){
    this.rowModel = rowModel;

    panel = new SingleButtonPanel<T>(componentId, rowModel){

        @Override
        public String getButtonCssSizeClass(){
            return SingleButtonColumn.this.getButtonCssSizeClass();
        }

        @Override
        public String getButtonCssColorClass(){
            return SingleButtonColumn.this.getButtonCssColorClass();
        }

        @Override
        public String getCaption(){
            return SingleButtonColumn.this.getCaption();
        }

        @Override
        public void clickPerformed(AjaxRequestTarget target, IModel<T> model){
            SingleButtonColumn.this.clickPerformed(target, model);
        }

        @Override
        public boolean isEnabled(IModel<T> model){
            return isButtonEnabled(model);
        }

        @Override
        public boolean isVisible(IModel<T> model){
            return isButtonVisible(model);
        }
    };
    cellItem.add(panel);
}
 
Example 50
Project: engerek   File: InlineMenuColumn.java   Source Code and License 5 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId,
                         IModel<T> rowModel) {

    cellItem.add(new com.evolveum.midpoint.web.component.menu.cog.InlineMenu(componentId,
            createMenuModel(rowModel)));
}
 
Example 51
Project: engerek   File: SelectableDataTable.java   Source Code and License 5 votes vote down vote up
@Override
protected Item<T> newRowItem(String id, int index, final IModel<T> model) {
    final Item<T> rowItem = new SelectableRowItem<T>(id, index, model);

    rowItem.setOutputMarkupId(true);
    return rowItem;
}
 
Example 52
Project: engerek   File: WorkItemsPanel.java   Source Code and License 5 votes vote down vote up
@Override
             public void populateItem(Item<ICellPopulator<WorkItemDto>> cellItem, String componentId, final IModel<WorkItemDto> rowModel) {
                     cellItem.add(new DateLabelComponent(componentId, new AbstractReadOnlyModel<Date>() {

                         @Override
                         public Date getObject() {
                             return rowModel.getObject().getCreatedDate();
                         }
                     }, DateLabelComponent.LONG_MEDIUM_STYLE));
                 }
         });
columns.add(new AbstractColumn<WorkItemDto, String>(createStringResource("WorkItemsPanel.deadline")){
 
Example 53
Project: engerek   File: WorkItemsPanel.java   Source Code and License 5 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<WorkItemDto>> cellItem, String componentId, final IModel<WorkItemDto> rowModel) {
        cellItem.add(new DateLabelComponent(componentId, new AbstractReadOnlyModel<Date>() {
            @Override
            public Date getObject() {
                return rowModel.getObject().getDeadlineDate();
            }
        }, DateLabelComponent.LONG_MEDIUM_STYLE));
    }
 
Example 54
Project: engerek   File: WorkItemsPanel.java   Source Code and License 5 votes vote down vote up
@Override
public void populateItem(Item<ICellPopulator<WorkItemDto>> item, String componentId,
		final IModel<WorkItemDto> rowModel) {
	item.add(new Label(componentId, new AbstractReadOnlyModel<Object>() {
		@Override
		public Object getObject() {
			return rowModel.getObject().getName();
		}
	}));
}
 
Example 55
Project: engerek   File: CertDecisionHelper.java   Source Code and License 5 votes vote down vote up
<T extends CertCaseOrWorkItemDto> IColumn<T, String> createTypeColumn(final WhichObject which, final PageBase page) {
    IColumn column;
    column = new IconColumn<CertCaseOrWorkItemDto>(page.createStringResource("")) {
        @Override
        protected IModel<String> createIconModel(IModel<CertCaseOrWorkItemDto> rowModel) {
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(which, rowModel);
            String icon = guiDescriptor != null ? guiDescriptor.getBlackIcon() : ObjectTypeGuiDescriptor.ERROR_ICON;
            return new Model<>(icon);
        }

        private ObjectTypeGuiDescriptor getObjectTypeDescriptor(WhichObject which, IModel<CertCaseOrWorkItemDto> rowModel) {
            QName targetType = rowModel.getObject().getObjectType(which);
            return ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(targetType));
        }

        @Override
        public void populateItem(Item<ICellPopulator<CertCaseOrWorkItemDto>> item, String componentId, IModel<CertCaseOrWorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(which, rowModel);
            if (guiDescriptor != null) {
                item.add(AttributeModifier.replace("title", page.createStringResource(guiDescriptor.getLocalizationKey())));
                item.add(new TooltipBehavior());
            }
        }
    };
    return column;
}
 
Example 56
Project: engerek   File: CertDecisionHelper.java   Source Code and License 5 votes vote down vote up
<T extends CertCaseOrWorkItemDto> IColumn<T, String> createDetailedInfoColumn(final PageBase page) {
    IColumn column;
    column = new IconColumn<CertCaseOrWorkItemDto>(page.createStringResource("")) {

        @Override
        protected IModel<String> createIconModel(final IModel<CertCaseOrWorkItemDto> rowModel) {
            return new AbstractReadOnlyModel<String>() {
                @Override
                public String getObject() {
                    return "fa fa-fw fa-info-circle text-info";
                }
            };
        }

        @Override
        public void populateItem(Item<ICellPopulator<CertCaseOrWorkItemDto>> item, String componentId, IModel<CertCaseOrWorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            CertCaseOrWorkItemDto aCase = rowModel.getObject();
            String handlerUri;
            if (aCase instanceof CertWorkItemDto) {
                handlerUri = aCase.getHandlerUri();
            } else {
                handlerUri = ((PageCertCampaign) page).getCampaignHandlerUri();
            }
            CertGuiHandler handler = CertGuiHandlerRegistry.instance().getHandler(handlerUri);
            if (handler != null) {
                String title = handler.getCaseInfoButtonTitle(rowModel, page);
                item.add(AttributeModifier.replace("title", title));
                item.add(new TooltipBehavior());
            }
        }
    };
    return column;
}
 
Example 57
Project: engerek   File: ProcessInstancesPanel.java   Source Code and License 5 votes vote down vote up
private void initLayout(UserProfileStorage.TableId tableId, int pageSize, View view, final IModel<String> currentInstanceIdModel) {
	BoxedTablePanel<ProcessInstanceDto> table = new BoxedTablePanel<ProcessInstanceDto>(
			ID_REQUESTS_TABLE, provider, initColumns(view), tableId, pageSize) {

		@Override
		protected Item<ProcessInstanceDto> customizeNewRowItem(Item<ProcessInstanceDto> item,
															   final IModel<ProcessInstanceDto> rowModel) {

			item.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

				@Override
				public String getObject() {
					if (currentInstanceIdModel == null || currentInstanceIdModel.getObject() == null) {
						return "";
					}
					ProcessInstanceDto rowDto = rowModel.getObject();
					if (currentInstanceIdModel.getObject().equals(rowDto.getProcessInstanceId())) {
						return "info";
					} else {
						return "";
					}
				}
			}));
			return item;
		}
	};
	table.setOutputMarkupId(true);
	table.setAdditionalBoxCssClasses("without-box-header-top-border");
	add(table);
}
 
Example 58
Project: engerek   File: AuditLogViewerPanel.java   Source Code and License 5 votes vote down vote up
private void createReferenceColumn(ObjectReferenceType ref, Item item, String componentId) {
    String name = WebModelServiceUtils.resolveReferenceName(ref, pageBase,
            pageBase.createSimpleTask(OPERATION_RESOLVE_REFENRENCE_NAME),
            new OperationResult(OPERATION_RESOLVE_REFENRENCE_NAME));
    item.add(new Label(componentId, name));
    item.add(new AttributeModifier("style", new Model<String>("width: 10%;")));
}
 
Example 59
Project: engerek   File: PageAuditLogDetails.java   Source Code and License 5 votes vote down vote up
protected void rowItemClickPerformed(AjaxRequestTarget target,
                                     Item<AuditEventRecordType> item, final IModel<AuditEventRecordType> rowModel){
    recordModel.setObject(rowModel.getObject());
    AuditLogStorage storage = getSessionStorage().getAuditLog();
    storage.setAuditRecord(rowModel.getObject());
    WebMarkupContainer eventPanel = (WebMarkupContainer)PageAuditLogDetails.this.get(ID_EVENT_PANEL);
    initAuditLogHistoryPanel(eventPanel);
    initEventPanel(eventPanel);
    initDeltasPanel(eventPanel);
    target.add(eventPanel);

}
 
Example 60
Project: vlo-curation   File: SearchResultItemPanel.java   Source Code and License 5 votes vote down vote up
@Override
protected void populateItem(Item<ResourceTypeCount> item) {
    final Link resourceLink = new RecordPageLink("recordLink", documentModel, selectionModel, RecordPage.RESOURCES_SECTION);
    item.add(resourceLink
            .add(new Label("resourceCountLabel", new PropertyModel<String>(item.getModel(), "count")))
            .add(new ResourceTypeGlyphicon("resourceTypeIcon", new PropertyModel<String>(item.getModel(), "resourceType")))
            .add(new AttributeModifier("title", getResourceCountModel(item.getModel())))
    );
}