📄 ganttproject.java
字号:
"/icons/export_" + options.getIconSize() + ".gif"))); bExport.addActionListener(this); // toolBar.add(bExport); // ///////////////////////////////////////////////////////////////////////////////////////////////////////// bPrint = new TestGanttRolloverButton(myProjectMenu.getPrintAction()); bPreviewPrint = new TestGanttRolloverButton(new ImageIcon( getClass().getResource( "/icons/preview_" + options.getIconSize() + ".gif"))); bPreviewPrint.addActionListener(this); // toolBar.add(bPrint); // ///////////////////////////////////////////////////////////////////////////////////////////////////////// // toolBar.addSeparator(new Dimension(20,0)); // ///////////////////////////////////////////////////////////////////////////////////////////////////////// bComparePrev = new TestGanttRolloverButton( new ImageIcon(getClass().getResource( "/icons/comparePrev_" + options.getIconSize() + ".gif"))); bComparePrev.setEnabled(false); bComparePrev.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { compareToPreviousState(); if (myPreviousStates.size() == 0) bComparePrev.setEnabled(false); } }); // ///////////////////////////////////////////////////////////////////////////////////////////////////////// bSaveCurrent = new TestGanttRolloverButton(new ImageIcon(getClass() .getResource( "/icons/saveCurrentAsPrev_" + options.getIconSize() + ".gif"))); bSaveCurrent.setEnabled(false); bSaveCurrent.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveAsPreviousState(); } }); // ///////////////////////////////////////////////////////////////////////////////////////////////////////// bCut = new TestGanttRolloverButton(getCutAction()); bCopy = new TestGanttRolloverButton(getCopyAction()); bPaste = new TestGanttRolloverButton(getPasteAction()); myNewArtefactAction = new NewArtefactAction( new NewArtefactAction.ActiveActionProvider() { public AbstractAction getActiveAction() { return getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX ? (AbstractAction) myNewTaskAction : (AbstractAction) myNewHumanAction; } }, options.getIconSize()); bNewTask = new TestGanttRolloverButton(myNewArtefactAction); myRolloverActions.add(myNewArtefactAction); bDelete = new TestGanttRolloverButton( new ImageIcon(getClass().getResource( "/icons/delete_" + options.getIconSize() + ".gif"))); bDelete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX) {// Gantt // Chart // deleteTask(); deleteTasks(true); } else if (getTabs().getSelectedIndex() == UIFacade.RESOURCES_INDEX) { // Resource // chart final ProjectResource[] context = getResourcePanel() .getContext().getResources(); if (context.length > 0) { Choice choice = getUIFacade().showConfirmationDialog(getLanguage() .getText("msg6") + getDisplayName(context) + "?", getLanguage().getText("question")); if (choice==Choice.YES) { getUndoManager().undoableEdit("Delete Human OK", new Runnable() { public void run() { for (int i = 0; i < context.length; i++) { context[i].delete(); } } }); refreshProjectInfos(); } } } } }); // if(!isOnlyViewer) toolBar.add(bDelete); // ///////////////////////////////////////////////////////////////////////////////////////////////////////// bProperties = new TestGanttRolloverButton(new ImageIcon(getClass() .getResource( "/icons/properties_" + options.getIconSize() + ".gif"))); bProperties.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (getTabs().getSelectedIndex() == UIFacade.GANTT_INDEX) {// Gantt // Chart propertiesTask(); } else if (getTabs().getSelectedIndex() == UIFacade.RESOURCES_INDEX) { // Resource // chart getResourcePanel().getResourcePropertiesAction().actionPerformed(null); } } }); // ///////////////////////////////////////////////////////////////////////////////////////////////////////// ScrollingManager scrollingManager = getScrollingManager(); scrollingManager.addScrollingListener(area.getViewState()); scrollingManager.addScrollingListener(getResourcePanel().area .getViewState()); // Action scrollLeft = new ScrollGanttChartLeftAction(scrollingManager, // options.getIconSize()); // myRolloverActions.add(scrollLeft); // bPrev = new TestGanttRolloverButton(scrollLeft); // bPrev.setAutoRepeatMousePressedEvent(300); // toolBar.add(bPrev); Action scrollCenter = area.getScrollCenterAction(scrollingManager, Mediator.getTaskSelectionManager(), options.getIconSize()); myRolloverActions.add(scrollCenter); bScrollCenter = new TestGanttRolloverButton(scrollCenter); bScrollCenter.setAutoRepeatMousePressedEvent(300); // toolBar.add(bScrollCenter); // Action scrollRight = new ScrollGanttChartRightAction(scrollingManager, // options.getIconSize()); // myRolloverActions.add(scrollRight); // bNext = new TestGanttRolloverButton(scrollRight); // bNext.setAutoRepeatMousePressedEvent(300); // toolBar.add(bNext); // ///////////////////////////////////////////////////////////////////////////////////////////////////////// Action zoomOut = new ZoomOutAction(getZoomManager(), options .getIconSize()); myRolloverActions.add(zoomOut); bZoomOut = new TestGanttRolloverButton(zoomOut); // ///////////////////////////////////////////////////////////////////////////////////////////////////////// Action zoomIn = new ZoomInAction(getZoomManager(), options .getIconSize()); myRolloverActions.add(zoomIn); bZoomIn = new TestGanttRolloverButton(zoomIn); // toolBar.add(bZoomIn); // ///////////////////////////////////////////////////////////////////////////////////////////////////////// bAbout = new TestGanttRolloverButton( new ImageIcon(getClass().getResource( "/icons/manual_" + options.getIconSize() + ".gif"))); bAbout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aboutDialog(); } }); Action undo = new UndoAction(getUndoManager(), options.getIconSize(), this); myRolloverActions.add(undo); bUndo = new TestGanttRolloverButton(undo); Action redo = new RedoAction(getUndoManager(), options.getIconSize(), this); myRolloverActions.add(redo); bRedo = new TestGanttRolloverButton(redo); Action critic = new CalculateCriticalPathAction(getTaskManager(), tree, options, getUIConfiguration(), this); myRolloverActions.add(critic); bCritical = new TestGanttRolloverButton(critic); bRefresh = new TestGanttRolloverButton(new ImageIcon( getClass().getResource( "/icons/refresh_" + options.getIconSize() + ".gif"))); bRefresh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getUIFacade().setStatusText(GanttLanguage.getInstance().getText("refresh")); getUIFacade().refresh(); } }); bShowHiddens = new TestGanttRolloverButton(new ImageIcon(getClass() .getResource("/icons/showHiddens.gif"))); bShowHiddens.addActionListener(this); iconList = initIconList(); deletedIconList = initDeletedIconList(); addButtons(); applyButtonOptions(); } protected void saveAsPreviousState() { getUIFacade().setStatusText(GanttLanguage.getInstance().getText("saveCurrent")); GanttDialogSaveAsPreviousState ps = new GanttDialogSaveAsPreviousState( this); ps.show(); if (ps.isSaved()) { bSaveCurrent.setEnabled(false); bComparePrev.setEnabled(true); myPreviousStates.add(ps.getPreviousState()); } } public ArrayList getPreviouStates() { return myPreviousStates; } protected void compareToPreviousState() { getUIFacade().setStatusText(GanttLanguage.getInstance().getText("comparePrev")); GanttDialogCompareToPreviousState cp = new GanttDialogCompareToPreviousState( this); cp.show(); } private void aboutDialog() { AboutDialog agp = new AboutDialog(this); agp.show(); } private String getDisplayName(Object[] objs) { if (objs.length == 1) { return objs[0].toString(); } StringBuffer result = new StringBuffer(); for (int i = 0; i < objs.length; i++) { result.append(objs[i].toString()); if (i < objs.length - 1) { result.append(", "); } } return result.toString(); } /** Exit the Application */ private void exitForm(java.awt.event.WindowEvent evt) { quitApplication(); } /** * Check if the project has been modified, before creating a new one or open * another */ public boolean checkCurrentProject() { GanttDialogInfo gdiSaveError = new GanttDialogInfo(this, GanttDialogInfo.ERROR, GanttDialogInfo.YES_NO_CANCEL_OPTION, language.getText("msg12"), language.getText("error")); if (askForSave == true) { UIFacade.Choice saveChoice = getUIFacade().showConfirmationDialog(language.getText("msg1"), language.getText("warning")); if (UIFacade.Choice.CANCEL==saveChoice) { return false; } if (UIFacade.Choice.YES==saveChoice) { boolean trySave = true; do { try { trySave = false; saveProject(); } catch (Exception e) { System.err.println(e); e.printStackTrace(); gdiSaveError.show(); if (gdiSaveError.res == GanttDialogInfo.CANCEL) return false; trySave = (gdiSaveError.res == GanttDialogInfo.YES); } } while (trySave); } } return true; } /** A menu has been activate */ public void actionPerformed(ActionEvent evt) { if (evt.getSource() instanceof JMenuItem) { String arg = evt.getActionCommand(); // ///////////////////////////////////////////////////////////////////////////////////////////////////////// if (arg.equals(language.getText("hideTask"))) { tree.hideSelectedNodes(); } else if (arg.equals(language.getText("displayHiddenTasks"))) { tree.displayHiddenTasks(); } // ///////////////////////////////////////////////////////////////////////////////////////////////////////// else if (arg.equals(correctLabel(language.getText("preview")))) { previewPrint(); } // ///////////////////////////////////////////////////////////////////////////////////////////////////////// else if (arg.equals(correctLabel(language.getText("deleteTask")))) { deleteTasks(true); } // ///////////////////////////////////////////////////////////////////////////////////////////////////////// else if (arg .equals(correctLabel(language.getText("editCalendars")))) { GanttDialogCalendar dialogCalendar = new GanttDialogCalendar( this); dialogCalendar.show(); } // ///////////////////////////////////////////////////////////////////////////////////////////////////////// else if (arg.equals(correctLabel(language .getText("projectCalendar")))) { System.out.println("Project calendar"); } // ///////////////////////////////////////////////////////////////////////////////////////////////////////// else if (arg.equals(correctLabel(language.getText("webPage")))) { try { openWebPage(); } catch (Exception e) { System.err.println(e); } } // ///////////////////////////////////////////////////////////////////////////////////////////////////////// else if (arg.equals(correctLabel(language.getText("tipsOfTheDay")))) { TipsDialog tips = new TipsDialog(this, options.getOpenTips()); tips.show(); } // ////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -