Search in sources :

Example 1 with JPanelAnalysisTimeDist

use of course_generator.analysis.JPanelAnalysisTimeDist in project Course_Generator by patrovite.

the class frmMain method initComponents.

/**
 * This method is called to initialize the form.
 */
private void initComponents() {
    // -- Main windows
    // ------------------------------------------------------
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle(bundle.getString("frmMain.title"));
    setIconImages(null);
    addWindowListener(new java.awt.event.WindowAdapter() {

        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });
    // -- Layout
    // ------------------------------------------------------------
    Container paneGlobal = getContentPane();
    paneGlobal.setLayout(new BorderLayout());
    // -- Menu bar
    // ----------------------------------------------------------
    Create_MenuBarMain();
    // -- Main toolbar
    // ------------------------------------------------------
    Create_MainToolbar();
    paneGlobal.add(ToolBarMain, BorderLayout.NORTH);
    // -- Status bar
    // ------------------------------------------------------
    Create_Statusbar();
    paneGlobal.add(StatusBar, BorderLayout.SOUTH);
    // -- Main split bar (vertical)
    // -----------------------------------------
    SplitPaneMain = new javax.swing.JSplitPane();
    // -- Disable the default management of F6
    SplitPaneMain.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), "none");
    paneGlobal.add(SplitPaneMain, BorderLayout.CENTER);
    // -- Left side of the split bar
    // ----------------------------------------
    jPanelLeft = new javax.swing.JPanel();
    jPanelLeft.setLayout(new java.awt.BorderLayout());
    // -- Add the left panel to the main split panel
    // ------------------------
    SplitPaneMain.setLeftComponent(jPanelLeft);
    SplitPaneMain.setDividerLocation(0);
    // // -- Content of the tree
    // javax.swing.tree.DefaultMutableTreeNode treeNode1 = new
    // javax.swing.tree.DefaultMutableTreeNode(
    // "Course Generator");
    // javax.swing.tree.DefaultMutableTreeNode treeNode2 = new
    // javax.swing.tree.DefaultMutableTreeNode("Parcours");
    // javax.swing.tree.DefaultMutableTreeNode treeNode3 = new
    // javax.swing.tree.DefaultMutableTreeNode("Utmb 2011");
    // javax.swing.tree.DefaultMutableTreeNode treeNode4 = new
    // javax.swing.tree.DefaultMutableTreeNode("Prévu");
    // treeNode3.add(treeNode4);
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Fait");
    // treeNode3.add(treeNode4);
    // treeNode2.add(treeNode3);
    // treeNode3 = new
    // javax.swing.tree.DefaultMutableTreeNode("Montagnard");
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Prévu");
    // treeNode3.add(treeNode4);
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Fait");
    // treeNode3.add(treeNode4);
    // treeNode2.add(treeNode3);
    // treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("UCDHL2008");
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Prévu");
    // treeNode3.add(treeNode4);
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Fait");
    // treeNode3.add(treeNode4);
    // treeNode2.add(treeNode3);
    // treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("UCDHL2009");
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Prévu");
    // treeNode3.add(treeNode4);
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Fait");
    // treeNode3.add(treeNode4);
    // treeNode2.add(treeNode3);
    // treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("UCDHL2010");
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Prévu");
    // treeNode3.add(treeNode4);
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Fait");
    // treeNode3.add(treeNode4);
    // treeNode2.add(treeNode3);
    // treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("UCDHL2011");
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Prévu");
    // treeNode3.add(treeNode4);
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Fait");
    // treeNode3.add(treeNode4);
    // treeNode2.add(treeNode3);
    // treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("UCDHL2012");
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Prévu");
    // treeNode3.add(treeNode4);
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Fait");
    // treeNode3.add(treeNode4);
    // treeNode2.add(treeNode3);
    // treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("UCDHL2013");
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Prévu");
    // treeNode3.add(treeNode4);
    // treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Fait");
    // treeNode3.add(treeNode4);
    // treeNode2.add(treeNode3);
    // treeNode1.add(treeNode2);
    // treeNode2 = new
    // javax.swing.tree.DefaultMutableTreeNode("Configuration");
    // treeNode1.add(treeNode2);
    // 
    // // -- Tree
    // // --------------------------------------------------------------
    // jTreeMain = new javax.swing.JTree();
    // jTreeMain.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
    // jTreeMain.setPreferredSize(new java.awt.Dimension(109, 25));
    // 
    // // -- Add the tree to a scroll panel
    // // ------------------------------------
    // jScrollPaneTree = new javax.swing.JScrollPane();
    // jScrollPaneTree.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    // jScrollPaneTree.setViewportView(jTreeMain);
    // jScrollPaneTree.setMaximumSize(new Dimension(0,0));
    // 
    // // -- Add the scroll panel to the left panel
    // // ----------------------------
    // jPanelLeft.add(jScrollPaneTree, java.awt.BorderLayout.CENTER);
    // -- Right split pane
    // --------------------------------------------------
    SplitPaneMainRight = new javax.swing.JSplitPane();
    SplitPaneMainRight.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
    // -- Disable the default management of F6
    SplitPaneMainRight.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), "none");
    SplitPaneMain.setRightComponent(SplitPaneMainRight);
    // -- Tabbed panel
    // ------------------------------------------------------
    TabbedPaneMain = new javax.swing.JTabbedPane();
    // -- Create the listener
    ChangeListener changeListener = new ChangeListener() {

        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
            int index = sourceTabbedPane.getSelectedIndex();
            if (// Tab Resume
            index == 4)
                PanelResume.refresh();
        }
    };
    TabbedPaneMain.addChangeListener(changeListener);
    SplitPaneMainRight.setTopComponent(TabbedPaneMain);
    // -- Tab - data (grid)
    // -------------------------------------------------
    panelTrackData = new JPanelTrackData(ModelTableMain, Settings);
    panelTrackData.addListener(new JPanelTrackDataListener() {

        @Override
        public void doubleClickEvent() {
            BackupInCGX();
            frmEditPosition frm = new frmEditPosition();
            if (frm.showDialog(Settings, Track, panelTrackData.getSelectedRow())) {
                Track.isModified = true;
                panelTrackData.refresh();
                panelProfil.RefreshProfilChart();
                Track.CheckTimeLimit();
                RefreshStatusbar(Track);
            }
        }

        @Override
        public void simpleClickEvent() {
            if (Track.data.size() > 0) {
                int row = panelTrackData.getSelectedRow();
                // -- Refresh marker position on the map
                panelMap.RefreshCurrentPosMarker(Track.data.get(row).getLatitude(), Track.data.get(row).getLongitude());
                // -- Refresh profil crooshair position and profil info
                panelProfil.RefreshProfilInfo(row);
                panelProfil.setCrosshairPosition(Track.data.get(row).getTotal(Settings.Unit) / 1000.0, Track.data.get(row).getElevation(Settings.Unit));
            }
        }

        @Override
        public void keyRealeasedEvent() {
            if (Track.data.size() > 0) {
                int row = panelTrackData.getSelectedRow();
                panelMap.RefreshCurrentPosMarker(Track.data.get(row).getLatitude(), Track.data.get(row).getLongitude());
            }
        }
    });
    addTab(TabbedPaneMain, panelTrackData, bundle.getString("frmMain.TabData.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/satellite16.png")));
    // -- Tab - Profil
    // ------------------------------------------------------
    panelProfil = new JPanelProfil(Settings);
    panelProfil.addListener(new JPanelProfilListener() {

        @Override
        public void profilSelectionEvent() {
            int i = panelProfil.getIndex();
            // Refresh the position on the data grid
            panelTrackData.setSelectedRow(i);
            // Refresh the marker position on the map
            panelMap.RefreshCurrentPosMarker(Track.data.get(i).getLatitude(), Track.data.get(i).getLongitude());
        }
    });
    addTab(TabbedPaneMain, panelProfil, bundle.getString("frmMain.TabProfil.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/profil.png")));
    // -- Tab - Statistic
    // ---------------------------------------------------
    panelStatistics = new JPanelStatistics(Settings);
    addTab(TabbedPaneMain, panelStatistics, bundle.getString("frmMain.TabStatistic.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/stat.png")));
    // -- Tab - Analysis
    // ----------------------------------------------------
    jPanelAnalyze = new javax.swing.JPanel();
    jPanelAnalyze.setLayout(new java.awt.BorderLayout());
    addTab(TabbedPaneMain, jPanelAnalyze, bundle.getString("frmMain.TabAnalyze.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/search.png")));
    // -- Create the tab bar
    TabbedPaneAnalysis = new javax.swing.JTabbedPane(JTabbedPane.LEFT);
    jPanelAnalyze.add(TabbedPaneAnalysis, java.awt.BorderLayout.CENTER);
    // -- Tab Analysis : Time/Dist
    jPanelTimeDist = new JPanelAnalysisTimeDist();
    addTab(TabbedPaneAnalysis, jPanelTimeDist, bundle.getString("frmMain.TabTimeDist.tabTitle"), null);
    // -- Tab Analysis : Speed
    jPanelSpeed = new JPanelAnalysisSpeed();
    addTab(TabbedPaneAnalysis, jPanelSpeed, bundle.getString("frmMain.TabSpeed.tabTitle"), null);
    // -- Tab Analysis : Speed/slope
    jPanelSpeedSlope = new JPanelAnalysisSpeedSlope();
    addTab(TabbedPaneAnalysis, jPanelSpeedSlope, bundle.getString("frmMain.TabSpeedSlope.tabTitle"), null);
    // -- Tab - Resume
    // ------------------------------------------------------
    PanelResume = new JPanelResume(Resume, Settings);
    PanelResume.addListener(new JPanelResumeListener() {

        @Override
        public void lineChangeEvent() {
            SelectPositionFromResume(PanelResume.getSelectedLine());
        }
    });
    addTab(TabbedPaneMain, PanelResume, bundle.getString("frmMain.TabResume.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/grid.png")));
    // -- Map panel
    // ---------------------------------------------------------
    panelMap = new JPanelMaps(Settings);
    panelMap.addListener(new JPanelMapsListener() {

        @Override
        public void requestPositionIndexEvent() {
            panelMap.setRow(panelTrackData.getSelectedRow());
        }

        @Override
        public void changeEvent() {
            panelTrackData.refresh();
        }

        @Override
        public void mouseClicked(MouseEvent evt) {
            Coordinate c = panelMap.getSelectedPosition();
            int i = Track.FindNearestPoint(c.getLat(), c.getLon());
            // Selection the position on the data grid
            panelTrackData.setSelectedRow(i);
            // Refresh profil position
            panelProfil.RefreshProfilInfo(i);
            panelProfil.setCrosshairPosition(Track.data.get(i).getTotal(Settings.Unit) / 1000.0, Track.data.get(i).getElevation(Settings.Unit));
        }
    });
    SplitPaneMainRight.setRightComponent(panelMap);
    // -- Finished - Pack
    // ---------------------------------------------------
    pack();
}
Also used : JPanelProfilListener(course_generator.profil.JPanelProfilListener) JPanelMapsListener(course_generator.maps.JPanelMapsListener) JTabbedPane(javax.swing.JTabbedPane) JPanelTrackDataListener(course_generator.trackdata.JPanelTrackDataListener) JPanelTrackData(course_generator.trackdata.JPanelTrackData) JPanelStatistics(course_generator.statistics.JPanelStatistics) JPanelResume(course_generator.resume.JPanelResume) Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) JPanelAnalysisSpeedSlope(course_generator.analysis.JPanelAnalysisSpeedSlope) JTabbedPane(javax.swing.JTabbedPane) ImageIcon(javax.swing.ImageIcon) ChangeListener(javax.swing.event.ChangeListener) BorderLayout(java.awt.BorderLayout) JPanelMaps(course_generator.maps.JPanelMaps) JPanelAnalysisSpeed(course_generator.analysis.JPanelAnalysisSpeed) MouseEvent(java.awt.event.MouseEvent) JPanelResumeListener(course_generator.resume.JPanelResumeListener) course_generator.dialogs.frmEditPosition(course_generator.dialogs.frmEditPosition) WindowEvent(java.awt.event.WindowEvent) course_generator.dialogs.frmSearchPoint(course_generator.dialogs.frmSearchPoint) JPanelAnalysisTimeDist(course_generator.analysis.JPanelAnalysisTimeDist) ChangeEvent(javax.swing.event.ChangeEvent) JPanelProfil(course_generator.profil.JPanelProfil) Coordinate(org.openstreetmap.gui.jmapviewer.Coordinate) JPanel(javax.swing.JPanel)

Aggregations

JPanelAnalysisSpeed (course_generator.analysis.JPanelAnalysisSpeed)1 JPanelAnalysisSpeedSlope (course_generator.analysis.JPanelAnalysisSpeedSlope)1 JPanelAnalysisTimeDist (course_generator.analysis.JPanelAnalysisTimeDist)1 course_generator.dialogs.frmEditPosition (course_generator.dialogs.frmEditPosition)1 course_generator.dialogs.frmSearchPoint (course_generator.dialogs.frmSearchPoint)1 JPanelMaps (course_generator.maps.JPanelMaps)1 JPanelMapsListener (course_generator.maps.JPanelMapsListener)1 JPanelProfil (course_generator.profil.JPanelProfil)1 JPanelProfilListener (course_generator.profil.JPanelProfilListener)1 JPanelResume (course_generator.resume.JPanelResume)1 JPanelResumeListener (course_generator.resume.JPanelResumeListener)1 JPanelStatistics (course_generator.statistics.JPanelStatistics)1 JPanelTrackData (course_generator.trackdata.JPanelTrackData)1 JPanelTrackDataListener (course_generator.trackdata.JPanelTrackDataListener)1 BorderLayout (java.awt.BorderLayout)1 Container (java.awt.Container)1 MouseEvent (java.awt.event.MouseEvent)1 WindowEvent (java.awt.event.WindowEvent)1 ImageIcon (javax.swing.ImageIcon)1 JPanel (javax.swing.JPanel)1