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

📄 gantttaskpropertiesbean.java

📁 It is all about project scheduling. GanttProject is a tool for creating a project schedule by means
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
package net.sourceforge.ganttproject.gui;/** * * <p>Title: </p> * * <p>Description: Provide the properties of selected task</p> * * <p>Copyright: Copyright (c) 2003</p> * * <p>Company: </p> * * @author ganttproject * * @version 1.0 * */import java.awt.BorderLayout;import java.awt.Color;import java.awt.Component;import java.awt.Container;import java.awt.FlowLayout;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.FocusAdapter;import java.awt.event.FocusEvent;import java.util.Hashtable;import javax.swing.BorderFactory;import javax.swing.Icon;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JColorChooser;import javax.swing.JComboBox;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JSpinner;import javax.swing.JTabbedPane;import javax.swing.JTextArea;import javax.swing.JTextField;import javax.swing.SpinnerNumberModel;import javax.swing.SpringLayout;import javax.swing.UIManager;import javax.swing.border.EtchedBorder;import javax.swing.border.TitledBorder;import javax.swing.event.ChangeEvent;import javax.swing.event.ChangeListener;import javax.swing.tree.DefaultMutableTreeNode;import org.jdesktop.swing.JXDatePicker;import net.sourceforge.ganttproject.GanttCalendar;import net.sourceforge.ganttproject.GanttGraphicArea;import net.sourceforge.ganttproject.GanttProject;import net.sourceforge.ganttproject.GanttTask;import net.sourceforge.ganttproject.GanttTree2;import net.sourceforge.ganttproject.Mediator;import net.sourceforge.ganttproject.gui.options.SpringUtilities;import net.sourceforge.ganttproject.gui.taskproperties.CustomColumnsPanel;import net.sourceforge.ganttproject.gui.taskproperties.TaskAllocationsPanel;import net.sourceforge.ganttproject.gui.taskproperties.TaskDependenciesPanel;import net.sourceforge.ganttproject.language.GanttLanguage;import net.sourceforge.ganttproject.resource.HumanResourceManager;import net.sourceforge.ganttproject.roles.RoleManager;import net.sourceforge.ganttproject.shape.JPaintCombo;import net.sourceforge.ganttproject.shape.ShapeConstants;import net.sourceforge.ganttproject.shape.ShapePaint;import net.sourceforge.ganttproject.task.Task;import net.sourceforge.ganttproject.task.TaskContainmentHierarchyFacade;import net.sourceforge.ganttproject.task.TaskImpl;import net.sourceforge.ganttproject.task.TaskManager;import net.sourceforge.ganttproject.task.TaskMutator;import net.sourceforge.ganttproject.util.BrowserControl;/** * Real panel for editing task properties */public class GanttTaskPropertiesBeanextends JPanel {    private JXDatePicker myStartDatePicker;    private JXDatePicker myEndDatePicker;    private JXDatePicker myThirdDatePicker;    // Input attributes    // protected GanttTask selectedTask; //Task whose properties will be shown    protected GanttTask[] selectedTasks;    //private GanttTree2 tree; // GanttTree that contain all the tasks information    private GanttLanguage language = GanttLanguage.getInstance(); // language    // Output attributes: you can find the definition is GanttTask    // private String name;    private int length;    private int percentComplete;    private int priority;    private GanttCalendar start;    private GanttCalendar end;    private GanttCalendar third;    private boolean bilan;	private boolean isProjectTask;	    private String notes;    // private GanttTask selectedTaskClone;    // private Hashtable managerHash;    //    // private Hashtable assignedResources = new Hashtable();    // private attributes for internal use    GridBagConstraints gbc = new GridBagConstraints();    FlowLayout flowL = new FlowLayout(FlowLayout.LEFT, 10, 10);    JTabbedPane tabbedPane; // TabbedPane that include the following four items    JPanel generalPanel;    JPanel predecessorsPanel;    JPanel resourcesPanel;    JPanel notesPanel;    // Components on general pannel    JPanel firstRowPanel1; // components in first row    JTextField nameField1;    JTextField durationField1;    JLabel nameLabel1;    JLabel durationLabel1;    JLabel lblWebLink;    JTextField tfWebLink;    JButton bWebLink;    JPanel secondRowPanel1; // components in second row    JSpinner percentCompleteSlider;    JLabel percentCompleteLabel1;    JLabel priorityLabel1;    JComboBox priorityComboBox;    JPanel thirdRowPanel1; // componets in third row    JTextField startDateField1;    JTextField finishDateField1;    JTextField thirdDateField1;    JLabel startDateLabel1;    JLabel finishDateLabel1;    JComboBox thirdDateComboBox;    JButton startDateButton1;    JButton finishDateButton1;    JButton thirdDateButton1;    JPanel lastRowPanel1; // components in last row    JPanel webLinkPanel; // components in web link panel    JLabel mileStoneLabel1;    JCheckBox mileStoneCheckBox1;    JCheckBox projectTaskCheckBox1;	    JButton colorButton;        boolean isColorChanged;    JButton colorSpace;    JPanel colorPanel;    /** Shape chooser combo Box */    JPaintCombo shapeComboBox;    // Components on predecessors pannel    JLabel nameLabel2; // first row, here the textfield is un-editable    JLabel durationLabel2;    JTextField nameField2;    JPanel firstRowPanel2;    JScrollPane predecessorsScrollPane; // second row, a table    JLabel nameLabelNotes;    JLabel durationLabelNotes;    JTextField nameFieldNotes;    JTextField durationFieldNotes;    JScrollPane scrollPaneNotes;    JTextArea noteAreaNotes;    JPanel firstRowPanelNotes;    JPanel secondRowPanelNotes;    // Component on the SOUTH ok CANCEL buttons    //public JButton okButton;    //JButton cancelButton;    //JPanel southPanel;    private boolean onlyOneTask = false;    private String taskWebLink;    private boolean taskIsMilestone;    private GanttCalendar taskStartDate;    private GanttCalendar taskEndDate;    private GanttCalendar taskThirdDate;    private int taskThirdDateConstraint;		private boolean taskIsProjectTask;	    private int taskLength;    private String taskNotes;    private int taskCompletionPercentage;    private int taskPriority;    private ShapePaint taskShape;    private CustomColumnsPanel myCustomColumnPanel = null;    // private ResourcesTableModel myResourcesTableModel;    private TaskDependenciesPanel myDependenciesPanel;    private TaskAllocationsPanel[] myAllocationsPanel;    //private boolean isStartFixed;//    private boolean isFinishFixed;    private final HumanResourceManager myHumanResourceManager;    private final RoleManager myRoleManager;    private Task myUnpluggedClone;	private TaskManager myTaskManager;    /** add a component to container by using GridBagConstraints. */    private void addUsingGBL(Container container, Component component,    GridBagConstraints gbc, int x,    int y, int w, int h) {        gbc.gridx = x;        gbc.gridy = y;        gbc.gridwidth = w;        gbc.gridheight = h;        gbc.weighty = 0;        container.add(component, gbc);    }    /** set the first row in all the tabbed pane. thus give them a common look */    private void setFirstRow(Container container, GridBagConstraints gbc,            JLabel nameLabel, JTextField nameField, JLabel durationLabel,            JTextField durationField) {        container.setLayout(new GridBagLayout());        gbc.weightx = 0;        gbc.weighty = 0;        gbc.anchor = GridBagConstraints.WEST;        gbc.insets.right = 15;        gbc.insets.left = 10;        gbc.insets.top = 10;        addUsingGBL(container, nameLabel, gbc, 0, 0, 1, 1);        addUsingGBL(container, nameField, gbc, 1, 0, 1, 1);        addUsingGBL(container, durationLabel, gbc, 2, 0, 1, 1);        gbc.weightx = 1;        addUsingGBL(container, durationField, gbc, 3, 0, 1, 1);    }    /** Construct the general panel */    private void constructGeneralPanel() {        generalPanel = new JPanel(new GridBagLayout());        // first row        nameLabel1 = new JLabel(language.getText("name") + ":");        nameField1 = new JTextField(20);        nameField1.setName("name_of_task");        if (!onlyOneTask) {            nameLabel1.setVisible(false);            nameField1.setVisible(false);        }        durationLabel1 = new JLabel(language.getText("length") + ":");        durationField1 = new JTextField(8);        durationField1.setName("length");        firstRowPanel1 = new JPanel(flowL);        setFirstRow(firstRowPanel1, gbc, nameLabel1, nameField1,                durationLabel1, durationField1);        // second row        percentCompleteLabel1 = new JLabel(language.getText("advancement")); // Progress        SpinnerNumberModel spinnerModel = new SpinnerNumberModel(0, 0, 100, 1);        percentCompleteSlider = new JSpinner(spinnerModel);        secondRowPanel1 = new JPanel(flowL);        secondRowPanel1.add(percentCompleteLabel1);        // secondRowPanel1.add(percentCompleteField1);        secondRowPanel1.add(percentCompleteSlider);        priorityLabel1 = new JLabel(language.getText("priority"));        secondRowPanel1.add(priorityLabel1);        priorityComboBox = new JComboBox();        priorityComboBox.addItem(language.getText("low"));        priorityComboBox.addItem(language.getText("normal"));        priorityComboBox.addItem(language.getText("hight"));        priorityComboBox.setEditable(false);        secondRowPanel1.add(priorityComboBox);        // third row        startDateLabel1 = new JLabel(language.getText("dateOfBegining") + ":");        startDateField1 = new JTextField(12);        startDateField1.setEditable(false);        finishDateLabel1 = new JLabel(language.getText("dateOfEnd") + ":");        finishDateField1 = new JTextField(12);        finishDateField1.setEditable(false);        thirdDateComboBox = new JComboBox();        thirdDateComboBox.addItem("");        thirdDateComboBox.addItem(language.getText("earliestBegin"));        thirdDateComboBox.setName("third");        thirdDateComboBox.setSelectedIndex(selectedTasks[0]                .getThirdDateConstraint());        thirdDateField1 = new JTextField(12);        thirdDateField1.setEditable(false);        ImageIcon icon = new ImageIcon(getClass().getResource(                "/icons/calendar_16.gif"));        startDateButton1 = new TestGanttRolloverButton(icon);        startDateButton1.setName("start");        startDateButton1.setToolTipText(GanttProject.getToolTip(language                .getText("chooseDate")));        finishDateButton1 = new TestGanttRolloverButton(icon);        finishDateButton1.setName("finish");        finishDateButton1.setToolTipText(GanttProject.getToolTip(language                .getText("chooseDate")));        thirdDateButton1 = new TestGanttRolloverButton(icon);        thirdDateButton1.setName("third");        thirdDateButton1.setToolTipText(GanttProject.getToolTip(language                .getText("chooseDate")));        if (selectedTasks[0].getThirdDateConstraint() == 0)            thirdDateButton1.setEnabled(false);        thirdRowPanel1 = new JPanel(flowL);        thirdRowPanel1.setBorder(new TitledBorder(new EtchedBorder(), language                .getText("date")));                JPanel startDatePanel = new JPanel(                new FlowLayout(FlowLayout.LEFT, 5, 0));        startDatePanel.add(startDateLabel1);        myStartDatePicker = createDatePicker(new ActionListener() {            public void actionPerformed(ActionEvent e) {                setStart(new GanttCalendar(((JXDatePicker)e.getSource()).getDate()), false);            }        });         startDatePanel.add(myStartDatePicker);        //startDatePanel.add(startDateButton1);                        JPanel finishDatePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5,                0));        finishDatePanel.add(finishDateLabel1);        myEndDatePicker = createDatePicker(new ActionListener() {            public void actionPerformed(ActionEvent e) {                setEnd(new GanttCalendar(((JXDatePicker)e.getSource()).getDate()), false);

⌨️ 快捷键说明

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