use of org.apache.wicket.Component in project midpoint by Evolveum.
the class TaskWfChildPanel method getComponentsToUpdate.
public Collection<Component> getComponentsToUpdate() {
TaskDto curr = parentPage.getCurrentTaskDto();
TaskDto prev = parentPage.getPreviousTaskDto();
boolean changesChanged = prev == null || prev.getChangesBeingApproved() == null || !prev.getChangesBeingApproved().equals(curr.getChangesBeingApproved());
List<Component> rv = new ArrayList<>();
if (changesChanged) {
rv.add(get(ID_CHANGES));
} else {
curr.getChangesBeingApproved().applyFoldingFrom(prev.getChangesBeingApproved());
}
rv.add(get(ID_HISTORY));
rv.add(get(ID_CURRENT_WORK_ITEMS_CONTAINER));
rv.add(get(ID_RELATED_REQUESTS_CONTAINER));
// we exclude 'show parent' link
return rv;
}
use of org.apache.wicket.Component in project midpoint by Evolveum.
the class TaskWfParentPanel method getComponentsToUpdate.
public Collection<Component> getComponentsToUpdate() {
TaskDto curr = parentPage.getCurrentTaskDto();
TaskDto prev = parentPage.getPreviousTaskDto();
List<TaskChangesDto> prevList = prev != null ? prev.getChangesCategorizationList() : null;
List<TaskChangesDto> currList = curr.getChangesCategorizationList();
boolean changesChanged = prev == null || !prevList.equals(currList);
List<Component> rv = new ArrayList<>();
if (changesChanged) {
rv.add(changesContainer);
} else {
for (int i = 0; i < currList.size(); i++) {
currList.get(i).applyFoldingFrom(prevList.get(i));
}
}
rv.add(processInstancesPanel);
return rv;
}
use of org.apache.wicket.Component in project midpoint by Evolveum.
the class PageTaskEdit method refresh.
public void refresh(AjaxRequestTarget target) {
TaskTabsVisibility tabsVisibilityOld = new TaskTabsVisibility();
tabsVisibilityOld.computeAll(this);
TaskButtonsVisibility buttonsVisibilityOld = new TaskButtonsVisibility();
buttonsVisibilityOld.computeAll(this);
refreshTaskModels();
TaskTabsVisibility tabsVisibilityNew = new TaskTabsVisibility();
tabsVisibilityNew.computeAll(this);
TaskButtonsVisibility buttonsVisibilityNew = new TaskButtonsVisibility();
buttonsVisibilityNew.computeAll(this);
if (!buttonsVisibilityNew.equals(buttonsVisibilityOld)) {
target.add(mainPanel.getButtonPanel());
}
if (tabsVisibilityNew.equals(tabsVisibilityOld)) {
// soft version
for (Component component : mainPanel.getTabPanel()) {
if (component instanceof TaskTabPanel) {
for (Component c : ((TaskTabPanel) component).getComponentsToUpdate()) {
target.add(c);
}
}
}
} else {
// hard version
target.add(mainPanel.getTabPanel());
}
target.add(getSummaryPanel());
AutoRefreshDto refreshDto = refreshModel.getObject();
refreshDto.recordRefreshed();
if (isEdit() || !refreshDto.isEnabled()) {
getRefreshPanel().stopRefreshing(this, target);
} else {
getRefreshPanel().startRefreshing(this, target);
}
}
use of org.apache.wicket.Component in project midpoint by Evolveum.
the class NavigatorPanel method changeCurrentPage.
private void changeCurrentPage(AjaxRequestTarget target, long page) {
pageable.setCurrentPage(page);
Component container = ((Component) pageable);
while (container instanceof AbstractRepeater) {
container = container.getParent();
}
target.add(container);
target.add(this);
onPageChanged(target, page);
}
use of org.apache.wicket.Component in project midpoint by Evolveum.
the class OrgTreePanel method initLayout.
private void initLayout() {
WebMarkupContainer treeHeader = new WebMarkupContainer(ID_TREE_HEADER);
treeHeader.setOutputMarkupId(true);
add(treeHeader);
String title = StringUtils.isEmpty(treeTitleKey) ? "TreeTablePanel.hierarchy" : treeTitleKey;
Label treeTitle = new Label(ID_TREE_TITLE, createStringResource(title));
treeHeader.add(treeTitle);
InlineMenu treeMenu = new InlineMenu(ID_TREE_MENU, new Model<>((Serializable) createTreeMenuInternal()));
treeHeader.add(treeMenu);
ISortableTreeProvider provider = new OrgTreeProvider(this, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected List<InlineMenuItem> createInlineMenuItems(OrgType org) {
return createTreeChildrenMenu(org);
}
};
List<IColumn<SelectableBean<OrgType>, String>> columns = new ArrayList<>();
if (selectable) {
columns.add(new CheckBoxHeaderColumn<SelectableBean<OrgType>>());
}
columns.add(new TreeColumn<SelectableBean<OrgType>, String>(createStringResource("TreeTablePanel.hierarchy")));
columns.add(new InlineMenuHeaderColumn(createTreeChildrenMenu(null)));
WebMarkupContainer treeContainer = new WebMarkupContainer(ID_TREE_CONTAINER) {
private static final long serialVersionUID = 1L;
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
// method computes height based on document.innerHeight() -
// screen height;
Component form = OrgTreePanel.this.getParent().get("memberPanel");
if (form != null) {
response.render(OnDomReadyHeaderItem.forScript("updateHeight('" + getMarkupId() + "', ['#" + form.getMarkupId() + "'], ['#" + OrgTreePanel.this.get(ID_TREE_HEADER).getMarkupId() + "'])"));
}
}
};
add(treeContainer);
TreeStateModel treeStateMode = new TreeStateModel(this, provider) {
private static final long serialVersionUID = 1L;
@Override
public Set<SelectableBean<OrgType>> getExpandedItems() {
return OrgTreePanel.this.getExpandedItems(getOrgTreeStateStorage());
}
@Override
public SelectableBean<OrgType> getCollapsedItem() {
return OrgTreePanel.this.getCollapsedItem(getOrgTreeStateStorage());
}
@Override
public void setCollapsedItem(SelectableBean<OrgType> item) {
OrgTreePanel.this.setCollapsedItem(null, getOrgTreeStateStorage());
}
};
TableTree<SelectableBean<OrgType>, String> tree = new TableTree<SelectableBean<OrgType>, String>(ID_TREE, columns, provider, Integer.MAX_VALUE, treeStateMode) {
private static final long serialVersionUID = 1L;
@Override
protected Component newContentComponent(String id, IModel<SelectableBean<OrgType>> model) {
return new SelectableFolderContent(id, this, model, selected) {
private static final long serialVersionUID = 1L;
@Override
protected void onClick(AjaxRequestTarget target) {
super.onClick(target);
OrgTreePanel.this.setSelectedItem(selected.getObject(), getOrgTreeStateStorage());
selectTreeItemPerformed(selected.getObject(), target);
}
};
}
@Override
protected Item<SelectableBean<OrgType>> newRowItem(String id, int index, final IModel<SelectableBean<OrgType>> model) {
Item<SelectableBean<OrgType>> item = super.newRowItem(id, index, model);
item.add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
SelectableBean<OrgType> itemObject = model.getObject();
if (itemObject != null && itemObject.equals(selected.getObject())) {
return "success";
}
return null;
}
}));
return item;
}
@Override
public void collapse(SelectableBean<OrgType> collapsedItem) {
super.collapse(collapsedItem);
Set<SelectableBean<OrgType>> items = OrgTreePanel.this.getExpandedItems(getOrgTreeStateStorage());
if (items != null && items.contains(collapsedItem)) {
items.remove(collapsedItem);
}
OrgTreePanel.this.setExpandedItems((TreeStateSet) items, getOrgTreeStateStorage());
OrgTreePanel.this.setCollapsedItem(collapsedItem, getOrgTreeStateStorage());
}
@Override
protected void onModelChanged() {
super.onModelChanged();
TreeStateSet<SelectableBean<OrgType>> items = (TreeStateSet) getModelObject();
if (!items.isInverse()) {
OrgTreePanel.this.setExpandedItems(items, getOrgTreeStateStorage());
}
}
};
tree.setItemReuseStrategy(new ReuseIfModelsEqualStrategy());
tree.getTable().add(AttributeModifier.replace("class", "table table-striped table-condensed"));
tree.add(new WindowsTheme());
// tree.add(AttributeModifier.replace("class", "tree-midpoint"));
treeContainer.add(tree);
}
Aggregations