Revision 1172 org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/infobypoint/gui/MainInfoByPointPanel.java
MainInfoByPointPanel.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.raster.tools.app.basic.tool.infobypoint.gui; |
23 | 23 |
|
24 |
import java.awt.BorderLayout; |
|
24 |
import java.awt.Color; |
|
25 |
import java.awt.Dimension; |
|
26 |
import java.awt.GridBagConstraints; |
|
27 |
import java.awt.GridBagLayout; |
|
25 | 28 |
import java.util.HashMap; |
26 | 29 |
import java.util.Observable; |
27 | 30 |
import java.util.Observer; |
28 | 31 |
|
32 |
import javax.swing.BorderFactory; |
|
29 | 33 |
import javax.swing.JPanel; |
30 | 34 |
|
35 |
/** |
|
36 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
37 |
*/ |
|
31 | 38 |
public class MainInfoByPointPanel extends JPanel implements Observer { |
32 |
private static final long serialVersionUID = 1L; |
|
33 |
private HashMap<String, String> tr = null; |
|
34 |
private PixelViewPanel viewPanel = null; |
|
35 |
private InfoByPointDataModel dataModel = null; |
|
39 |
private static final long serialVersionUID = 1L; |
|
40 |
private HashMap<String, String> tr = null; |
|
41 |
private InfoByPointDataModel dataModel = null; |
|
42 |
private PixelInspectorPanel pixelInspectorPanel = null; |
|
43 |
private InfoByPointPanel infoByPointPanel = null; |
|
44 |
private ButtonsPanel buttonsPanel = null; |
|
45 |
private boolean extended = false; |
|
36 | 46 |
|
37 |
public MainInfoByPointPanel(HashMap<String, String> translations) { |
|
47 |
public MainInfoByPointPanel(HashMap<String, String> translations, boolean extended) {
|
|
38 | 48 |
tr = translations; |
39 |
if(tr == null) { |
|
49 |
if(tr == null || tr.get("layer_list") == null) {
|
|
40 | 50 |
tr = new HashMap<String, String>(); |
51 |
tr.put("layer_list", "layer_list"); |
|
52 |
tr.put("band_values", "band_values"); |
|
53 |
tr.put("pixel_point", "pixel_point"); |
|
54 |
tr.put("view_point", "view_point"); |
|
55 |
tr.put("world_point", "world_point"); |
|
56 |
tr.put("bands", "bands"); |
|
57 |
tr.put("colors", "colors"); |
|
58 |
tr.put("coords", "coords"); |
|
59 |
tr.put("lat", "lat"); |
|
60 |
tr.put("long", "long"); |
|
41 | 61 |
} |
62 |
this.extended = extended; |
|
42 | 63 |
init(); |
43 | 64 |
} |
44 | 65 |
|
45 | 66 |
private void init() { |
46 |
setLayout(new BorderLayout()); |
|
47 |
add(getViewPanel(), BorderLayout.CENTER); |
|
48 |
} |
|
49 |
|
|
50 |
public PixelViewPanel getViewPanel() { |
|
51 |
if(viewPanel == null) { |
|
52 |
viewPanel = new PixelViewPanel(tr, getInfoByPointDataModel()); |
|
67 |
setLayout(new GridBagLayout()); |
|
68 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
69 |
gbc.gridx = 0; |
|
70 |
gbc.gridy = 0; |
|
71 |
gbc.gridwidth = 1; |
|
72 |
gbc.gridheight = 1; |
|
73 |
if(!extended) { |
|
74 |
gbc.fill = GridBagConstraints.BOTH; |
|
75 |
gbc.weightx = 1; |
|
76 |
gbc.weighty = 1; |
|
77 |
} else { |
|
78 |
gbc.anchor = GridBagConstraints.WEST; |
|
79 |
gbc.fill = GridBagConstraints.VERTICAL; |
|
80 |
gbc.weighty = 1; |
|
53 | 81 |
} |
54 |
return viewPanel; |
|
82 |
gbc.insets = new java.awt.Insets(2, 2, 2, 2); |
|
83 |
add(getPixelInspectorPanel(), gbc); |
|
84 |
|
|
85 |
if(!extended) { |
|
86 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
87 |
gbc.weightx = 1; |
|
88 |
gbc.weighty = 0; |
|
89 |
} else { |
|
90 |
gbc.fill = GridBagConstraints.NONE; |
|
91 |
gbc.weighty = 0; |
|
92 |
} |
|
93 |
|
|
94 |
gbc.gridx = 0; |
|
95 |
gbc.gridy = 1; |
|
96 |
add(getinfoByPointPanel(), gbc); |
|
97 |
|
|
98 |
if(extended) { |
|
99 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
100 |
gbc.gridx = 0; |
|
101 |
gbc.gridy = 2; |
|
102 |
add(getButtonsPanel(), gbc); |
|
103 |
|
|
104 |
gbc.gridx = 1; |
|
105 |
gbc.gridy = 0; |
|
106 |
gbc.gridheight = 3; |
|
107 |
gbc.fill = GridBagConstraints.BOTH; |
|
108 |
gbc.weightx = 1; |
|
109 |
gbc.weighty = 1; |
|
110 |
JPanel p = new JPanel(); |
|
111 |
p.setPreferredSize(new Dimension(500, 400)); |
|
112 |
p.setBorder(BorderFactory.createLineBorder(Color.red)); |
|
113 |
add(p, gbc); |
|
114 |
} |
|
55 | 115 |
} |
56 | 116 |
|
57 | 117 |
public InfoByPointDataModel getInfoByPointDataModel() { |
... | ... | |
59 | 119 |
dataModel = new InfoByPointDataModel(); |
60 | 120 |
return dataModel; |
61 | 121 |
} |
62 |
|
|
122 |
|
|
123 |
public PixelInspectorPanel getPixelInspectorPanel() { |
|
124 |
if(pixelInspectorPanel == null) |
|
125 |
pixelInspectorPanel = new PixelInspectorPanel(tr); |
|
126 |
return pixelInspectorPanel; |
|
127 |
} |
|
128 |
|
|
129 |
public InfoByPointPanel getinfoByPointPanel() { |
|
130 |
if(infoByPointPanel == null) |
|
131 |
infoByPointPanel = new InfoByPointPanel(tr, getInfoByPointDataModel()); |
|
132 |
return infoByPointPanel; |
|
133 |
} |
|
134 |
|
|
135 |
public ButtonsPanel getButtonsPanel() { |
|
136 |
if(buttonsPanel == null) |
|
137 |
buttonsPanel = new ButtonsPanel(); |
|
138 |
return buttonsPanel; |
|
139 |
} |
|
140 |
|
|
63 | 141 |
public void update(Observable o, Object arg) { |
64 |
getViewPanel().updateDataModel();
|
|
142 |
getinfoByPointPanel().updateDataModel();
|
|
65 | 143 |
} |
66 |
|
|
67 | 144 |
} |
Also available in: Unified diff