0001: /*
0002: The contents of this file are subject to the Common Public Attribution License
0003: Version 1.0 (the "License"); you may not use this file except in compliance with
0004: the License. You may obtain a copy of the License at
0005: http://www.projity.com/license . The License is based on the Mozilla Public
0006: License Version 1.1 but Sections 14 and 15 have been added to cover use of
0007: software over a computer network and provide for limited attribution for the
0008: Original Developer. In addition, Exhibit A has been modified to be consistent
0009: with Exhibit B.
0010:
0011: Software distributed under the License is distributed on an "AS IS" basis,
0012: WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
0013: specific language governing rights and limitations under the License. The
0014: Original Code is OpenProj. The Original Developer is the Initial Developer and
0015: is Projity, Inc. All portions of the code written by Projity are Copyright (c)
0016: 2006, 2007. All Rights Reserved. Contributors Projity, Inc.
0017:
0018: Alternatively, the contents of this file may be used under the terms of the
0019: Projity End-User License Agreeement (the Projity License), in which case the
0020: provisions of the Projity License are applicable instead of those above. If you
0021: wish to allow use of your version of this file only under the terms of the
0022: Projity License and not to allow others to use your version of this file under
0023: the CPAL, indicate your decision by deleting the provisions above and replace
0024: them with the notice and other provisions required by the Projity License. If
0025: you do not delete the provisions above, a recipient may use your version of this
0026: file under either the CPAL or the Projity License.
0027:
0028: [NOTE: The text of this license may differ slightly from the text of the notices
0029: in Exhibits A and B of the license at http://www.projity.com/license. You should
0030: use the latest text at http://www.projity.com/license for your modifications.
0031: You may not remove this license text from the source files.]
0032:
0033: Attribution Information: Attribution Copyright Notice: Copyright � 2006, 2007
0034: Projity, Inc. Attribution Phrase (not exceeding 10 words): Powered by OpenProj,
0035: an open source solution from Projity. Attribution URL: http://www.projity.com
0036: Graphic Image as provided in the Covered Code as file: openproj_logo.png with
0037: alternatives listed on http://www.projity.com/logo
0038:
0039: Display of Attribution Information is required in Larger Works which are defined
0040: in the CPAL as a work which combines Covered Code or portions thereof with code
0041: not governed by the terms of the CPAL. However, in addition to the other notice
0042: obligations, all copies of the Covered Code in Executable and Source Code form
0043: distributed must, as a form of attribution of the original author, include on
0044: each user interface screen the "OpenProj" logo visible to all users. The
0045: OpenProj logo should be located horizontally aligned with the menu bar and left
0046: justified on the top left of the screen adjacent to the File menu. The logo
0047: must be at least 100 x 25 pixels. When users click on the "OpenProj" logo it
0048: must direct them back to http://www.projity.com.
0049: */
0050: package com.projity.pm.graphic.frames;
0051:
0052: import java.awt.Component;
0053: import java.awt.Dimension;
0054: import java.awt.GridLayout;
0055: import java.awt.event.ActionEvent;
0056: import java.util.ArrayList;
0057: import java.util.HashMap;
0058: import java.util.LinkedList;
0059: import java.util.List;
0060: import java.util.ListIterator;
0061:
0062: import javax.swing.JRadioButtonMenuItem;
0063: import javax.swing.SwingUtilities;
0064: import javax.swing.event.UndoableEditEvent;
0065: import javax.swing.event.UndoableEditListener;
0066:
0067: import org.apache.commons.collections.Closure;
0068:
0069: import com.projity.association.InvalidAssociationException;
0070: import com.projity.command.UpdateProjectCommand;
0071: import com.projity.configuration.Configuration;
0072: import com.projity.dialog.BaselineDialog;
0073: import com.projity.dialog.DelegateTaskDialog;
0074: import com.projity.dialog.UpdateProjectDialogBox;
0075: import com.projity.dialog.UpdateTaskDialog;
0076: import com.projity.dialog.calendar.ChangeWorkingTimeDialogBox;
0077: import com.projity.document.ObjectEvent;
0078: import com.projity.grouping.core.Node;
0079: import com.projity.grouping.core.NodeList;
0080: import com.projity.grouping.core.model.NodeModel;
0081: import com.projity.grouping.core.transform.ViewTransformer;
0082: import com.projity.grouping.core.transform.filtering.NodeFilter;
0083: import com.projity.grouping.core.transform.filtering.NotAssignmentFilter;
0084: import com.projity.grouping.core.transform.filtering.ResourceInTeamFilter;
0085: import com.projity.job.JobQueue;
0086: import com.projity.menu.MenuActionConstants;
0087: import com.projity.menu.MenuActionsMap;
0088: import com.projity.menu.MenuManager;
0089: import com.projity.pm.calendar.CalendarService;
0090: import com.projity.pm.calendar.HasCalendar;
0091: import com.projity.pm.calendar.WorkingCalendar;
0092: import com.projity.pm.dependency.DependencyService;
0093: import com.projity.pm.graphic.IconManager;
0094: import com.projity.pm.graphic.frames.workspace.NamedFrame;
0095: import com.projity.pm.graphic.model.cache.NodeModelCache;
0096: import com.projity.pm.graphic.model.cache.NodeModelCacheFactory;
0097: import com.projity.pm.graphic.model.cache.ReferenceNodeModelCache;
0098: import com.projity.pm.graphic.spreadsheet.SpreadSheet;
0099: import com.projity.pm.graphic.spreadsheet.SpreadSheetModel;
0100: import com.projity.pm.graphic.spreadsheet.common.CommonSpreadSheet;
0101: import com.projity.pm.graphic.spreadsheet.selection.event.SelectionNodeEvent;
0102: import com.projity.pm.graphic.spreadsheet.selection.event.SelectionNodeListener;
0103: import com.projity.pm.graphic.timescale.CoordinatesConverter;
0104: import com.projity.pm.graphic.views.BaseView;
0105: import com.projity.pm.graphic.views.ChartView;
0106: import com.projity.pm.graphic.views.GanttView;
0107: import com.projity.pm.graphic.views.MainView;
0108: import com.projity.pm.graphic.views.PertView;
0109: import com.projity.pm.graphic.views.ProjectView;
0110: import com.projity.pm.graphic.views.ResourceView;
0111: import com.projity.pm.graphic.views.TreeView;
0112: import com.projity.pm.graphic.views.UsageDetailView;
0113: import com.projity.pm.resource.ResourceImpl;
0114: import com.projity.pm.task.Portfolio;
0115: import com.projity.pm.task.Project;
0116: import com.projity.pm.task.ProjectEvent;
0117: import com.projity.pm.task.ProjectFactory;
0118: import com.projity.pm.task.ProjectListener;
0119: import com.projity.pm.task.Task;
0120: import com.projity.preference.GlobalPreferences;
0121: import com.projity.session.LoadOptions;
0122: import com.projity.toolbar.FilterToolBarManager;
0123: import com.projity.undo.UndoController;
0124: import com.projity.util.Alert;
0125: import com.projity.util.ArrayUtils;
0126: import com.projity.util.DataUtils;
0127: import com.projity.util.Environment;
0128: import com.projity.workspace.SavableToWorkspace;
0129: import com.projity.workspace.WorkspaceSetting;
0130:
0131: /**
0132: *
0133: */
0134:
0135: public class DocumentFrame extends NamedFrame implements
0136: SelectionNodeListener, UndoableEditListener,
0137: MenuActionConstants, ObjectEvent.Listener, ProjectListener,
0138: SavableToWorkspace {
0139: private static final long serialVersionUID = 2075764134837908178L;
0140: protected MainView mainView;
0141: protected GanttView ganttView;
0142: protected UsageDetailView taskUsageDetailView;
0143: protected UsageDetailView resourceUsageDetailView;
0144: protected PertView pertView;
0145: protected TreeView wbsView;
0146: protected TreeView rbsView;
0147: protected ChartView chartView;
0148: protected ChartView histogramView;
0149: protected ResourceView resourceView;
0150: protected ProjectView projectView;
0151: protected UsageDetailView taskUsageView;
0152: protected UsageDetailView resourceUsageView;
0153: protected BaseView reportView;
0154: private static ArrayList ganttColumns = null; // static is ok?
0155:
0156: protected CoordinatesConverter coord;
0157: protected Project project;
0158: protected GraphicManager graphicManager;
0159: protected MenuManager menuManager;
0160: MenuActionsMap actionsMap = null;
0161: BaseView activeTopView = null;
0162: BaseView activeBottomView = null;
0163:
0164: // keep state of pushed buttons so i can reset them when a view is reactivated
0165: String lastTopButton = null;
0166: String lastBottomButton = ACTION_NO_SUB_WINDOW;
0167: Workspace workspace;
0168: FilterToolBarManager filterToolBarManager = null;
0169: JobQueue jobQueue = null;
0170: private JRadioButtonMenuItem menuItem = null;
0171:
0172: public GraphicManager getGraphicManager() {
0173: return graphicManager;
0174: }
0175:
0176: protected NodeModel getTaskModel() {
0177: return project.getTaskModel();
0178: }
0179:
0180: protected NodeModel getResourceModel() {
0181: return project.getResourceModel();
0182: }
0183:
0184: public JobQueue getJobQueue() {
0185: if (jobQueue == null) {
0186: jobQueue = new JobQueue("GraphicManager", true);
0187: }
0188: return jobQueue;
0189: }
0190:
0191: public ReferenceNodeModelCache getTaskNodeModelCache() {
0192: ReferenceNodeModelCache taskCache = (ReferenceNodeModelCache) project
0193: .getTaskCache();
0194: if (taskCache == null) {
0195: taskCache = NodeModelCacheFactory.createTaskNodeModelCache(
0196: project, getTaskModel());
0197: project.setTaskCache(taskCache);
0198: }
0199: return taskCache;
0200: }
0201:
0202: public ReferenceNodeModelCache getResourceNodeModelCache() {
0203: ReferenceNodeModelCache resourceCache = (ReferenceNodeModelCache) project
0204: .getResourceCache();
0205: if (resourceCache == null) {
0206: resourceCache = NodeModelCacheFactory
0207: .createResourceNodeModelCache(project
0208: .getResourcePool(), getResourceModel());
0209: project.setResourceCache(resourceCache);
0210: }
0211: return resourceCache;
0212: }
0213:
0214: public ReferenceNodeModelCache getReferenceCache(boolean task) {
0215: ReferenceNodeModelCache cache = (task) ? getTaskNodeModelCache()
0216: : getResourceNodeModelCache();
0217: return cache;
0218: }
0219:
0220: public NodeModelCache createCache(boolean task, String viewName) {
0221: return NodeModelCacheFactory.getInstance().createFilteredCache(
0222: getReferenceCache(task), viewName, null);
0223: }
0224:
0225: public DocumentFrame(GraphicManager parentFrame,
0226: final Project project, String id) {
0227: super (id, IconManager.getHalfSizedIcon("view.gantt"));
0228: //TODO make another constructor that does lazy loading of project from project id. it would be for restore workspace
0229:
0230: this .graphicManager = parentFrame;
0231: this .menuManager = graphicManager.getMenuManager();
0232: filterToolBarManager = Environment.isNewLook() ? FilterToolBarManager
0233: .create(menuManager)
0234: : graphicManager.getFilterToolBarManager();
0235:
0236: this .project = project;
0237: coord = new CoordinatesConverter(project);
0238:
0239: project.addObjectListener(this ); // for project name changes
0240: getGraphicManager().getPreferences().addObjectListener(this );
0241:
0242: setPreferredSize(new Dimension(800, 600));
0243: setMainView(true);
0244:
0245: }
0246:
0247: private void setMainView(boolean activate) {
0248: if (mainView != null)
0249: remove(mainView); // any previous
0250: mainView = new MainView();
0251: mainView.setBorder(null);
0252: setLayout(new GridLayout(1, 1)); // fill up all of the space always
0253: add(mainView);
0254:
0255: // toolBarListener = new ToolBarListener();
0256: // registerToolBarActions();
0257:
0258: // wait until everything is initialized before activating the gantt view
0259: if (activate) {
0260: SwingUtilities.invokeLater(new Runnable() {
0261: public void run() {
0262: if (true || GraphicManager.getLastWorkspace() == null) { // if there was a workspace, it will be restored
0263: if (project.isMaster() && !project.isLocal())
0264: activateResourceView();
0265: else
0266: activateGanttView();
0267: }
0268: getGraphicManager().setButtonState(null, project); // disable buttons at first
0269: }
0270: });
0271: }
0272:
0273: }
0274:
0275: List getSelectedNodes() {
0276: CommonSpreadSheet spreadSheet = getTopSpreadSheet();
0277: if (spreadSheet == null)
0278: return null;
0279: List nodes = spreadSheet.getSelectedNodes();
0280: if (nodes.size() == 0)
0281: return null;
0282: return nodes;
0283: }
0284:
0285: Object getSelectedImpl() {
0286: CommonSpreadSheet spreadSheet = getTopSpreadSheet();
0287: if (spreadSheet == null)
0288: return null;
0289: return spreadSheet.getCurrentRowImpl();
0290: }
0291:
0292: boolean doBaselineDialog(boolean save) {
0293: finishAnyOperations();
0294:
0295: BaselineDialog baselineDialog = BaselineDialog.getInstance(
0296: getGraphicManager(), null, save,
0297: hasAtLeastOneTaskSelected());
0298: if (!baselineDialog.doModal())
0299: return false;
0300: Integer baselineNumber = new Integer(baselineDialog.getForm()
0301: .getBaselineNumber());
0302: boolean entireProject = baselineDialog.getForm()
0303: .isEntireProject();
0304: List selection = entireProject ? null : getSelectedImpls();
0305: if (save)
0306: getProject().saveCurrentToSnapshot(baselineNumber,
0307: entireProject, selection, true);
0308: else
0309: getProject().clearSnapshot(baselineNumber, entireProject,
0310: selection, true);
0311: // getProject().fireBaselineChanged(baselineDialog, null, baselineNumber,
0312: // save);
0313: return true;
0314: }
0315:
0316: // void doEnterpriseResourcesDialog() {
0317: // finishAnyOperations();
0318: // EnterpriseResourcesDialog enterpriseResourceDialog = EnterpriseResourcesDialog
0319: // .getInstance(getMainFrame());
0320: // enterpriseResourceDialog.pack();
0321: // enterpriseResourceDialog.setModal(false);
0322: // enterpriseResourceDialog.setLocationRelativeTo(null);//to center on
0323: // // screen
0324: // enterpriseResourceDialog.show();
0325: // }
0326:
0327: void doChangeWorkingTimeDialog(boolean restrict) {
0328: finishAnyOperations();
0329: Object rowObject = getSelectedImpl();
0330: WorkingCalendar wc = null;
0331: List documentCalendars = null;
0332: if (rowObject instanceof HasCalendar) {
0333: wc = (WorkingCalendar) ((HasCalendar) rowObject)
0334: .getWorkCalendar();
0335: if (rowObject instanceof ResourceImpl) {
0336: documentCalendars = ((ResourceImpl) rowObject)
0337: .getResourcePool().extractCalendars();
0338: }
0339: }
0340: if (wc == null)
0341: wc = (WorkingCalendar) getProject().getWorkCalendar();
0342: CalendarService service = CalendarService.getInstance();
0343:
0344: ChangeWorkingTimeDialogBox dlg = ChangeWorkingTimeDialogBox
0345: .getInstance(getGraphicManager().getFrame(), wc,
0346: documentCalendars, restrict, this
0347: .getUndoController());
0348: dlg.doModal();
0349: }
0350:
0351: void doLevelResourcesDialog() {
0352: // ResourceLevelingDialogBox.getInstance(getGraphicManager().getFrame(), null).doModal();
0353: }
0354:
0355: void doDelegateTasksDialog() {
0356: finishAnyOperations();
0357: List nodes = getSelectedNodes(); //nodes, not impls!
0358: if (nodes == null)
0359: return;
0360:
0361: DelegateTaskDialog dlg = DelegateTaskDialog.getInstance(
0362: getGraphicManager().getFrame(), nodes);
0363: dlg.setLocationRelativeTo(null);//to center on screen
0364: dlg.doModal();
0365:
0366: }
0367:
0368: void doUpdateTasksDialog() {
0369: finishAnyOperations();
0370: List nodes = getSelectedNodes(); //nodes, not impls!
0371: if (nodes == null)
0372: return;
0373:
0374: UpdateTaskDialog dlg = UpdateTaskDialog.getInstance(
0375: getGraphicManager().getFrame(), nodes);
0376: dlg.setLocationRelativeTo(null);//to center on screen
0377: dlg.doModal();
0378:
0379: }
0380:
0381: void doUpdateProjectDialog() {
0382: finishAnyOperations();
0383: UpdateProjectDialogBox dlg = UpdateProjectDialogBox
0384: .getInstance(getGraphicManager().getFrame(), null,
0385: hasAtLeastOneTaskSelected());
0386: if (dlg.doModal()) {
0387: UpdateProjectCommand cmd = new UpdateProjectCommand(
0388: project, dlg.getForm().getActiveDate().getTime(),
0389: dlg.getForm().getUpdate().booleanValue(), dlg
0390: .getForm().getProgress().booleanValue());
0391: forTasksDo(cmd, dlg.getForm().getEntireProject()
0392: .booleanValue());
0393: cmd = null;
0394: }
0395:
0396: }
0397:
0398: void doDefineCodeDialog() {
0399: finishAnyOperations();
0400: // OutlineCodeDefinitionDialogBox.getInstance(getGraphicManager().getFrame(), null).doModal();
0401: }
0402:
0403: void doRecurringTaskDialog() {
0404: finishAnyOperations();
0405: // RecurringTaskInformationDialogBox.getInstance(getGraphicManager().getFrame(), null)
0406: // .doModal();
0407: }
0408:
0409: void doBarDialog() {
0410: finishAnyOperations();
0411: // ShapeBarDialogBox.getInstance(getGraphicManager().getFrame(), null).doModal();
0412: }
0413:
0414: void doSortDialog() {
0415: finishAnyOperations();
0416: // SortDialogBox.getInstance(getGraphicManager().getFrame(), null).doModal();
0417: }
0418:
0419: void doGroupDialog() {
0420: finishAnyOperations();
0421: // GroupDefinitionDialogBox.getInstance(getGraphicManager().getFrame(), null).doModal();
0422: }
0423:
0424: public void doLinkTasks() {
0425: finishAnyOperations();
0426: try {
0427: List list = NodeList.nodeListToImplList(getSelectedNodes(),
0428: NotAssignmentFilter.getInstance());
0429: DependencyService.getInstance().connect(list, this , null);
0430: //DependencyService.getInstance().connect(list,this);
0431: } catch (InvalidAssociationException e) {
0432: Alert.error(e.getMessage(), this );
0433: }
0434: }
0435:
0436: public void doUnlinkTasks() {
0437: finishAnyOperations();
0438: List list = NodeList.nodeListToImplList(getSelectedNodes(),
0439: NotAssignmentFilter.getInstance());
0440:
0441: DependencyService.getInstance().removeAnyDependencies(list,
0442: this );
0443: }
0444:
0445: public void doUndoRedo(boolean isUndo) {
0446: if (!isActive())
0447: return;
0448: finishAnyOperations();
0449: UndoController undoController = getUndoController();
0450: if (undoController != null) {
0451: if (isUndo)
0452: undoController.undo();
0453: else
0454: undoController.redo();
0455: refreshUndoButtons();
0456: }
0457: }
0458:
0459: public void doZoomIn() {
0460: if (activeTopView != null)
0461: activeTopView.zoomIn();
0462: }
0463:
0464: public void doZoomOut() {
0465: if (activeTopView != null)
0466: activeTopView.zoomOut();
0467: }
0468:
0469: public void doScrollToTask() {
0470: if (activeTopView != null)
0471: activeTopView.scrollToTask();
0472: }
0473:
0474: public boolean canZoomIn() {
0475: return activeTopView == null ? false : activeTopView
0476: .canZoomIn();
0477: }
0478:
0479: public boolean canZoomOut() {
0480: return activeTopView == null ? false : activeTopView
0481: .canZoomOut();
0482: }
0483:
0484: public boolean canScrollToTask() {
0485: return activeTopView == null ? false : activeTopView
0486: .canScrollToTask();
0487: }
0488:
0489: public int getScale() {
0490: return activeTopView == null ? -1 : activeTopView.getScale();
0491: }
0492:
0493: public void doOutdent() {
0494: SpreadSheet ss = getActiveSpreadSheet();
0495: if (ss != null)
0496: ss.executeAction(MenuActionConstants.ACTION_OUTDENT);
0497: }
0498:
0499: public void doIndent() {
0500: SpreadSheet ss = getActiveSpreadSheet();
0501: if (ss != null)
0502: ss.executeAction(MenuActionConstants.ACTION_INDENT);
0503: }
0504:
0505: public void doDelete() {
0506: SpreadSheet ss = getActiveSpreadSheet();
0507: if (ss != null)
0508: ss.executeAction(MenuActionConstants.ACTION_DELETE);
0509: }
0510:
0511: public void doCut() {
0512: SpreadSheet ss = getActiveSpreadSheet();
0513: if (ss != null)
0514: ss.prepareAction(MenuActionConstants.ACTION_CUT)
0515: .actionPerformed(new ActionEvent(ss, 0, null));
0516: //NodeListTransferHandler.getCutAction(ss).actionPerformed(new ActionEvent(this,0,null));
0517: //ss.executeAction(SpreadSheet.CUT);
0518: }
0519:
0520: public void doCopy() {
0521: SpreadSheet ss = getActiveSpreadSheet();
0522: if (ss != null)
0523: ss.prepareAction(MenuActionConstants.ACTION_COPY)
0524: .actionPerformed(new ActionEvent(ss, 0, null));
0525: //NodeListTransferHandler.getCopyAction(ss).actionPerformed(new ActionEvent(this,0,null));
0526: //ss.executeAction(SpreadSheet.COPY);
0527: }
0528:
0529: public void doPaste() {
0530: SpreadSheet ss = getActiveSpreadSheet();
0531: if (ss != null)
0532: ss.prepareAction(MenuActionConstants.ACTION_PASTE)
0533: .actionPerformed(new ActionEvent(ss, 0, null));
0534: //NodeListTransferHandler.getPasteAction(ss).actionPerformed(new ActionEvent(this,0,null));
0535: //ss.executeAction(SpreadSheet.PASTE);
0536: }
0537:
0538: public GanttView getGanttView() {
0539: if (ganttView == null) {
0540: ganttView = new GanttView(this , graphicManager
0541: .getMenuManager(), mainView.getSynchronizer());
0542: ganttView.init(getTaskNodeModelCache(), getTaskModel(),
0543: coord);
0544: restoreWorkspaceFor(ganttView);
0545: }
0546: return ganttView;
0547: }
0548:
0549: public UsageDetailView getTaskUsageDetailView() {
0550: if (taskUsageDetailView == null) {
0551: taskUsageDetailView = new UsageDetailView(this ,
0552: graphicManager.getMenuManager(), mainView
0553: .getSynchronizer());
0554: taskUsageDetailView.init(getTaskNodeModelCache(), true,
0555: coord, false, ACTION_TASK_USAGE_DETAIL,
0556: addTransformerInitializationClosure());
0557: restoreWorkspaceFor(taskUsageDetailView);
0558: }
0559: return taskUsageDetailView;
0560: }
0561:
0562: public UsageDetailView getResourceUsageDetailView() {
0563: if (resourceUsageDetailView == null) {
0564: resourceUsageDetailView = new UsageDetailView(this ,
0565: graphicManager.getMenuManager(), mainView
0566: .getSynchronizer());
0567: resourceUsageDetailView.init(getResourceNodeModelCache(),
0568: false, coord, false, ACTION_RESOURCE_USAGE_DETAIL,
0569: addTransformerInitializationClosure());
0570: restoreWorkspaceFor(resourceUsageDetailView);
0571: }
0572: return resourceUsageDetailView;
0573: }
0574:
0575: public PertView getPertView() {
0576: if (pertView == null) {
0577: pertView = new PertView(this , graphicManager
0578: .getMenuManager());
0579: pertView.init(getTaskNodeModelCache(), getTaskModel());
0580: restoreWorkspaceFor(pertView);
0581: }
0582: return pertView;
0583: }
0584:
0585: public TreeView getWBSView() {
0586: if (wbsView == null) {
0587: wbsView = new TreeView(this , graphicManager
0588: .getMenuManager());
0589: wbsView.init(getTaskNodeModelCache(), getTaskModel(),
0590: ACTION_WBS, addTransformerInitializationClosure());
0591: restoreWorkspaceFor(wbsView);
0592: }
0593: return wbsView;
0594: }
0595:
0596: public TreeView getRBSView() {
0597: if (rbsView == null) {
0598: rbsView = new TreeView(this , graphicManager
0599: .getMenuManager());
0600: rbsView.init(getResourceNodeModelCache(),
0601: getResourceModel(), ACTION_RBS,
0602: addTransformerInitializationClosure());
0603: restoreWorkspaceFor(rbsView);
0604: }
0605: return rbsView;
0606: }
0607:
0608: public BaseView getReportView() {
0609: try {
0610: if (reportView == null) {
0611: Class clazz = Class
0612: .forName("com.projity.reports.view.ReportView");
0613: reportView = (BaseView) clazz.getConstructor(
0614: new Class[] { DocumentFrame.class })
0615: .newInstance(new Object[] { this });
0616: clazz.getMethod("init",
0617: new Class[] { CoordinatesConverter.class })
0618: .invoke(reportView, new Object[] { coord });
0619: if (reportView != null)
0620: restoreWorkspaceFor(reportView);
0621: }
0622: } catch (Exception e) {
0623: e.printStackTrace();
0624: reportView = null;
0625: }
0626: return reportView;
0627: }
0628:
0629: public ChartView getChartView() {
0630: if (chartView == null) {
0631: chartView = new ChartView(this , false, graphicManager
0632: .getMenuManager(), mainView.getSynchronizer(),
0633: addTransformerInitializationClosure());
0634: chartView.init(coord);
0635: restoreWorkspaceFor(chartView);
0636: }
0637: return chartView;
0638: }
0639:
0640: public ChartView getHistogramView() {
0641: if (histogramView == null) {
0642: histogramView = new ChartView(this , true, graphicManager
0643: .getMenuManager(), mainView.getSynchronizer(),
0644: addTransformerInitializationClosure());
0645: histogramView.init(coord);
0646: restoreWorkspaceFor(histogramView);
0647: }
0648: return histogramView;
0649: }
0650:
0651: public ResourceView getResourceView() {
0652: if (resourceView == null) {
0653: resourceView = new ResourceView(
0654: getResourceNodeModelCache(), getResourceModel(),
0655: project.getResourcePool());
0656: restoreWorkspaceFor(resourceView);
0657: }
0658: return resourceView;
0659: }
0660:
0661: public ProjectView getProjectView() {
0662: if (projectView == null) {
0663: Portfolio portfolio = getGraphicManager()
0664: .getProjectFactory().getPortfolio();
0665: projectView = new ProjectView(portfolio.getNodeModel(),
0666: portfolio);
0667: restoreWorkspaceFor(projectView);
0668: }
0669: return projectView;
0670: }
0671:
0672: public UsageDetailView getTaskUsageView() {
0673: if (taskUsageView == null) {
0674: taskUsageView = new UsageDetailView(this , graphicManager
0675: .getMenuManager(), mainView.getSynchronizer());
0676: taskUsageView.init(getTaskNodeModelCache(), true, coord,
0677: true, ACTION_TASK_USAGE,
0678: addTransformerInitializationClosure());
0679: restoreWorkspaceFor(taskUsageView);
0680: }
0681: return taskUsageView;
0682: }
0683:
0684: public UsageDetailView getResourceUsageView() {
0685: if (resourceUsageView == null) {
0686: resourceUsageView = new UsageDetailView(this ,
0687: graphicManager.getMenuManager(), mainView
0688: .getSynchronizer());
0689: resourceUsageView.init(getResourceNodeModelCache(), false,
0690: coord, true, ACTION_RESOURCE_USAGE,
0691: addTransformerInitializationClosure());
0692: restoreWorkspaceFor(resourceUsageView);
0693: }
0694: return resourceUsageView;
0695: }
0696:
0697: public void toggleMinWidth() {
0698: boolean normalMinWidth = (activeTopView == null || activeTopView
0699: .hasNormalMinWidth())
0700: && (activeBottomView == null || activeBottomView
0701: .hasNormalMinWidth());
0702: coord.toggleMinWidth(normalMinWidth);
0703: }
0704:
0705: public boolean activateView(String viewName) {
0706: BaseView topView = null;
0707: BaseView bottomView = null;
0708: boolean top = true;
0709: if (viewName.equals(ACTION_GANTT)) {
0710: activateGanttView();
0711: return top;
0712: } else if (viewName.equals(ACTION_TRACKING_GANTT)) {
0713: activateTrackingGanttView();
0714: return top;
0715: } else if (viewName.equals(ACTION_TASK_USAGE_DETAIL))
0716: topView = getTaskUsageDetailView();
0717: else if (viewName.equals(ACTION_RESOURCE_USAGE_DETAIL))
0718: topView = getResourceUsageDetailView();
0719: else if (viewName.equals(ACTION_NETWORK))
0720: topView = getPertView();
0721: else if (viewName.equals(ACTION_WBS))
0722: topView = getWBSView();
0723: else if (viewName.equals(ACTION_RBS))
0724: topView = getRBSView();
0725: else if (viewName.equals(ACTION_REPORT))
0726: topView = getReportView();
0727: else if (viewName.equals(ACTION_RESOURCES))
0728: topView = getResourceView();
0729: else if (viewName.equals(ACTION_PROJECTS))
0730: topView = getProjectView();
0731: else if (viewName.equals(ACTION_HISTOGRAM)) {
0732: // if (activeBottomView != getHistogramView())
0733: bottomView = getHistogramView();
0734: // else
0735: // deactivateBottomView();
0736: } else if (viewName.equals(ACTION_CHARTS))
0737: bottomView = getChartView();
0738: else if (viewName.equals(ACTION_TASK_USAGE))
0739: bottomView = getTaskUsageView();
0740: else if (viewName.equals(ACTION_RESOURCE_USAGE))
0741: bottomView = getResourceUsageView();
0742: else if (viewName.equals(ACTION_NO_SUB_WINDOW))
0743: deactivateBottomView();
0744:
0745: if (topView != null) {
0746: activateTopView(topView, viewName);
0747: }
0748:
0749: if (bottomView != null) {
0750: boolean clickNew = true;
0751: if (!Environment.isNewLook()) {
0752: clickNew = bottomView != activeBottomView; // if clicked on a non pressed button
0753: deactivateBottomView();
0754: }
0755: if (clickNew)
0756: activateBottomView(bottomView, viewName);
0757: top = false;
0758: }
0759: return top;
0760: }
0761:
0762: private void activateTopView(BaseView view, String viewName) {
0763: showWaitCursor(true);
0764: CommonSpreadSheet ss = getTopSpreadSheet();
0765: if (ss != null)
0766: ss.removeSelectionNodeListener(this );
0767: deactivateTopView();
0768: activeTopView = view;
0769: mainView.setTop((Component) view);
0770: view.onActivate(true);
0771: ss = view.getSpreadSheet();
0772: if (ss != null)
0773: ss.addSelectionNodeListener(this );
0774:
0775: toggleMinWidth();
0776: menuManager.setActionSelected(viewName, true);
0777: lastTopButton = viewName;
0778: setComboBoxesViewName(view.getViewName());
0779: getGraphicManager().setTaskInformation(view.showsTasks(),
0780: view.showsResources());
0781: refreshUndoButtons();
0782: getGraphicManager().setEnabledDocumentMenuActions(true);
0783: showWaitCursor(false);
0784: //this doesn't have any effect setFrameIcon(menuManager.getToolButtonFromId(viewName).getIcon());
0785:
0786: }
0787:
0788: void deactivateTopView() {
0789: if (activeTopView == null)
0790: return;
0791: if (lastTopButton != null)
0792: menuManager.setActionSelected(lastTopButton, false);
0793: // deactivate current ss listener
0794: CommonSpreadSheet ss = getTopSpreadSheet();
0795: if (ss != null)
0796: ss.removeSelectionNodeListener(this );
0797:
0798: mainView.removeTop();
0799: activeTopView.onActivate(false);
0800: activeTopView = null;
0801: toggleMinWidth();
0802: getGraphicManager().setTaskInformation(false, false);
0803: refreshUndoButtons();
0804: getGraphicManager().setEnabledDocumentMenuActions(false);
0805: }
0806:
0807: public void activateResourceView() {
0808: activateTopView(getResourceView(), ACTION_RESOURCES);
0809: }
0810:
0811: public void activateGanttView() {
0812: if (ganttColumns != null)
0813: getGanttView().setColumns(ganttColumns);
0814: getGanttView().setBarStyles("standard");
0815: getGanttView().setTracking(false);
0816: activateTopView(getGanttView(), ACTION_GANTT);
0817: }
0818:
0819: public ArrayList getGanttColumns() {
0820: return ganttColumns;
0821: }
0822:
0823: public void activateTrackingGanttView() {
0824: getGanttView().setBarStyles("Tracking");
0825: getGanttView().setTracking(true);
0826: ganttColumns = getGanttView().setColumns(
0827: "Spreadsheet.Task.tracking");
0828: activateTopView(getGanttView(), ACTION_TRACKING_GANTT);
0829: }
0830:
0831: public void activateBottomView(BaseView view, String viewName) {
0832: boolean same = viewName.equals(lastBottomButton);
0833: if (same)
0834: return;
0835: if (viewName == ACTION_NO_SUB_WINDOW)
0836: deactivateBottomView();
0837: else {
0838: mainView.removeBottom();
0839: }
0840: activeBottomView = view;
0841: view.onActivate(true);
0842: lastBottomButton = viewName;
0843: mainView.setBottom((Component) view);
0844: toggleMinWidth();
0845: menuManager.setActionSelected(viewName, true);
0846: refreshUndoButtons();
0847:
0848: if (lastSelectionEvent != null && view != null
0849: && view instanceof SelectionNodeListener)
0850: ((SelectionNodeListener) view)
0851: .selectionChanged(lastSelectionEvent);
0852:
0853: }
0854:
0855: public void deactivateBottomView() {
0856: if (activeBottomView == null)
0857: return;
0858: menuManager.setActionSelected(ACTION_NO_SUB_WINDOW, true);
0859: if (lastBottomButton != null)
0860: menuManager.setActionSelected(lastBottomButton, false);
0861: activeTopView.onActivate(false);
0862: lastBottomButton = ACTION_NO_SUB_WINDOW;
0863: mainView.removeBottom();
0864: activeBottomView = null;
0865: toggleMinWidth();
0866: refreshUndoButtons();
0867: }
0868:
0869: /**
0870: * @return Returns the mainView.
0871: */
0872: public MainView getMainView() {
0873: return mainView;
0874: }
0875:
0876: /**
0877: * @return Returns the project.
0878: */
0879: public Project getProject() {
0880: return project;
0881: }
0882:
0883: /**
0884: * @return Returns the topSpreadSheet.
0885: */
0886: public SpreadSheet getTopSpreadSheet() {
0887: CommonSpreadSheet ss = null;
0888: if (activeTopView != null)
0889: ss = activeTopView.getSpreadSheet();
0890: return (SpreadSheet) ss;
0891: }
0892:
0893: /**
0894: * @return Returns the topSpreadSheet.
0895: */
0896: public SpreadSheet getActiveSpreadSheet() {
0897: SpreadSheet ss = getTopSpreadSheet();
0898: if (ss == null) {
0899: if (activeBottomView != null)
0900: ss = activeBottomView.getSpreadSheet();
0901:
0902: }
0903: return ss;
0904: }
0905:
0906: protected SelectionNodeEvent lastSelectionEvent = null;
0907:
0908: /**
0909: * React to selection changed events and forward them on to any bottom
0910: * window
0911: */
0912: public void selectionChanged(SelectionNodeEvent e) {
0913: lastSelectionEvent = e;
0914: Component bottom = mainView.getBottomComponent();
0915: if (bottom != null && bottom instanceof SelectionNodeListener)
0916: ((SelectionNodeListener) bottom).selectionChanged(e);
0917: graphicManager.selectionChanged(e);
0918: }
0919:
0920: /**
0921: * @return Returns the menuManager.
0922: */
0923: public MenuManager getMenuManager() {
0924: return menuManager;
0925: }
0926:
0927: private boolean hasAtLeastOneTaskSelected() {
0928: return DataUtils.nodeListContainsImplOfType(getSelectedNodes(),
0929: Task.class);
0930: }
0931:
0932: private void forTasksDo(Closure closure, boolean all) {
0933: DataUtils.forAllDo(closure, all, project
0934: .getTaskOutlineIterator(), getSelectedNodes(),
0935: Task.class);
0936: }
0937:
0938: public void undoableEditHappened(UndoableEditEvent e) {
0939: refreshUndoButtons();
0940: }
0941:
0942: protected UndoController currentUndoController = null;
0943:
0944: public UndoController getUndoController() {
0945: return currentUndoController;
0946: }
0947:
0948: void refreshViewButtons(boolean enable) {
0949: if (enable)
0950: refreshUndoButtons();
0951: if (lastTopButton != null)
0952: menuManager.setActionSelected(lastTopButton, enable);
0953: if (lastBottomButton != null)
0954: menuManager.setActionSelected(lastBottomButton, enable);
0955:
0956: }
0957:
0958: public void refreshUndoButtons() {
0959: UndoController undoController = null;
0960: if (activeTopView != null)
0961: undoController = activeTopView.getUndoController();
0962:
0963: if (undoController != currentUndoController) {
0964: if (currentUndoController != null)
0965: currentUndoController.getEditSupport()
0966: .removeUndoableEditListener(this );
0967: if (undoController != null)
0968: undoController.getEditSupport()
0969: .addUndoableEditListener(this );
0970: currentUndoController = undoController;
0971: }
0972:
0973: boolean canUndo = false;
0974: boolean canRedo = false;
0975: // String undoText = "";
0976: // String redoText = "";
0977:
0978: if (undoController != null) {
0979: canUndo = undoController.canUndo();
0980: canRedo = undoController.canRedo();
0981: // undoText = undoController.getUndoManager().getUndoPresentationName();
0982: // redoText = undoController.getUndoManager().getRedoPresentationName();
0983: }
0984: menuManager.setActionEnabled(ACTION_UNDO, canUndo);
0985: menuManager.setActionEnabled(ACTION_REDO, canRedo);
0986:
0987: }
0988:
0989: public Node addNodeForImpl(Object impl) {
0990: return addNodeForImpl(impl, NodeModel.NORMAL);
0991: }
0992:
0993: public Node addNodeForImpl(Object impl, int eventType) {
0994: SpreadSheet spreadSheet = (SpreadSheet) getTopSpreadSheet();
0995: if (impl == null) {
0996: spreadSheet.executeAction(MenuActionConstants.ACTION_NEW);
0997: return null;
0998: } else {
0999: return spreadSheet.addNodeForImpl(impl, eventType);
1000: }
1001: }
1002:
1003: /**
1004: * sees if currently selected row belongs to main project. used to see if can insert a subproject. subprojects can
1005: * only be inserted into master project
1006: * @return
1007: */
1008: public boolean isCurrentRowInMainProject() {
1009: CommonSpreadSheet spreadSheet = getTopSpreadSheet();
1010: if (spreadSheet == null)
1011: return true;
1012: int row = spreadSheet.getCurrentRow();
1013: if (row == -1)
1014: return true;
1015: Node current = spreadSheet.getCurrentRowNode();
1016: SpreadSheetModel model = (SpreadSheetModel) spreadSheet
1017: .getModel();
1018: LinkedList previousNodes = model
1019: .getPreviousVisibleNodesFromRow(row);
1020: if (previousNodes == null)
1021: return true;
1022: previousNodes.add(current); // treat current node first since going backwards
1023: ListIterator i = previousNodes.listIterator(previousNodes
1024: .size());
1025: while (i.hasPrevious()) {
1026: Object o = ((Node) i.previous()).getImpl();
1027: if (o instanceof Task) {
1028: if (((Task) o).isInSubproject())
1029: return false;
1030: return project == ((Task) o).getOwningProject();
1031: }
1032: }
1033:
1034: return true;
1035: }
1036:
1037: public List getSelectedImpls() {
1038: return NodeList.nodeListToImplList(getSelectedNodes());
1039: }
1040:
1041: public void finishAnyOperations() {
1042: if (!isActive())
1043: return;
1044: CommonSpreadSheet topSpreadSheet = getTopSpreadSheet();
1045: if (topSpreadSheet != null)
1046: topSpreadSheet.finishCurrentOperations();
1047: }
1048:
1049: public void setComboBoxesViewName(String view) {
1050: filterToolBarManager.setComboBoxesViewName(view);
1051: }
1052:
1053: public void showWaitCursor(boolean show) {
1054: getGraphicManager().showWaitCursor(show);
1055: }
1056:
1057: public void objectChanged(ObjectEvent objectEvent) { // rename tab if project changes
1058: if (objectEvent.getObject() instanceof Project
1059: && objectEvent.isUpdate()) { //Only for projects
1060: if (objectEvent.getField() == Configuration
1061: .getFieldFromId("Field.name")) {
1062: getGraphicManager().setTabNameAndTitle(this , project);
1063: }
1064: // else if (objectEvent.getField() == Configuration.getFieldFromId("Field.showProjectResourcesOnly")) {
1065: // for (ResourceInTeamFilter filter : resourcesInTeamFilters) {
1066: // filter.setFilterTeam(project.isShowProjectResourcesOnly());
1067: // }
1068: // }
1069:
1070: } else if (objectEvent.getObject() instanceof GlobalPreferences
1071: && objectEvent.isUpdate()) {
1072: //if (objectEvent.getField() == Configuration.getFieldFromId("Field.showProjectResourcesOnly")) {
1073: for (ResourceInTeamFilter filter : resourcesInTeamFilters) {
1074: filter.setFilterTeam(getGraphicManager()
1075: .getPreferences().isShowProjectResourcesOnly());
1076: }
1077: ResourceInTeamFilter filter = getGraphicManager()
1078: .getAssignmentDialogTransformerInitializationClosure();
1079: if (filter != null) {
1080: filter.setFilterTeam(getGraphicManager()
1081: .getPreferences().isShowProjectResourcesOnly());
1082: }
1083: //}
1084:
1085: }
1086:
1087: }
1088:
1089: private ArrayList<ResourceInTeamFilter> resourcesInTeamFilters = new ArrayList<ResourceInTeamFilter>();
1090:
1091: public Closure addTransformerInitializationClosure() {
1092: return new Closure() {
1093: public void execute(Object arg) {
1094: ViewTransformer transformer = (ViewTransformer) arg;
1095: NodeFilter hiddenFilter = transformer.getHiddenFilter();
1096: if (hiddenFilter != null
1097: && hiddenFilter instanceof ResourceInTeamFilter) {
1098: ResourceInTeamFilter rf = (ResourceInTeamFilter) hiddenFilter;
1099: rf.setFilterTeam(getGraphicManager()
1100: .getPreferences()
1101: .isShowProjectResourcesOnly());
1102: resourcesInTeamFilters.add(rf);
1103: }
1104: }
1105: };
1106: }
1107:
1108: void onClose() {
1109: project = null; // get rid of reference
1110: }
1111:
1112: boolean isPrintable() {
1113: return activeTopView != null && activeTopView.isPrintable();
1114: }
1115:
1116: final CoordinatesConverter getCoord() {
1117: return coord;
1118: }
1119:
1120: public void nameChanged(final ProjectEvent e) {
1121: setTabNameAndTitle(e.getProject());
1122: }
1123:
1124: public void groupDirtyChanged(final ProjectEvent e) {
1125: setTabNameAndTitle(e.getProject());
1126: getGraphicManager().refreshSaveStatus(false);
1127: }
1128:
1129: void setTabNameAndTitle(Project project) {
1130: boolean show = isShowTitleBar();
1131:
1132: getGraphicManager().setTitle(false);
1133: setTabTitle(project.getName());
1134: setShowTitleBar(show);
1135: // if (parentFrame.getCurrentFrame() == this)
1136: // parentFrame.setTitle(Messages.getString("Text.ApplicationTitle") + " - " + project.getName());
1137: }
1138:
1139: String getTopViewId() {
1140: if (lastTopButton == null)
1141: return ACTION_GANTT;
1142: return lastTopButton;
1143: }
1144:
1145: protected void finalize() throws Throwable {
1146: System.out.println("~~~~~~~~~~~~~~~~ DocumentFrame.finalize()");
1147: super .finalize();
1148: }
1149:
1150: public void cleanUp() {
1151: System.out.println("Document Frame Cleanup");
1152: if (project != null) {
1153: project.removeProjectListener(this );
1154: project.removeObjectListener(this );
1155: project.removeScheduleListener(coord);
1156: }
1157: if (getUndoController() != null
1158: && getUndoController().getEditSupport() != null)
1159: getUndoController().getEditSupport()
1160: .removeUndoableEditListener(this );
1161: if (coord != null)
1162: coord.removeTimeScaleListener(mainView);
1163: forAllViews(new Closure() {
1164: public void execute(Object v) {
1165: if (v != null)
1166: ((BaseView) v).cleanUp();
1167: }
1168: });
1169: resetViews();
1170: if (jobQueue != null)
1171: jobQueue.cancel();
1172: jobQueue = null;
1173: project = null;
1174: coord = null;
1175: resetViews();
1176: }
1177:
1178: void resetViews() {
1179: ganttView = null;
1180: taskUsageDetailView = null;
1181: resourceUsageDetailView = null;
1182: pertView = null;
1183: wbsView = null;
1184: rbsView = null;
1185: chartView = null;
1186: histogramView = null;
1187: resourceView = null;
1188: projectView = null;
1189: taskUsageView = null;
1190: resourceUsageView = null;
1191: reportView = null;
1192: activeTopView = null;
1193: activeBottomView = null;
1194: }
1195:
1196: private void forAllViews(Closure c) {
1197: Object[] views = { ganttView, taskUsageDetailView,
1198: resourceUsageDetailView, pertView, wbsView, rbsView,
1199: chartView, histogramView, resourceView, projectView,
1200: taskUsageView, resourceUsageView, reportView };
1201: ArrayUtils.forAllDo(views, c);
1202: }
1203:
1204: public void restoreWorkspace(WorkspaceSetting w, int context) {
1205: Workspace ws = (Workspace) w;
1206: workspace = ws;
1207: setMainView(false);
1208: if (project == null) {
1209: project = ProjectFactory.getInstance().findFromId(
1210: ws.projectId);
1211: if (project == null) {
1212: LoadOptions opt = new LoadOptions();
1213: opt.setId(ws.projectId);
1214: opt.setSync(true);
1215: project = ProjectFactory.getInstance().openProject(opt);
1216: }
1217: }
1218: coord.restoreWorkspace(ws.getCoord(), context);
1219:
1220: activateView(ws.topViewName);
1221: activateView(ws.bottomViewName);
1222: mainView.restoreWorkspace(ws.mainView, context);
1223:
1224: }
1225:
1226: private WorkspaceSetting restoreWorkspaceFor(BaseView view) {
1227: WorkspaceSetting ws = getWorkspaceFor(view);
1228: if (ws != null)
1229: view.restoreWorkspace(ws, SavableToWorkspace.VIEW);
1230: return ws;
1231: }
1232:
1233: private WorkspaceSetting getWorkspaceFor(BaseView view) {
1234: if (workspace == null || workspace.views == null)
1235: return null;
1236: return (WorkspaceSetting) workspace.views.get(view
1237: .getViewName());
1238: }
1239:
1240: private void saveViewWorkspace(Workspace ws, String name,
1241: BaseView view) {
1242: if (view != null)
1243: ws.views.put(name, view
1244: .createWorkspace(SavableToWorkspace.VIEW));
1245: }
1246:
1247: public WorkspaceSetting createWorkspace(int context) {
1248: Workspace ws = new Workspace();
1249: ws.projectId = getProject().getUniqueId();
1250: ws.topViewName = getTopViewId();
1251: ws.bottomViewName = lastBottomButton;
1252: ws.coord = coord.createWorkspace(context);
1253: ws.mainView = mainView.createWorkspace(context);
1254: ws.saveViewWorkspace(ACTION_GANTT, ganttView);
1255: ws.saveViewWorkspace(ACTION_TASK_USAGE_DETAIL,
1256: taskUsageDetailView);
1257: ws.saveViewWorkspace(ACTION_RESOURCE_USAGE_DETAIL,
1258: resourceUsageDetailView);
1259: ws.saveViewWorkspace(ACTION_NETWORK, pertView);
1260: ws.saveViewWorkspace(ACTION_WBS, wbsView);
1261: ws.saveViewWorkspace(ACTION_RBS, rbsView);
1262: ws.saveViewWorkspace(ACTION_CHARTS, chartView);
1263: ws.saveViewWorkspace(ACTION_HISTOGRAM, histogramView);
1264: ws.saveViewWorkspace(ACTION_RESOURCES, resourceView);
1265: ws.saveViewWorkspace(ACTION_PROJECTS, projectView);
1266: ws.saveViewWorkspace(ACTION_TASK_USAGE, taskUsageView);
1267: ws.saveViewWorkspace(ACTION_RESOURCE_USAGE, resourceUsageView);
1268: ws.saveViewWorkspace(ACTION_REPORT, reportView);
1269: return ws;
1270: }
1271:
1272: public static class Workspace implements WorkspaceSetting {
1273: private static final long serialVersionUID = 8836549717587108911L;
1274: //TODO store the current filter, grouper, sorter for each view
1275: long projectId;
1276: String topViewName;
1277: String bottomViewName;
1278: WorkspaceSetting coord;
1279: WorkspaceSetting mainView;
1280: HashMap views;
1281:
1282: public void saveViewWorkspace(String name, BaseView view) {
1283: if (views == null)
1284: views = new HashMap();
1285: if (view != null)
1286: views.put(name, view
1287: .createWorkspace(SavableToWorkspace.VIEW));
1288: }
1289:
1290: public final String getBottomViewName() {
1291: return bottomViewName;
1292: }
1293:
1294: public final void setBottomViewName(String bottomViewName) {
1295: this .bottomViewName = bottomViewName;
1296: }
1297:
1298: public final String getTopViewName() {
1299: return topViewName;
1300: }
1301:
1302: public final void setTopViewName(String topViewName) {
1303: this .topViewName = topViewName;
1304: }
1305:
1306: public final long getProjectId() {
1307: return projectId;
1308: }
1309:
1310: public final void setProjectId(long projectId) {
1311: this .projectId = projectId;
1312: }
1313:
1314: public WorkspaceSetting getCoord() {
1315: return coord;
1316: }
1317:
1318: public void setCoord(WorkspaceSetting coord) {
1319: this .coord = coord;
1320: }
1321:
1322: public HashMap getViews() {
1323: return views;
1324: }
1325:
1326: public void setViews(HashMap views) {
1327: this .views = views;
1328: }
1329:
1330: public WorkspaceSetting getMainView() {
1331: return mainView;
1332: }
1333:
1334: public void setMainView(WorkspaceSetting mainView) {
1335: this .mainView = mainView;
1336: }
1337: }
1338:
1339: public FilterToolBarManager getFilterToolBarManager() {
1340: return filterToolBarManager;
1341: }
1342:
1343: public BaseView getActiveBottomView() {
1344: return activeBottomView;
1345: }
1346:
1347: public BaseView getActiveTopView() {
1348: return activeTopView;
1349: }
1350:
1351: public void setMenuItem(JRadioButtonMenuItem mi) {
1352: this .menuItem = mi;
1353:
1354: }
1355:
1356: public JRadioButtonMenuItem getMenuItem() {
1357: return menuItem;
1358: }
1359:
1360: }
|