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

The following examples show how to use org.apache.wicket.markup.repeater.Item. These examples are extracted from open source projects. 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 Project: JPPF   Source File: HealthPage.java    License: Apache License 2.0 6 votes vote down vote up
@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 2
Source Project: nextreports-server   Source File: CheckTablePanel.java    License: Apache License 2.0 6 votes vote down vote up
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 3
Source Project: JPPF   Source File: TopologyPage.java    License: Apache License 2.0 6 votes vote down vote up
@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 4
@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 5
Source Project: nextreports-server   Source File: CheckTablePanel.java    License: Apache License 2.0 6 votes vote down vote up
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 6
Source Project: nextreports-server   Source File: AjaxCheckTablePanel.java    License: Apache License 2.0 6 votes vote down vote up
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 7
Source Project: wicket-spring-boot   Source File: CustomerListIntTest.java    License: Apache License 2.0 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 8
Source Project: wicket-spring-boot   Source File: CustomerListPageTest.java    License: Apache License 2.0 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 9
Source Project: Orienteer   Source File: DeleteRowCommandColumn.java    License: Apache License 2.0 6 votes vote down vote up
@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 10
Source Project: nextreports-server   Source File: AnalysisTablePanel.java    License: Apache License 2.0 6 votes vote down vote up
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 11
@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 12
Source Project: syncope   Source File: ParametersDirectoryPanel.java    License: Apache License 2.0 6 votes vote down vote up
@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 13
Source Project: syncope   Source File: ConnObjectAttrColumn.java    License: Apache License 2.0 6 votes vote down vote up
@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 14
@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 15
@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 16
Source Project: Orienteer   Source File: SchemaOClassesModalPanel.java    License: Apache License 2.0 6 votes vote down vote up
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 17
Source Project: Orienteer   Source File: EmbeddedCollectionFilterPanel.java    License: Apache License 2.0 6 votes vote down vote up
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 18
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 19
Source Project: JPPF   Source File: StatisticsTablePanel.java    License: Apache License 2.0 5 votes vote down vote up
@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 20
Source Project: JPPF   Source File: JobsPage.java    License: Apache License 2.0 5 votes vote down vote up
@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 AbstractJobComponent comp = (AbstractJobComponent) 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 instanceof Job) || (comp instanceof JobDispatch)) cssClass += "node_up " + getCssClass();
  else if (!selected) cssClass += "empty";
  if (selected) cssClass += "tree_selected";
  cellItem.add(new AttributeModifier("class", cssClass));
}
 
Example 21
public void populateItem(Item<ICellPopulator<T>> item, String componentId, final IModel<T> rowModel) {
    item.add(new AbstractImagePanel(componentId) {

        @Override
        public String getImageName() {
            if ((Boolean) PropertyResolver.getValue(getPropertyExpression(), rowModel.getObject())) {                	             	
                return "images/sortascend.png";
            } else {
                return "images/sortdescend.png";
            }
        }
    });
}
 
Example 22
Source Project: nextreports-server   Source File: ActivePropertyColumn.java    License: Apache License 2.0 5 votes vote down vote up
public void populateItem(Item<ICellPopulator<Entity>> item,
                          String componentId, final IModel<Entity> rowModel) {

     SchedulerJob job = (SchedulerJob) rowModel.getObject();
     final boolean active;
     Date now = new Date();
     if (ScheduleConstants.ONCE_TYPE.equals(job.getTime().getType())) {
         active = job.getTime().getRunDate().compareTo(now) >= 0;
     } else {
         active = (job.getTime().getStartActivationDate().compareTo(now) <= 0) &&
                 (job.getTime().getEndActivationDate().compareTo(now) >= 0);
     }

     item.add(new AbstractImagePanel(componentId) {

private static final long serialVersionUID = 1L;

@Override
         public String getImageName() {
             if (active) {
             	String theme = settings.getSettings().getColorTheme();
                 return "images/" + ThemesManager.getTickImage(theme, (NextServerApplication)getApplication());
             } else {
                 return "images/delete.gif";
             }
         }

     });
 }
 
Example 23
Source Project: inception   Source File: QualifierFeatureEditor.java    License: Apache License 2.0 5 votes vote down vote up
private void setSelectedKBItem(KBHandle value, Item<LinkWithRoleModel> aItem,
    AnnotationFeature linkedAnnotationFeature)
{
    if (aItem.getModelObject().targetAddr != -1) {
        try {
            CAS cas = actionHandler.getEditorCas();
            FeatureStructure selectedFS = selectFsByAddr(cas,
                    aItem.getModelObject().targetAddr);
            WebAnnoCasUtil.setFeature(selectedFS, linkedAnnotationFeature,
                value != null ? value.getIdentifier() : value);
            LOG.info("change the value");
            qualifierModel.detach();

            // Save the CAS. This must be done explicitly here since the KBItem dropdown
            // is not the focus-component of this editor. In fact, there could be multiple
            // KBItem dropdowns in this feature editor since we can have multilpe modifiers.
            // For focus-components, the AnnotationFeatureForm already handles adding the
            // saving behavior.
            actionHandler.actionCreateOrUpdate(
                    RequestCycle.get().find(AjaxRequestTarget.class).get(), cas);
        }
        catch (Exception e) {
            LOG.error("Error: " + e.getMessage(), e);
            error("Error: " + e.getMessage());
        }
    }
}
 
Example 24
Source Project: nextreports-server   Source File: EntityBrowserPanel.java    License: Apache License 2.0 5 votes vote down vote up
private void selectEntity(Entity entity, Item<Entity> item, String sectionId) {
	SectionContext sectionContext = NextServerSession.get().getSectionContext(sectionId);
	if (sectionContext == null) {
		return;
	}

    String entityPath = SectionContextUtil.getSelectedEntityPath(sectionId);
    if ((entityPath != null) && entity.getPath().equals(entityPath)) {
        item.add(AttributeModifier.replace("class", "tr-selected"));
        // reset
        SectionContextUtil.setSelectedEntityPath(sectionId, null);
    }
}
 
Example 25
Source Project: Orienteer   Source File: OClusterSecurityWidget.java    License: Apache License 2.0 5 votes vote down vote up
public OClusterSecurityWidget(String id, IModel<OCluster> model,
                                 IModel<ODocument> widgetDocumentModel) {
	super(id, model, widgetDocumentModel);

	List<IColumn<ORole, String>> sColumns = new ArrayList<IColumn<ORole,String>>();
	OClass oRoleClass = OrientDbWebSession.get().getDatabase().getMetadata().getSchema().getClass("ORole");
	sColumns.add(new AbstractColumn<ORole, String>(new OClassNamingModel(oRoleClass), "name") {

		@Override
		public void populateItem(Item<ICellPopulator<ORole>> cellItem,
				String componentId, IModel<ORole> rowModel) {
			cellItem.add(new LinkViewPanel(componentId, new PropertyModel<ODocument>(rowModel, "document")));
		}
	});
	sColumns.add(new SecurityRightsColumn(OrientPermission.CREATE));
	sColumns.add(new SecurityRightsColumn(OrientPermission.READ));
	sColumns.add(new SecurityRightsColumn(OrientPermission.UPDATE));
	sColumns.add(new SecurityRightsColumn(OrientPermission.DELETE));
	
	OQueryDataProvider<ORole> sProvider = new OQueryDataProvider<ORole>("select from ORole", ORole.class);
	sProvider.setSort("name", SortOrder.ASCENDING);
	GenericTablePanel<ORole> tablePanel = new GenericTablePanel<ORole>("tablePanel", sColumns, sProvider ,20);
	OSecurityHelper.secureComponent(tablePanel, OSecurityHelper.requireOClass("ORole", Component.ENABLE, OrientPermission.UPDATE));

	OrienteerDataTable<ORole, String> sTable = tablePanel.getDataTable();
	Command<ORole> saveCommand = new AbstractSaveCommand<ORole>(sTable, null);
	sTable.addCommand(saveCommand);
	sTable.setCaptionModel(new ResourceModel("cluster.security"));
	add(tablePanel);
	add(DisableIfPrototypeBehavior.INSTANCE, UpdateOnActionPerformedEventBehavior.INSTANCE_ALL_CONTINUE);
}
 
Example 26
private void setRejectSaveLinksFragmentVisibility(final String id, final Item<GanttTreeTableNode> row, final int col,
    final boolean visible)
{
  final RejectSaveLinksFragment rejectSaveFragment = (RejectSaveLinksFragment) row.get(id);
  if (rejectSaveColumnVisible[col] == false) {
    rejectSaveFragment.setVisible(false);
  } else {
    rejectSaveFragment.setVisible(true);
    rejectSaveFragment.setIconsVisible(visible);
  }
}
 
Example 27
Source Project: artifact-listener   Source File: UserPortfolioPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void addItemColumns(Item<User> item, IModel<? extends User> userModel) {
	Link<Void> userNameLink = AdministrationUserDescriptionPage.linkDescriptor(ReadOnlyModel.of(userModel)).link("userNameLink");
	userNameLink.add(new Label("userName", BindingModel.of(userModel, Binding.user().userName())));
	item.add(userNameLink);
	item.add(new Label("fullName", BindingModel.of(userModel, Binding.user().fullName())));
	item.add(new BooleanIcon("active", BindingModel.of(userModel, Binding.user().active())));
	item.add(new EmailLink("email", BindingModel.of(userModel, Binding.user().email())));
}
 
Example 28
Source Project: onedev   Source File: SelectionColumn.java    License: MIT License 5 votes vote down vote up
public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
	cellItem.add(new RowSelector<T>(componentId, rowModel) {

		@Override
		protected Set<IModel<T>> getSelections() {
			return selections;
		}

		@Override
		protected void onSelectionChange(AjaxRequestTarget target) {
			SelectionColumn.this.onSelectionChange(target);
		}
		
	});
}
 
Example 29
Source Project: the-app   Source File: ProductItemListPanel.java    License: Apache License 2.0 5 votes vote down vote up
private DataView<ProductInfo> productList(final String parentTag) {
    DataView<ProductInfo> productsView = new DataView<ProductInfo>("products", productsProvider()) {
        @Override
        protected void populateItem(Item<ProductInfo> item) {
            item.add(newProductItemPanel("product", parentTag, item.getModel()));
        }
    };
    productsView.add(new HighLightBehavior());
    return productsView;
}
 
Example 30
Source Project: webanno   Source File: LinkFeatureEditor.java    License: Apache License 2.0 5 votes vote down vote up
private void actionToggleArmedState(AjaxRequestTarget aTarget, Item<LinkWithRoleModel> aItem)
{
    AnnotatorState state = LinkFeatureEditor.this.stateModel.getObject();

    if (state.isArmedSlot(getModelObject(), aItem.getIndex())) {
        state.clearArmedSlot();
        aTarget.add(content);
    }
    else {
        state.setArmedSlot(getModelObject(), aItem.getIndex());
        // Need to re-render the whole form because a slot in another
        // link editor might get unarmed
        aTarget.add(getOwner());
    }
}