ItEr47S17CUFiltradoNaPlanificacionItEr46S21: Added button to expand and collapse all the task in the planning view.
This commit is contained in:
parent
297c6b1cde
commit
80d23a85af
7 changed files with 68 additions and 1 deletions
|
|
@ -453,4 +453,20 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
|||
return tasks;
|
||||
}
|
||||
|
||||
public void expandAll() {
|
||||
setExpandAll(true, getTasksOrderedByStartDate());
|
||||
}
|
||||
|
||||
public void collapseAll() {
|
||||
setExpandAll(false, getTasksOrderedByStartDate());
|
||||
}
|
||||
|
||||
private void setExpandAll(boolean expand, List<Task> tasks) {
|
||||
for (Task task : tasks) {
|
||||
if (task instanceof TaskContainer) {
|
||||
((TaskContainer) task).setExpanded(expand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import org.zkoss.ganttz.LeftTasksTreeRow.ILeftTasksTreeNavigator;
|
|||
import org.zkoss.ganttz.data.Position;
|
||||
import org.zkoss.ganttz.data.Task;
|
||||
import org.zkoss.ganttz.data.TaskContainer;
|
||||
import org.zkoss.ganttz.data.TaskContainer.IExpandListener;
|
||||
import org.zkoss.ganttz.util.ComponentsFinder;
|
||||
import org.zkoss.ganttz.util.MutableTreeModel;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
|
|
@ -54,9 +55,24 @@ import org.zkoss.zul.TreeitemRenderer;
|
|||
public class LeftTasksTree extends HtmlMacroComponent {
|
||||
|
||||
private final class TaskBeanRenderer implements TreeitemRenderer {
|
||||
public void render(Treeitem item, Object data) throws Exception {
|
||||
private Map<TaskContainer, IExpandListener> expandListeners = new HashMap<TaskContainer, IExpandListener>();
|
||||
|
||||
public void render(final Treeitem item, Object data) throws Exception {
|
||||
Task task = (Task) data;
|
||||
item.setOpen(isOpened(task));
|
||||
if (task instanceof TaskContainer) {
|
||||
final TaskContainer container = (TaskContainer) task;
|
||||
IExpandListener expandListener = new IExpandListener() {
|
||||
|
||||
@Override
|
||||
public void expandStateChanged(boolean isNowExpanded) {
|
||||
item.setOpen(isNowExpanded);
|
||||
}
|
||||
};
|
||||
expandListeners.put(container, expandListener);
|
||||
container.addExpandListener(expandListener);
|
||||
|
||||
}
|
||||
final int[] path = tasksTreeModel.getPath(tasksTreeModel.getRoot(),
|
||||
task);
|
||||
String cssClass = "depth_" + path.length;
|
||||
|
|
|
|||
|
|
@ -279,6 +279,10 @@ public class Planner extends HtmlMacroComponent {
|
|||
Button showCriticalPathButton = (Button) getFellow("showCriticalPath");
|
||||
showCriticalPathButton.setVisible(false);
|
||||
}
|
||||
if (!configuration.isExpandAllEnabled()) {
|
||||
Button expandAllButton = (Button) getFellow("expandAll");
|
||||
expandAllButton.setVisible(false);
|
||||
}
|
||||
listZoomLevels.setSelectedIndex(getZoomLevel().ordinal());
|
||||
}
|
||||
|
||||
|
|
@ -480,4 +484,17 @@ public class Planner extends HtmlMacroComponent {
|
|||
this.containersExpandedByDefault = containersExpandedByDefault;
|
||||
}
|
||||
|
||||
public void expandAll() {
|
||||
Button expandAllButton = (Button) getFellow("expandAll");
|
||||
if (disabilityConfiguration.isExpandAllEnabled()) {
|
||||
if (expandAllButton.getSclass().equals("planner-command")) {
|
||||
context.expandAll();
|
||||
expandAllButton.setSclass("planner-command clicked");
|
||||
} else {
|
||||
context.collapseAll();
|
||||
expandAllButton.setSclass("planner-command");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,6 @@ public interface IDisabilityConfiguration {
|
|||
|
||||
public boolean isCriticalPathEnabled();
|
||||
|
||||
public boolean isExpandAllEnabled();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,6 +130,8 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
|||
|
||||
private boolean criticalPathEnabled = true;
|
||||
|
||||
private boolean expandAllEnabled = true;
|
||||
|
||||
// private String identifier = null;
|
||||
|
||||
private IDetailItemModificator firstLevelModificators = SeveralModificators
|
||||
|
|
@ -276,6 +278,15 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
|||
return criticalPathEnabled;
|
||||
}
|
||||
|
||||
public void setExpandAllEnabled(boolean expandAllEnabled) {
|
||||
this.expandAllEnabled = expandAllEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExpandAllEnabled() {
|
||||
return expandAllEnabled;
|
||||
}
|
||||
|
||||
public IDetailItemModificator getSecondLevelModificators() {
|
||||
return secondLevelModificators;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ planner = self;
|
|||
<button id="showAllResources" onClick="planner.showAllResources();"
|
||||
image="/common/img/ico_resources.png"
|
||||
tooltiptext="${i18n:_('Show/Hide resources')}" sclass="planner-command show-resources" />
|
||||
<button id="expandAll" onClick="planner.expandAll();"
|
||||
image="/common/img/ico_expand.png"
|
||||
tooltiptext="${i18n:_('Expand/Collapse all')}"
|
||||
sclass="planner-command" />
|
||||
<separator />
|
||||
|
||||
<!-- Filtering -->
|
||||
|
|
|
|||
|
|
@ -438,6 +438,7 @@ public abstract class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
configuration.setMovingTasksEnabled(false);
|
||||
configuration.setResizingTasksEnabled(false);
|
||||
configuration.setCriticalPathEnabled(false);
|
||||
configuration.setExpandAllEnabled(false);
|
||||
}
|
||||
|
||||
private void addAdditionalCommands(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue