Package net.sourceforge.ganttproject.gui

Examples of net.sourceforge.ganttproject.gui.TestGanttRolloverButton$MouseOverHandler


        for (int i = 0; i < myPreviousStates.size(); i++)
            nameComboBox.addItem(((GanttPreviousState) myPreviousStates.get(i))
                    .getName());
        nameComboBox.setSelectedIndex(myPreviousStates.size());
        nameComboBox.setName("nameComboBox");
        removeButton = new TestGanttRolloverButton(new ImageIcon(getClass()
                .getResource("/icons/delete_16.gif")));
        removeButton.setToolTipText(GanttProject.getToolTip(lang
                .getText("delete")));
        removeButton.setName("remove");
        generalPanel.add(nameComboBox);
View Full Code Here


        vbproject.add(orgaPanel);
        vbproject.add(tfOrganization = new JTextField());
        vbproject.add(new JPanel());

        tfWebLink = new JTextField();
        JButton bWeb = new TestGanttRolloverButton(new ImageIcon(getClass()
                .getResource("/icons/web_16.gif")));
        bWeb.setToolTipText(GanttProject.getToolTip(language
                .getText("openWebLink")));
        bWeb.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                // link to open the web link
                if (!BrowserControl.displayURL(tfWebLink.getText())) {
                    GanttDialogInfo gdi = new GanttDialogInfo(null,
                            GanttDialogInfo.ERROR, GanttDialogInfo.YES_OPTION,
View Full Code Here

        secondResourcesScrollPane.setBorder(new TitledBorder(
                new EtchedBorder(), GanttProject.correctLabel(getLanguage()
                        .getText("human"))));
        secondResourcesScrollPane.add(resourcesScrollPane);

        JButton bremove = new TestGanttRolloverButton(new ImageIcon(getClass()
                .getResource("/icons/delete_16.gif")));
        bremove.setToolTipText(GanttProject.getToolTip(getLanguage().getText(
                "removeResources")));
        bremove.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                int[] selectedRow = resourcesTable.getSelectedRows();
                for (int i = 0; i < selectedRow.length; ++i) {
                    resourcesTable.getModel().setValueAt(null, selectedRow[i],
                            1);
View Full Code Here

        JPanel secondPredecessorsPanel = new JPanel();
        secondPredecessorsPanel.setBorder(new TitledBorder(new EtchedBorder(),
                language.getText("predecessors")));
        secondPredecessorsPanel.add(predecessorsScrollPane);

        JButton bremove = new TestGanttRolloverButton(new ImageIcon(getClass()
                .getResource("/icons/delete_16.gif")));
        bremove.setToolTipText(GanttProject.getToolTip(language
                .getText("removeRelationShip")));
        bremove.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                int[] selectedRow = predecessorsTable.getSelectedRows();
                for (int i = 0; i < selectedRow.length; ++i) {
                    predecessorsTable.getModel().setValueAt(null,
                            selectedRow[i], 1);
View Full Code Here

    /** Create the button on toolbar */
    public void addButtons(JToolBar toolBar) {
        // toolBar.addSeparator(new Dimension(20,0));
        // /////////////////////////////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////////////////////////////
        bNew = new TestGanttRolloverButton(myProjectMenu.getNewProjectAction());
        bOpen = new TestGanttRolloverButton(myProjectMenu.getOpenProjectAction());
        bSave = new TestGanttRolloverButton(myProjectMenu.getSaveProjectAction());
        // /////////////////////////////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////////////////////////////
        bImport = new TestGanttRolloverButton(
                new ImageIcon(getClass().getResource(
                        "/icons/import_" + options.getIconSize() + ".gif")));
        bImport.addActionListener(this);
        // toolBar.add(bImport);
        // /////////////////////////////////////////////////////////////////////////////////////////////////////////
        bExport = new TestGanttRolloverButton(
                new ImageIcon(getClass().getResource(
                        "/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();
                                    }
                                }
                            });
                            repaint2();
                            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();
View Full Code Here

        return myTabContentPanel;
    }

    private Component createButtonPanel() {
        Box buttonBar = Box.createHorizontalBox();
        TestGanttRolloverButton upButton = new TestGanttRolloverButton(myTreeFacade.getMoveUpAction());
        upButton.setTextHidden(true);
        buttonBar.add(upButton);
        //
        TestGanttRolloverButton downButton = new TestGanttRolloverButton(myTreeFacade.getMoveDownAction());
        downButton.setTextHidden(true);
        buttonBar.add(downButton);
        //
        JPanel buttonPanel = new JPanel(new BorderLayout());
        buttonPanel.add(buttonBar, BorderLayout.WEST);
        return buttonPanel;
View Full Code Here

   
    private Component createButtonPanel() {
        Box buttonBar = Box.createHorizontalBox();
        //JToolBar buttonBar = new JToolBar();
        //buttonBar.setFloatable(false);
        TestGanttRolloverButton unindentButton = new TestGanttRolloverButton(myTreeFacade.getUnindentAction()) {
      public String getText() {
        return null;
      }       
        };
        buttonBar.add(unindentButton);
       
        TestGanttRolloverButton indentButton = new TestGanttRolloverButton(myTreeFacade.getIndentAction()) {
      public String getText() {
        return null;
      }                 
        };
        buttonBar.add(indentButton);
        //
        buttonBar.add(Box.createHorizontalStrut(3));
        //
        TestGanttRolloverButton upButton = new TestGanttRolloverButton(myTreeFacade.getMoveUpAction()) {
      public String getText() {
        return null;
      }                 
        };
        buttonBar.add(upButton);
        //
        TestGanttRolloverButton downButton = new TestGanttRolloverButton(myTreeFacade.getMoveDownAction()) {
      public String getText() {
        return null;
      }                 
        };
        buttonBar.add(downButton);
        //
        buttonBar.add(Box.createHorizontalStrut(8));
        Action linkAction = new LinkTasksAction(myProject.getTaskManager(), Mediator.getTaskSelectionManager(), myWorkbenchFacade);
        myTreeFacade.setLinkTasksAction(linkAction);
        TestGanttRolloverButton linkButton = new TestGanttRolloverButton(linkAction) {
      public String getText() {
        return null;
      }                 
        };
        buttonBar.add(linkButton);
        //
        Action unlinkAction = new UnlinkTasksAction(myProject.getTaskManager(), Mediator.getTaskSelectionManager(), myWorkbenchFacade);
        myTreeFacade.setUnlinkTasksAction(unlinkAction);
        TestGanttRolloverButton unlinkButton = new TestGanttRolloverButton(unlinkAction) {
      public String getText() {
        return null;
      }                 
        };
        buttonBar.add(unlinkButton);
View Full Code Here

        invalidate();
    }

    void updateButtonsLook() {
        for (int i=0; i<myButtons.size(); i++) {
            TestGanttRolloverButton nextButton = (TestGanttRolloverButton) myButtons.get(i);
            nextButton.setIconHidden(options.getButtonShow() == GanttOptions.TEXT);
            nextButton.setTextHidden(options.getButtonShow() == GanttOptions.ICONS);
        }
        invalidate();
    }
View Full Code Here

        myPrintable = new GanttPrintable(myChart.getChart(myExportSettings),
                GanttPrintable.REDUCE_FACTOR_DEFAULT);
        JToolBar tb = new JToolBar();
        JToolBar tb2 = new JToolBar();

        JButton bPrint = new TestGanttRolloverButton(new ImageIcon(getClass()
                .getResource("/icons/print_16.gif")));
        bPrint.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                print();
            }
        });

        JButton bClose = bClose = new TestGanttRolloverButton(new ImageIcon(
                getClass().getResource("/icons/exit_16.gif")));
        bClose.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                dispose();
            }
        });

        final JButton bPortrait = new TestGanttRolloverButton(new ImageIcon(
                getClass().getResource("/icons/portrait_16.gif")));
        final JButton bLandscape = new TestGanttRolloverButton(new ImageIcon(
                getClass().getResource("/icons/landscape_16.gif")));

        bPortrait.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                run(new Runnable() {
                    public void run() {
                        changePageOrientation(PageFormat.PORTRAIT);
                        bLandscape.setEnabled(true);
                        bPortrait.setEnabled(false);
                    }
                });
            }
        });

        bLandscape.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                run(new Runnable() {
                    public void run() {
                        changePageOrientation(PageFormat.LANDSCAPE);
                        bLandscape.setEnabled(false);
                        bPortrait.setEnabled(true);
                    }
                });
            }
        });
        bLandscape.setEnabled(false);
        String[] scales = { "10 %", "25 %", "50 %", "100 %" };
        myComboScale = new JComboBox(scales);
        myComboScale.setSelectedIndex(2);
        myComboScale.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                run(new Runnable() {
                    public void run() {
                        changeScale();
                    }
                });
            }
        });

        myComboScale.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent arg0) {
                run(new Runnable() {
                    public void run() {
                        changeScale();
                    }
                });
            }
        });

        Dimension dim = myComboScale.getPreferredSize();
        dim.setSize(dim.getWidth() + 20, dim.getHeight());
        myComboScale.setMaximumSize(dim);
        myComboScale.setPreferredSize(dim);
        myComboScale.setEditable(true);

        boolean isDate = start != null && end != null;
        ImageIcon icon = new ImageIcon(getClass().getResource(
                "/icons/calendar_16.gif"));

        myStart.lock();
        myFinish.lock();
        if (isDate) {
            /*
            myStartDateButton = new JButton(new GanttCalendar(myStartDate)
                    .toString(), icon);
            myStartDateButton.setHorizontalTextPosition(SwingConstants.RIGHT);
            myStartDateButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    myStartDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myStartDate), false);
                    myStartDialogDate.setVisible(true);
                    if (myStartDialogDate.getValue() == GanttDialogDate.OK) {
                        myStartDate = myStartDialogDate.getDate().getTime();
                        myStartDateButton
                                .setText(new GanttCalendar(myStartDate)
                                        .toString());
                        myExportSettings.setStartDate(myStartDate);
                        updateSourceImage(myChart.getChart(myExportSettings));
                    }
                }
            });

            myEndDateButton = new JButton(new GanttCalendar(myEndDate)
                    .toString(), icon);
            myEndDateButton.setHorizontalTextPosition(SwingConstants.RIGHT);
            myEndDateButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    myEndDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myEndDate), false);
                    myEndDialogDate.setVisible(true);
                    if (myEndDialogDate.getValue() == GanttDialogDate.OK) {
                        myEndDate = myEndDialogDate.getDate().getTime();
                        myEndDateButton.setText(new GanttCalendar(myEndDate)
                                .toString());
                        myExportSettings.setEndDate(myEndDate);
                        updateSourceImage(myChart.getChart(myExportSettings));
                    }
                }
            });
            */
            myWholeProjectButton = new JButton(language.getText("wholeProject"));
            myWholeProjectButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    myStart.setValue(myChart.getStartDate());
                    myFinish.setValue(myChart.getEndDate());
                    /*
                    myStartDate = myChart.getStartDate();
                    myEndDate = myChart.getEndDate();
                    myExportSettings.setStartDate(myStartDate);
                    myExportSettings.setEndDate(myEndDate);

                    myEndDateButton.setText(new GanttCalendar(myExportSettings
                            .getEndDate()).toString());
                    myStartDateButton.setText(new GanttCalendar(
                            myExportSettings.getStartDate()).toString());
                    myEndDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myEndDate), false);
                    myStartDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myStartDate), false);
                    updateSourceImage(myChart.getChart(myExportSettings));
                    */
                }
            });
        }
        Vector vMedia = new Vector();
        ;
        // try {
        // vMedia = getAllMediaSizeNameAvailable();
        vMedia.add(MediaSizeName.ISO_A0);
        vMedia.add(MediaSizeName.ISO_A1);
        vMedia.add(MediaSizeName.ISO_A2);
        vMedia.add(MediaSizeName.ISO_A3);
        vMedia.add(MediaSizeName.ISO_A4);
        vMedia.add(MediaSizeName.ISO_A5);
        vMedia.add(MediaSizeName.ISO_A6);
        // } catch (ClassNotFoundException e1) {
        // // TODO Auto-generated catch block
        // e1.printStackTrace();
        // }

        if (vMedia != null) {
            myComboMediaSize = new JComboBox(vMedia);
            dim = myComboMediaSize.getPreferredSize();
            dim.setSize(dim.getWidth() + 20, dim.getHeight());
            myComboMediaSize.setMaximumSize(dim);
            myComboMediaSize.setPreferredSize(dim);
            myComboMediaSize.addItemListener(new ItemListener() {
                public void itemStateChanged(ItemEvent arg0) {
                    run(new Runnable() {
                        public void run() {
                            Object selectedItem = myComboMediaSize
                                    .getSelectedItem();
                            if (selectedItem != null) {
                                myMediaSizeName = (MediaSizeName) selectedItem;
                                MediaSize ms = MediaSize
                                        .getMediaSizeForName(myMediaSizeName);
                                Paper p = new Paper();
                                float[] size = ms.getSize(MediaSize.INCH);
                                p.setSize(size[0] * 72, size[1] * 72);
                                p.setImageableArea(72, 72,
                                        p.getWidth() - 72 * 2,
                                        p.getHeight() - 72 * 2);
                                myPageFormat.setPaper(p);
                                changePageOrientation(myOrientation);
                                statusBar.setText1(ms.getX(MediaSize.MM)
                                        + " x " + ms.getY(MediaSize.MM));
                                myPreviewContainer.repaint();
                            }
                        }
                    });
                }
            });
        }

        bPrint.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("printProject"))));
        bPortrait.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("portrait"))));
        bLandscape.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("landscape"))));
        bClose.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("close"))));
        final JButton bZoomOut;
        final JButton bZoomIn;
View Full Code Here

TOP

Related Classes of net.sourceforge.ganttproject.gui.TestGanttRolloverButton$MouseOverHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.