⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ganttproject.java

📁 It is all about project scheduling. GanttProject is a tool for creating a project schedule by means
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    private GanttChartTabContentPanel myGanttChartTabContent;    private ResourceChartTabContentPanel myResourceChartTabContent;    private RowHeightAligner myRowHeightAligner;    public TaskContainmentHierarchyFacade getTaskContainment() {    	if (myFacadeInvalidator==null) {    		return TaskContainmentHierarchyFacade.STUB;    	}        if (!myFacadeInvalidator.isValid() || myCachedFacade == null) {            myCachedFacade = new TaskContainmentHierarchyFacadeImpl(tree);            myFacadeInvalidator.reset();        }        return myCachedFacade;    }    private void initOptions() {        //Color color = GanttGraphicArea.taskDefaultColor;        //myApplicationConfig.register(options);        options.setUIConfiguration(myUIConfiguration);        options.setDocumentsMRU(documentsMRU);        options.setLookAndFeel(lookAndFeel);        if (options.load()) {            language = options.getLanguage();            GanttGraphicArea.taskDefaultColor = options.getDefaultColor();                        lookAndFeel = options.getLnfInfos();            HttpDocument.setLockDAVMinutes(options.getLockDAVMinutes());                    }                myUIConfiguration = options.getUIConfiguration();    }        /** Constructor */    public GanttProject(boolean isOnlyViewer, boolean isApplet) {        ToolTipManager.sharedInstance().setInitialDelay(200);        ToolTipManager.sharedInstance().setDismissDelay(60000);                Mediator.registerRoleManager(getRoleManager());        TaskSelectionManager taskSelectionManager = new TaskSelectionManager();        Mediator.registerTaskSelectionManager(taskSelectionManager);        /*         * [bbaranne] I add a Mediator object so that we can get the GanttProject         * singleton whereever we are in the source code. Perhaps some of you         * don't like this, but I believe that it is practical...         */        Mediator.registerGanttProject(this);        this.isOnlyViewer = isOnlyViewer;        if (!isOnlyViewer)            setTitle(language.getText("appliTitle"));        else            setTitle("GanttViewer");        setFocusable(true);        lookAndFeel = GanttLookAndFeels.getGanttLookAndFeels().getDefaultInfo();        options = new GanttOptions(getRoleManager(), getDocumentManager(), isOnlyViewer);        myUIConfiguration = options.getUIConfiguration();                class TaskManagerConfigImpl implements TaskManagerConfig {            public Color getDefaultColor() {                return myUIConfiguration.getTaskColor();            }            public GPCalendar getCalendar() {                return GanttProject.this.getActiveCalendar();            }            public TimeUnitStack getTimeUnitStack() {                return GanttProject.this.getTimeUnitStack();            }            public ResourceManager getResourceManager() {                return GanttProject.this.getHumanResourceManager();            }        }        TaskManagerConfig taskConfig = new TaskManagerConfigImpl();        myTaskManager = TaskManager.Access.newInstance(                new TaskContainmentHierarchyFacade.Factory() {                    public TaskContainmentHierarchyFacade createFacede() {                        return GanttProject.this.getTaskContainment();                    }                }, taskConfig);        Mediator.registerTaskManager(myTaskManager);        ImageIcon icon = new ImageIcon(getClass().getResource(                "/icons/ganttproject.png"));        setIconImage(icon.getImage());        // Create each objects        tree = new GanttTree2(this, myTaskManager, getUIFacade());        myFacadeInvalidator = new FacadeInvalidator(tree.getJTree().getModel());        getProject().addProjectEventListener(myFacadeInvalidator);                area = new GanttGraphicArea(this, tree, getTaskManager(),                getZoomManager(), getUndoManager());        options.addOptionGroups(getUIFacade().getGanttChart().getOptionGroups());        options.addOptionGroups(getUIFacade().getResourceChart().getOptionGroups());        options.addOptionGroups(new GPOptionGroup[]{getProjectUIFacade().getOptionGroup()});        options.addOptionGroups(getDocumentManager().getNetworkOptionGroups());        myRowHeightAligner = new RowHeightAligner(tree, area.getMyChartModel());        area.getMyChartModel().addOptionChangeListener(myRowHeightAligner);        initOptions();        area.setUIConfiguration(myUIConfiguration);        tree.setGraphicArea(area);        //        miChartOptions = new JMenuItem(area.getOptionsDialogAction());        getZoomManager().addZoomListener(area.getZoomListener());        /*myCopyAction = new CopyAction((GanttTree2) getTree(), options                .getIconSize());        */        //        myCopyAction = new CopyAction(this, options.getIconSize());//        //        /*myPasteAction = new PasteAction((GanttTree2) getTree(), options//                .getIconSize());*///        //        myPasteAction = new PasteAction(this, options.getIconSize());//        //        /*myCutAction = new CutAction((GanttTree2) getTree(), options//                .getIconSize());*///        //        myCutAction = new CutAction(this, options.getIconSize());                myRefreshAction = new RefreshViewAction(getUIFacade(), options);//        myRolloverActions.add(myCopyAction);//        myRolloverActions.add(myPasteAction);//        myRolloverActions.add(myCutAction);        myRolloverActions.add(myRefreshAction);        tree.setActions();                // Create the menus        bar = new JMenuBar();        if (!isOnlyViewer)            setJMenuBar(bar);        // Allocation of the menus        mProject = new JMenu();        mMRU = new JMenu();        mMRU.setIcon(new ImageIcon(getClass().getResource(                "/icons/recent_16.gif")));        mEdit = new JMenu();        // mView = new JMenu ();        mTask = new JMenu();        mHuman = new JMenu();        mHelp = new JMenu();        mCalendar = new JMenu();        miUndo = new JMenuItem(new UndoAction(getUndoManager(), "16", this));        mEdit.add(miUndo);        // miUndo.setEnabled(false);        miRedo = new JMenuItem(new RedoAction(getUndoManager(), "16", this));        mEdit.add(miRedo);        // miRedo.setEnabled(false);        mEdit.addSeparator();        createProjectMenu();        miRefresh = new JMenuItem(myRefreshAction);        // miRefresh.setAccelerator((KeyStroke)myRefreshAction.getValue(Action.ACCELERATOR_KEY));        mEdit.add(miRefresh);        mEdit.addSeparator();        //miCut = new JMenuItem(myCutAction);        mEdit.add(getViewManager().getCutAction());        //miCopy = new JMenuItem(myCopyAction);        mEdit.add(getViewManager().getCopyAction());        //miPaste = new JMenuItem(myPasteAction);        mEdit.add(getViewManager().getPasteAction());        mEdit.addSeparator();        miOptions = createNewItem("/icons/settings_16.gif");        mEdit.add(miOptions);        myNewTaskAction = new NewTaskAction((IGanttProject) this);        mTask.add(myNewTaskAction);        miDeleteTask = createNewItem("/icons/delete_16.gif");        mTask.add(miDeleteTask);        myTaskPropertiesAction = new TaskPropertiesAction(getProject(), Mediator.getTaskSelectionManager(), getUIFacade());        mTask.add(myTaskPropertiesAction);        getTree().setTaskPropertiesAction(myTaskPropertiesAction);        getResourcePanel().setTaskPropertiesAction(myTaskPropertiesAction);        //        //         myNewHumanAction = new NewHumanAction(getHumanResourceManager(),                getRoleManager(), this, this) {            public void actionPerformed(ActionEvent event) {                super.actionPerformed(event);                getTabs().setSelectedIndex(UIFacade.RESOURCES_INDEX);            }        };        mHuman.add(myNewHumanAction);        myDeleteHumanAction = getResourceActions().getDeleteHumanAction();        miDelHuman = new JMenuItem(myDeleteHumanAction);        mHuman.add(miDelHuman);        //miPropHuman = createNewItem("/icons/properties_16.gif");        //mHuman.add(miPropHuman);        mHuman.add(getResourcePanel().getResourcePropertiesAction());        miSendMailHuman = createNewItem("/icons/send_mail_16.gif");        mHuman.add(miSendMailHuman);        mHuman.add(new ImportResources(getHumanResourceManager(),                getTaskManager(), getRoleManager(), this));        miEditCalendar = createNewItem("/icons/clock_16.gif");        mCalendar.add(miEditCalendar);        miPrjCal = createNewItem("/icons/default_calendar_16.gif");        mCalendar.add(miPrjCal);        miWebPage = createNewItem("/icons/home_16.gif");        mHelp.add(miWebPage);        miManual = createNewItem("/icons/help_16.gif");        try { // See if helpgui library is on the classpath            Class.forName("net.sourceforge.helpgui.HelpGui");            mHelp.add(miManual);            miManual.setAccelerator(KeyStroke.getKeyStroke("F1"));        } catch (Exception ex) {            // Not add the help button on the ui        }        miTips = createNewItem("/icons/about_16.gif");        mHelp.add(miTips);        miAbout = createNewItem("/icons/manual_16.gif");        mHelp.add(miAbout);        if (!isApplet) {            bar.add(mProject); // for a applet veiwer, Project menu is not            // neccessary By CL        }        bar.add(mEdit);        JMenu viewMenu = createViewMenu();        if (viewMenu != null)            bar.add(viewMenu);        // bar.add (mView);        bar.add(mTask);        bar.add(mHuman);        // bar.add(mCalendar);        bar.add(mHelp);        setMemonic();        // to create a default project        // createDefaultTree(tree);        myGanttChartTabContent = new GanttChartTabContentPanel(getProject(), getUIFacade(),tree, area);        GPView ganttView = getViewManager().createView(myGanttChartTabContent, new ImageIcon(getClass().getResource("/icons/tasks_16.gif")));        ganttView.setVisible(true);        myResourceChartTabContent = new ResourceChartTabContentPanel(getResourcePanel(), getResourcePanel().area);        GPView resourceView = getViewManager().createView(myResourceChartTabContent, new ImageIcon(getClass().getResource("/icons/res_16.gif")));        resourceView.setVisible(true);        getTabs().setSelectedIndex(0);        this.resp.setActions();                // pert area        //getTabs().setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);        getTabs().addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                bCritical                        .setEnabled(getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX);                bScrollCenter                        .setEnabled(getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX);                bComparePrev                        .setEnabled(getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX);                bSaveCurrent                        .setEnabled(getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX);                bNewTask                        .setEnabled(getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX                                || getTabs().getSelectedIndex() == UIFacade.RESOURCES_INDEX);                bDelete                        .setEnabled(getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX                                || getTabs().getSelectedIndex() == UIFacade.RESOURCES_INDEX);                bProperties                        .setEnabled(getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX                                || getTabs().getSelectedIndex() == UIFacade.RESOURCES_INDEX);                bZoomIn                        .setEnabled(getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX                                || getTabs().getSelectedIndex() == UIFacade.RESOURCES_INDEX);                bZoomOut                        .setEnabled(getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX                                || getTabs().getSelectedIndex() == UIFacade.RESOURCES_INDEX);                if (getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX) { // Gantt                    // Chart                    bNewTask.setToolTipText(getToolTip(correctLabel(language                            .getText("createTask"))));                    bDelete.setToolTipText(getToolTip(correctLabel(language                            .getText("deleteTask"))));                    bProperties.setToolTipText(getToolTip(correctLabel(language                            .getText("propertiesTask"))));                    if (options.getButtonShow() != GanttOptions.ICONS) {                        bNewTask.setText(correctLabel(language                                .getText("createTask")));                        bDelete.setText(correctLabel(language                                .getText("deleteTask")));                        bProperties.setText(correctLabel(language                                .getText("propertiesTask")));                    }                } else if (getTabs().getSelectedIndex() == UIFacade.RESOURCES_INDEX) { // Resources                    // Chart                    bNewTask.setToolTipText(getToolTip(correctLabel(language

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -