List of usage examples for org.apache.wicket Component add
public Component add(final Behavior... behaviors)
From source file:org.opensingular.lib.wicket.util.bootstrap.layout.BSControls.java
License:Apache License
@Deprecated public Component appendPicklist(Component select) { TemplatePanel tt = super.newTemplateTag( t -> "<div><select wicket:id=" + select.getId() + " multiple=\"multiple\"></select></div>"); return tt.add(select.add(new PicklistInitBehaviour())); }
From source file:org.opensingular.lib.wicket.util.datatable.column.BSTreeColumn.java
License:Apache License
@Override public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) { NodeModel<T> nodeModel = (NodeModel<T>) rowModel; Component nodeComponent = newNodeComponent(componentId, nodeModel.getWrappedModel()); nodeComponent.add(new NodeBorder(nodeModel.getBranches())); cellItem.add(nodeComponent);/*from w w w .j a v a 2 s .c o m*/ }
From source file:org.patientview.radar.web.visitors.PatientFormVisitor.java
License:Open Source License
public void component(Component component, IVisit iVisit) { //add onkeyup event to date to santise input - tried attaching behaviour in the component class itself // but did not work if (component instanceof RadarDateTextField || component instanceof RadarRequiredDateTextField) { component.add(new AttributeModifier("onkeyup", "radarUtility.sanitiseDateInput(this);")); }/* w ww . j a v a 2s . c o m*/ // add validator to date components - adding it inside the component constructor does not work if (component instanceof RadarDateTextField || component instanceof RadarRequiredDateTextField) { component.add(new RadarDateValidator()); } //if form component - mark form as dirty onchange if (component instanceof FormComponent || component instanceof Radio) { // ignore the subform components String[] ignoreParents = { "immunosuppression", "plasmapheresispanel", "dialysiscontainer", "transplantscontainer", "rejectDataContainer", "editTransplantContainer", "addTransplantForm" }; // ignore record switchers String[] ignoreIds = { "switcher" }; boolean ignoreComponent = false; for (String ignore : ignoreParents) { if (component.getPath().toLowerCase().contains(ignore.toLowerCase())) { ignoreComponent = true; break; } } for (String ignore : ignoreIds) { if (component.getId().toLowerCase().contains(ignore.toLowerCase())) { ignoreComponent = true; break; } } if (!ignoreComponent) { component.add(new AttributeAppender("onchange", RadarApplication.FORM_IS_DIRTY_TRUE_SCRIPT)); } } }
From source file:org.projectforge.plugins.skillmatrix.SkillTreeBuilder.java
License:Open Source License
/** * @return/*from w w w .jav a 2s .c om*/ */ @SuppressWarnings("serial") private List<IColumn<SkillNode, String>> createColumns() { final CellItemListener<SkillNode> cellItemListener = new CellItemListener<SkillNode>() { public void populateItem(final Item<ICellPopulator<SkillNode>> item, final String componentId, final IModel<SkillNode> rowModel) { final SkillNode skillNode = rowModel.getObject(); SkillListPage.appendCssClasses(item, skillNode.getSkill(), highlightedSkillNodeId); } }; final List<IColumn<SkillNode, String>> columns = new ArrayList<IColumn<SkillNode, String>>(); final TreeColumn<SkillNode, String> title = new TreeColumn<SkillNode, String>( new ResourceModel("plugins.skillmatrix.skill.title")) { @Override public void populateItem(final Item<ICellPopulator<SkillNode>> cellItem, final String componentId, final IModel<SkillNode> rowModel) { final RepeatingView view = new RepeatingView(componentId); cellItem.add(view); final SkillNode skillNode = rowModel.getObject(); if (selectMode == false) { view.add(new ListSelectActionPanel(view.newChildId(), rowModel, SkillEditPage.class, skillNode.getId(), parentPage, "")); } else { view.add(new ListSelectActionPanel(view.newChildId(), rowModel, caller, selectProperty, skillNode.getId(), "")); } AbstractListPage.addRowClick(cellItem); final NodeModel<SkillNode> nodeModel = (NodeModel<SkillNode>) rowModel; final Component nodeComponent = getTree().newNodeComponent(view.newChildId(), nodeModel.getWrappedModel()); nodeComponent.add(new NodeBorder(nodeModel.getBranches())); view.add(nodeComponent); cellItemListener.populateItem(cellItem, componentId, rowModel); } }; final CellItemListenerPropertyColumn<SkillNode> created = new CellItemListenerPropertyColumn<SkillNode>( new ResourceModel("created"), null, "skill.created", cellItemListener); final CellItemListenerPropertyColumn<SkillNode> lastUpdate = new CellItemListenerPropertyColumn<SkillNode>( new ResourceModel("lastUpdate"), null, "skill.lastUpdate", cellItemListener); final CellItemListenerPropertyColumn<SkillNode> description = new CellItemListenerPropertyColumn<SkillNode>( new ResourceModel("plugins.skillmatrix.skill.description"), null, "skill.description", cellItemListener); final CellItemListenerPropertyColumn<SkillNode> comment = new CellItemListenerPropertyColumn<SkillNode>( new ResourceModel("plugins.skillmatrix.skill.comment"), null, "skill.comment", cellItemListener); final CellItemListenerPropertyColumn<SkillNode> rateable = new CellItemListenerPropertyColumn<SkillNode>( new ResourceModel("plugins.skillmatrix.skill.rateable"), null, "skill.rateable", cellItemListener); columns.add(title); columns.add(description); columns.add(comment); columns.add(rateable); columns.add(created); columns.add(lastUpdate); return columns; }
From source file:org.projectforge.plugins.skillmatrix.SkillTreeBuilder.java
License:Open Source License
protected void addColumn(final WebMarkupContainer parent, final Component component, final String cssStyle) { if (cssStyle != null) { component.add(AttributeModifier.append("style", new Model<String>(cssStyle))); }/*from w ww . j a v a 2s . co m*/ parent.add(component); }
From source file:org.projectforge.web.fibu.DatevImportStoragePanel.java
License:Open Source License
private Component addCell(final RepeatingView cellRepeater, final Component comp, final String style) { final WebMarkupContainer cell = new WebMarkupContainer(cellRepeater.newChildId()); cellRepeater.add(cell);/*w w w.java2s . c o m*/ cell.add(comp); if (style != null) { comp.add(AttributeModifier.replace("style", style)); } return comp; }
From source file:org.projectforge.web.gantt.GanttChartEditTreeTablePanel.java
License:Open Source License
private void addColumn(final Item<GanttTreeTableNode> item, final Component component, final String cssStyle) { if (cssStyle != null) { component.add(AttributeModifier.append("style", new Model<String>(cssStyle))); }//from ww w .j av a 2 s . c o m item.add(component); }
From source file:org.projectforge.web.task.TaskTreeBuilder.java
License:Open Source License
/** * @return//ww w . j av a 2 s. c o m */ @SuppressWarnings("serial") private List<IColumn<TaskNode, String>> createColumns() { final TaskTree taskTree = getTaskTree(); final CellItemListener<TaskNode> cellItemListener = new CellItemListener<TaskNode>() { public void populateItem(final Item<ICellPopulator<TaskNode>> item, final String componentId, final IModel<TaskNode> rowModel) { final TaskNode taskNode = rowModel.getObject(); TaskListPage.appendCssClasses(item, taskNode.getTask(), highlightedTaskNodeId); } }; final List<IColumn<TaskNode, String>> columns = new ArrayList<IColumn<TaskNode, String>>(); columns.add(new TreeColumn<TaskNode, String>(new ResourceModel("task")) { @Override public void populateItem(final Item<ICellPopulator<TaskNode>> cellItem, final String componentId, final IModel<TaskNode> rowModel) { final RepeatingView view = new RepeatingView(componentId); cellItem.add(view); final TaskNode taskNode = rowModel.getObject(); if (selectMode == false) { view.add(new ListSelectActionPanel(view.newChildId(), rowModel, TaskEditPage.class, taskNode.getId(), parentPage, "")); } else { view.add(new ListSelectActionPanel(view.newChildId(), rowModel, caller, selectProperty, taskNode.getId(), "")); } AbstractListPage.addRowClick(cellItem); final NodeModel<TaskNode> nodeModel = (NodeModel<TaskNode>) rowModel; final Component nodeComponent = getTree().newNodeComponent(view.newChildId(), nodeModel.getWrappedModel()); nodeComponent.add(new NodeBorder(nodeModel.getBranches())); view.add(nodeComponent); cellItemListener.populateItem(cellItem, componentId, rowModel); } }); columns.add(new CellItemListenerPropertyColumn<TaskNode>(new ResourceModel("task.consumption"), null, "task", cellItemListener) { @Override public void populateItem(final Item<ICellPopulator<TaskNode>> item, final String componentId, final IModel<TaskNode> rowModel) { final TaskNode node = rowModel.getObject(); item.add(TaskListPage.getConsumptionBarPanel(tree, componentId, getTaskTree(), selectMode, node)); cellItemListener.populateItem(item, componentId, rowModel); } }); if (showCost == true) { columns.add(new CellItemListenerPropertyColumn<TaskNode>(new ResourceModel("fibu.kost2"), null, "task.kost2", cellItemListener) { @Override public void populateItem(final Item<ICellPopulator<TaskNode>> item, final String componentId, final IModel<TaskNode> rowModel) { final Label label = TaskListPage.getKostLabel(componentId, getTaskTree(), rowModel.getObject().getTask()); item.add(label); cellItemListener.populateItem(item, componentId, rowModel); } }); } if (taskTree.hasOrderPositionsEntries() == true && showOrders == true) { columns.add(new CellItemListenerPropertyColumn<TaskNode>(new ResourceModel("fibu.auftrag.auftraege"), null, null, cellItemListener) { @Override public void populateItem(final Item<ICellPopulator<TaskNode>> item, final String componentId, final IModel<TaskNode> rowModel) { final TaskNode taskNode = rowModel.getObject(); final Set<AuftragsPositionVO> orderPositions = taskTree .getOrderPositionEntries(taskNode.getId()); if (CollectionUtils.isEmpty(orderPositions) == true) { final Label label = new Label(componentId, ""); // Empty label. item.add(label); } else { final OrderPositionsPanel orderPositionsPanel = new OrderPositionsPanel(componentId) { @Override protected void onBeforeRender() { super.onBeforeRender(); // Lazy initialization because getString(...) of OrderPositionsPanel fails if panel.init(orderPositions) is called directly // after instantiation. init(orderPositions); }; }; item.add(orderPositionsPanel); } cellItemListener.populateItem(item, componentId, rowModel); } }); } columns.add(new CellItemListenerPropertyColumn<TaskNode>(new ResourceModel("shortDescription"), null, "task.shortDescription", cellItemListener)); if (accessChecker.isLoggedInUserMemberOfGroup(ProjectForgeGroup.FINANCE_GROUP) == true) { columns.add(new DatePropertyColumn<TaskNode>(dateTimeFormatter, parentPage.getString("task.protectTimesheetsUntil.short"), null, "task.protectTimesheetsUntil", cellItemListener)); } columns.add(new CellItemListenerPropertyColumn<TaskNode>(new ResourceModel("task.reference"), null, "reference", cellItemListener)); columns.add(new CellItemListenerPropertyColumn<TaskNode>(new ResourceModel("priority"), null, "priority", cellItemListener) { @Override public void populateItem(final Item<ICellPopulator<TaskNode>> item, final String componentId, final IModel<TaskNode> rowModel) { final Label label = TaskListPage.getPriorityLabel(componentId, priorityFormatter, rowModel.getObject().getTask()); item.add(label); cellItemListener.populateItem(item, componentId, rowModel); } }); columns.add(new CellItemListenerPropertyColumn<TaskNode>(new ResourceModel("task.status"), null, "status", cellItemListener) { @Override public void populateItem(final Item<ICellPopulator<TaskNode>> item, final String componentId, final IModel<TaskNode> rowModel) { final Label label = TaskListPage.getStatusLabel(componentId, taskFormatter, rowModel.getObject().getTask()); item.add(label); cellItemListener.populateItem(item, componentId, rowModel); } }); final UserPropertyColumn<TaskNode> userPropertyColumn = new UserPropertyColumn<TaskNode>( parentPage.getString("task.assignedUser"), null, "task.responsibleUserId", cellItemListener) .withUserFormatter(userFormatter).setUserGroupCache(userGroupCache); columns.add(userPropertyColumn); return columns; }
From source file:org.projectforge.web.wicket.ShinyFormVisitor.java
License:Open Source License
@Override public void component(final Component component, final IVisit<Void> visit) { if (component instanceof FieldsetPanel == true) { final FieldsetPanel fsPanel = (FieldsetPanel) component; if (fsPanel.isValid() == false) { if (visited.contains(component) == false) { visited.add(component);// www . j a v a 2s . c o m //fsPanel.getFieldset().add(new ValidationMsgBehavior()); fsPanel.getFieldset().add(new ErrorHighlightBehavior()); } } visit.dontGoDeeper(); return; } if (component instanceof FormComponent<?> == false) { return; } final FormComponent<?> fc = (FormComponent<?>) component; if (fc.isValid() == false && hasInvalidParent(fc.getParent()) == false) { if (visited.contains(component) == false) { visited.add(component); //component.add(new ValidationMsgBehavior()); component.add(new ErrorHighlightBehavior()); } } // if (fc.isValid() == false && hasInvalidParent(fc.getParent()) == false) { // component.setComponentBorder(new ValidationErrorBorder()); // } else if (component.getComponentBorder() != null) { // // Clear component border. // component.setComponentBorder(null); // } visit.dontGoDeeper(); return; }
From source file:org.projectforge.web.wicket.WicketUtils.java
License:Open Source License
/** * Adds onclick attribute with "javascript:rowClick(this);". * @param row Html tr element./*from w ww.j a v a 2s . co m*/ */ public static void addRowClick(final Component row) { row.add(AttributeModifier.replace("onclick", "javascript:rowClick(this);")); // add marker css class for contextMenu javaScript row.add(new AttributeAppender("class", Model.of("withContextMenu"), " ")); }