public TaskSelectPanel( final FieldsetPanel fieldsetPanel, final IModel<TaskDO> model, final ISelectCallerPage caller, final String selectProperty) { super(fieldsetPanel.newChildId(), model, caller, selectProperty); this.fieldsetPanel = fieldsetPanel; fieldsetPanel.getFieldset().setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true); TaskDO task = model.getObject(); if (Hibernate.isInitialized(task) == false) { task = taskTree.getTaskById(task.getId()); model.setObject(task); } divContainer = new WebMarkupContainer("div") { private static final long serialVersionUID = -8150112323444983335L; /** @see org.apache.wicket.Component#isVisible() */ @Override public boolean isVisible() { // display only, if we are not in ajax task select mode return ajaxTaskSelectMode == false; } }; divContainer.setOutputMarkupId(true); divContainer.setOutputMarkupPlaceholderTag(true); add(divContainer); ajaxTaskSelectMode = false; }
/** @see org.projectforge.web.wicket.AbstractSelectPanel#onBeforeRender() */ @SuppressWarnings("serial") @Override protected void onBeforeRender() { super.onBeforeRender(); final TaskDO task = getModelObject(); final Integer taskId = task != null ? task.getId() : null; if (currentTaskId == taskId) { return; } currentTaskId = taskId; if (showPath == true && task != null) { ancestorRepeater.removeAll(); final TaskNode taskNode = taskTree.getTaskNodeById(task.getId()); final List<Integer> ancestorIds = taskNode.getAncestorIds(); final ListIterator<Integer> it = ancestorIds.listIterator(ancestorIds.size()); while (it.hasPrevious() == true) { final Integer ancestorId = it.previous(); final TaskDO ancestorTask = taskTree.getTaskById(ancestorId); if (ancestorTask.getParentTask() == null) { // Don't show root node: continue; } final WebMarkupContainer cont = new WebMarkupContainer(ancestorRepeater.newChildId()); ancestorRepeater.add(cont); final SubmitLink selectTaskLink = new SubmitLink("ancestorTaskLink") { @Override public void onSubmit() { caller.select(selectProperty, ancestorTask.getId()); } }; selectTaskLink.setDefaultFormProcessing(false); cont.add(selectTaskLink); WicketUtils.addTooltip( selectTaskLink, getString("task.selectPanel.selectAncestorTask.tooltip")); selectTaskLink.add(new Label("name", ancestorTask.getTitle())); } ancestorRepeater.setVisible(true); } else { ancestorRepeater.setVisible(false); } }
/** * Will be called if the user has chosen an entry of the task favorites drop down choice. * * @param task */ protected void selectTask(final TaskDO task) { setModelObject(task); caller.select(selectProperty, task.getId()); }
public Integer getTaskId() { return task != null ? task.getId() : null; }