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

📄 ganttproject.java

📁 It is all about project scheduling. GanttProject is a tool for creating a project schedule by means
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                            .getText("newHuman"))));                    bDelete.setToolTipText(getToolTip(correctLabel(language                            .getText("deleteHuman"))));                    bProperties.setToolTipText(getToolTip(correctLabel(language                            .getText("propertiesHuman"))));                    if (options.getButtonShow() != GanttOptions.ICONS) {                        bNewTask.setText(correctLabel(language                                .getText("newHuman")));                        bDelete.setText(correctLabel(language                                .getText("deleteHuman")));                        bProperties.setText(correctLabel(language                                .getText("propertiesHuman")));                    }                }            }        });        // Add tabpan on the content pane        getContentPane().add(getTabs(), BorderLayout.CENTER);        // Add toolbar        toolBar = new GPToolBar("GanttProject", options.getToolBarPosition(), getOptions());        toolBar.addComponentListener(new ComponentListener() {            public void componentResized(ComponentEvent arg0) {                setHiddens();                refresh();            }            public void componentMoved(ComponentEvent arg0) {            }            public void componentShown(ComponentEvent arg0) {            }            public void componentHidden(ComponentEvent arg0) {            }        });        this.addButtons(toolBar);        getContentPane()                .add(                        toolBar,                        (toolBar.getOrientation() == JToolBar.HORIZONTAL) ? BorderLayout.NORTH                                : BorderLayout.WEST);        // add the status bar        if (!isOnlyViewer)            getContentPane().add(getStatusBar(), BorderLayout.SOUTH);        getStatusBar().setVisible(options.getShowStatusBar());        // add a keyboard listener        addKeyListener(this);        SwitchViewAction switchAction = new SwitchViewAction(this);        JMenuItem invisibleItem = new JMenuItem(switchAction);        invisibleItem.setVisible(false);        bar.add(invisibleItem);        // update 18-03-2003        addWindowListener(new java.awt.event.WindowAdapter() {            public void windowClosing(java.awt.event.WindowEvent evt) {                exitForm(evt);            }            public void windowOpened(WindowEvent e) {                myRowHeightAligner.optionsChanged();            }                    });        // update 18-03-2003        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();        Dimension windowSize = getPreferredSize();        // Put the frame at the middle of the screen        setLocation(screenSize.width / 2 - (windowSize.width / 2),                screenSize.height / 2 - (windowSize.height / 2));        this.pack();        changeLanguage();        // changeUndoNumber ();        changeLookAndFeel(lookAndFeel);        changeLookAndFeel(lookAndFeel); // Twice call for update font on menu        if (options.isLoaded()) {            setBounds(options.getX(), options.getY(), options.getWidth(),                    options.getHeight());        }        if (options.getOpenTips() && !byCommandLine) {            TipsDialog tips = new TipsDialog(this, options.getOpenTips());            tips.show();            tips.toFront(); // somehow assure, that the TipsDialog is the top            // window an MacOS        }        applyComponentOrientation(GanttLanguage.getInstance()                .getComponentOrientation());        myTaskManager.addTaskListener(new TaskModelModificationListener(this));        if (ourWindowListener != null) {            addWindowListener(ourWindowListener);        }        addMouseListenerToAllContainer(this.getComponents());        myDelayManager = new DelayManager(myTaskManager, tree);        Mediator.registerDelayManager(myDelayManager);        myDelayManager.addObserver(tree);        myTaskManager.addTaskListener(myDelayManager);    }    private void addMouseListenerToAllContainer(Component[] cont) {        for (int i = 0; i < cont.length; i++) {            cont[i].addMouseListener(getStopEditingMouseListener());            if (cont[i] instanceof Container)                addMouseListenerToAllContainer(((Container) cont[i])                        .getComponents());        }    }    /**     * Returns a mouseListener that stop the edition in the ganttTreeTable.     *      * @return A mouseListener that stop the edition in the ganttTreeTable.     */    private MouseListener getStopEditingMouseListener() {        if (myStopEditingMouseListener == null)            myStopEditingMouseListener = new MouseAdapter() {                public void mouseClicked(MouseEvent e) {                    if (e.getSource() != bNewTask && e.getClickCount() == 1)                        tree.stopEditing();                    if (e.getButton() == MouseEvent.BUTTON1                            && !(e.getSource() instanceof JTable)                            && !(e.getSource() instanceof AbstractButton)) {                        Task taskUnderPointer = area.new MouseSupport()                                .findTaskUnderMousePointer(e.getX(), e.getY());                        if (taskUnderPointer == null) {                            tree.selectTreeRow(-1);                        }                    }                }            };        return myStopEditingMouseListener;    }    private void createProjectMenu() {        mServer = new JMenu();        mServer.setIcon(new ImageIcon(getClass().getResource(                "/icons/server_16.gif")));        myProjectMenu = new ProjectMenu(this);        mProject.add(myProjectMenu.getNewProjectAction());        mProject.add(myProjectMenu.getOpenProjectAction());        mProject.add(mMRU);        updateMenuMRU();        mProject.addSeparator();        mProject.add(myProjectMenu.getSaveProjectAction());        mProject.add(myProjectMenu.getSaveProjectAsAction());        mProject.addSeparator();        //        ImportFileAction importFile = new ImportFileAction(getUIFacade(), this);        mProject.add(importFile);        ExportFileAction exportFile = new ExportFileAction(getUIFacade(), getProject(),                options);        mProject.add(exportFile);        // miExport = createNewItem("/icons/export_16.gif");        // mProject.add(miExport);        mProject.addSeparator();        mServer.add(myProjectMenu.getOpenURLAction());        mServer.add(myProjectMenu.getSaveURLAction());        mProject.add(mServer);        mProject.addSeparator();        mProject.add(myProjectMenu.getPrintAction());        miPreview = createNewItem("/icons/preview_16.gif");        mProject.add(miPreview);        mProject.addSeparator();        mProject.add(myProjectMenu.getExitAction());    }    private JMenu createViewMenu() {        JMenu result = changeMenuLabel(new JMenu(), language.getText("view"));        result.add(miChartOptions);        Chart[] charts = Mediator.getPluginManager().getCharts();        if (charts.length > 0)            result.addSeparator();        for (int i = 0; i < charts.length; i++) {            result.add(new JCheckBoxMenuItem(new ToggleChartAction(charts[i],                    getViewManager())));        }        return result;    }    public GanttProject(boolean isOnlyViewer) {        this(isOnlyViewer, false);    }    /**     * Updates the last open file menu items.     */    private void updateMenuMRU() {        mMRU.removeAll();        int index = 0;        Iterator iterator = documentsMRU.iterator();        while (iterator.hasNext()) {            index++;            Document document = (Document) iterator.next();            JMenuItem mi = new JMenuItem(new OpenDocumentAction(index,                    document, this));            mMRU.add(mi);        }    }    public String getXslDir() {        return options.getXslDir();    }    /** @return the options of ganttproject. */    public GanttOptions getOptions() {        return options;    }    public void restoreOptions() {        options.initByDefault(); // options by default        iconList = initIconList();        deletedIconList = initDeletedIconList();        addButtons();        myUIConfiguration = options.getUIConfiguration();        GanttGraphicArea.taskDefaultColor = new Color(140, 182, 206);        area.repaint();    }    /** @return the status Bar of the main frame. *///    public GanttStatusBar getStatusBar() {//        return statusBar;//    }    public String getXslFo() {        return options.getXslFo();    }    /** Create memonic for keyboard */    public void setMemonic() {        int MENU_MASK = GPAction.MENU_MASK;        // --UNDO----------------------------------        miUndo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, MENU_MASK));        // --REDO----------------------------------        miRedo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, MENU_MASK));        if (!isOnlyViewer) {            miOptions.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G,                    MENU_MASK));            miDeleteTask.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D,                    MENU_MASK));        }    }    /** Create an item with a label */    public JMenuItem createNewItemText(String label) {        JMenuItem item = new JMenuItem(label);        item.addActionListener(this);        return item;    }    /** Create an item with an icon */    public JMenuItem createNewItem(String icon) {        URL url = getClass().getResource(icon);        JMenuItem item = url == null ? new JMenuItem() : new JMenuItem(                new ImageIcon(url));        item.addActionListener(this);        return item;    }    /** Create an item with a label and an icon */    public JMenuItem createNewItem(String label, String icon) {        JMenuItem item = new JMenuItem(label, new ImageIcon(getClass()                .getResource(icon)));        item.addActionListener(this);        return item;    }    /** Function to change language of the project */    public void changeLanguage() {        if (helpFrame != null)            helpFrame.dispose();        helpFrame = null;        applyComponentOrientation(language.getComponentOrientation());        changeLanguageOfMenu();        area.repaint();        getResourcePanel().area.repaint();        getResourcePanel().refresh(language);        this.tree.changeLanguage(language);        CustomColumnsStorage.changeLanguage(language);        applyComponentOrientation(language.getComponentOrientation());        // change the value of the separators in iconList        for (int i = 0; i < iconList.size(); i++)            if (iconList.getElementAt(i).getClass() != TestGanttRolloverButton.class) {                iconList.removeElementAt(i);                iconList.add(i, GPToolBar.SEPARATOR_OBJECT);            }    }    /** Change the style of the application */    public void changeLookAndFeel(GanttLookAndFeelInfo lookAndFeel) {

⌨️ 快捷键说明

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