source: ether_megapoli/trunk/service/implementation/com/ether/SymItem.java @ 178

Last change on this file since 178 was 178, checked in by vmipsl, 13 years ago

Servlet _ contour ok

File size: 4.1 KB
Line 
1package com.ether;
2
3import gov.noaa.pmel.sgt.Axis;
4import gov.noaa.pmel.sgt.CartesianGraph;
5import gov.noaa.pmel.sgt.Graph;
6import gov.noaa.pmel.sgt.Layer;
7import gov.noaa.pmel.sgt.StackedLayout;
8
9import javax.swing.*;
10import java.awt.*;
11import java.awt.event.ItemEvent;
12import java.util.Enumeration;
13
14public class SymItem
15        implements java.awt.event.ItemListener
16{
17    public SymItem( final JCheckBox stacked, final JCheckBox grid )
18    {
19        _stacked = stacked;
20        _grid = grid;
21    }
22
23    public void itemStateChanged( final ItemEvent event )
24    {
25        final Object object = event.getSource();
26        if( object.equals( _stacked ) )
27            stacked_itemStateChanged( event );
28        else if( object.equals( _grid ) )
29            grid_itemStateChanged( event );
30    }
31
32    /**
33     * Change the Pane layout to StackedLayout.
34     *
35     * @param event
36     */
37
38    void stacked_itemStateChanged( java.awt.event.ItemEvent event )
39    {
40        /*
41        * Get the component list for mainPane_ and change
42        * the layout to StackedLayout.
43        */
44//        Component[] comps = mainPane_.getComponents();
45//        mainPane_.setBatch( true );
46//        mainPane_.setLayout( new StackedLayout() );
47//        /*
48//        * Remove any axes that have been associated with
49//        * the second graph.  With the layers overlayed it
50//        * is not necessary to have duplicate axes.
51//        */
52//        Graph gr2 = ( (Layer) comps[1] ).getGraph();
53//        ( (CartesianGraph) gr2 ).removeAllXAxes();
54//        ( (CartesianGraph) gr2 ).removeAllYAxes();
55//        /*
56//        * Tell the Applet that the mainPane_ needs to
57//        * be layed out and re-draw the mainPane_.
58//        */
59//        if( isApplet_ )
60//        {
61//            validate();
62//        }
63//        else
64//        {
65//            frame.validate();
66//        }
67//        mainPane_.setBatch( false );
68//        if( tree_ != null )
69//        {
70//            if( tree_.isVisible() )
71//            {
72//                tree_.setJPane( mainPane_ );
73//                tree_.expandTree();
74//            }
75//        }
76    }
77
78    /**
79     * Change the Pane layout to GridLayout.
80     *
81     * @param event
82     */
83
84    void grid_itemStateChanged( java.awt.event.ItemEvent event )
85    {
86//        /*
87//        * Get the component list for mainPane_ and change
88//        * the layout to GridLayout.
89//        */
90//        Component[] comps = mainPane_.getComponents();
91//        mainPane_.setBatch( true );
92//        mainPane_.setLayout( new GridLayout( 2, 0 ) );
93//        /*
94//        * Get the first and second graphs from the first
95//        * and second layers, respectively.
96//        */
97//        Graph gr = ( (Layer) comps[0] ).getGraph();
98//        Graph gr2 = ( (Layer) comps[1] ).getGraph();
99//        /*
100//        * Create copies of all X-Axes associated with the first
101//        * graph for the second graph. If the axes are not copied then
102//        * the second graph will have the second line plotted, but without
103//        * any axes.
104//        */
105//        for( Enumeration xa = ( (CartesianGraph) gr ).xAxisElements(); xa.hasMoreElements(); )
106//        {
107//            ( (CartesianGraph) gr2 ).addXAxis( ( (Axis) xa.nextElement() ).copy() );
108//        }
109//        /*
110//        * Create copies of all Y-Axes associated with the first
111//        * graph for the second graph.
112//        */
113//        for( Enumeration ya = ( (CartesianGraph) gr ).yAxisElements(); ya.hasMoreElements(); )
114//        {
115//            ( (CartesianGraph) gr2 ).addYAxis( ( (Axis) ya.nextElement() ).copy() );
116//        }
117//        /*
118//        * Tell the Applet that the mainPane_ needs to
119//        * be layed out and re-draw the mainPane_.
120//        */
121//        if( isApplet_ )
122//        {
123//            validate();
124//        }
125//        else
126//        {
127//            frame.validate();
128//        }
129//        //    mainPane_.draw();
130//        mainPane_.setBatch( false );
131//        if( tree_ != null )
132//        {
133//            if( tree_.isVisible() )
134//            {
135//                tree_.setJPane( mainPane_ );
136//                tree_.expandTree();
137//            }
138//        }
139    }
140
141    private JCheckBox _stacked;
142    private JCheckBox _grid;
143}
Note: See TracBrowser for help on using the repository browser.