Revision 13120

View differences:

trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/imagenavigator/ImageNavigator.java
547 547
		graphics2.drawString(Messages.getText("teclas") + ":", 10, pos);
548 548

  
549 549
		graphics2.setFont(new java.awt.Font("Tahoma", 0, sep - 2));
550
		pos+=sep;
550
		pos += sep;
551 551
		graphics2.drawString(Messages.getText("ayuda_c"), 20, pos);
552
		pos+=sep;
552
		pos += sep;
553 553
		graphics2.drawString(Messages.getText("ayuda_0"), 20, pos);
554
		pos+=sep;
554
		pos += sep;
555 555
		graphics2.drawString(Messages.getText("ayuda_1_5"), 20, pos);
556
		pos+=sep;
556
		pos += sep;
557 557
		graphics2.drawString(Messages.getText("ayuda_more_less"), 20, pos);
558
		pos+=sep;
558
		pos += sep;
559 559
		graphics2.drawString(Messages.getText("ayuda_wheel"), 20, pos);
560
		pos+=sep;
560
		pos += sep;
561 561
		graphics2.drawString(Messages.getText("ayuda_h"), 20, pos);
562 562

  
563 563
		graphics2.setColor(new Color(185, 185, 185));
......
588 588
		if ((e.getButton() != MouseEvent.BUTTON1) && (e.getButton() != MouseEvent.BUTTON2))
589 589
			return;
590 590

  
591

  
592
/*
593
		// Oscurece la imagen cuando se mueve
591 594
		Color gris = new Color(0, 0, 0, 16);
592 595
		getCacheGraphics().setColor(gris);
593 596
		getCacheGraphics().fillRect(0, 0, width-1, height-1);
597
*/
598
/*
599
		// Pone un borde a la imagen cuando se mueve
594 600
		getCacheGraphics().setColor(Color.gray);
595 601
		getCacheGraphics().drawRect(0, 0, width-1, height-1);
596

  
602
*/
597 603
		mouse = new Point(e.getX(), e.getY());
598 604
		changePos(e.getX(), e.getY());
599 605
		autoAdjusted = false;
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/colortable/ui/ColorTablePanel.java
33 33
import javax.swing.JLabel;
34 34
import javax.swing.JPanel;
35 35
import javax.swing.JScrollPane;
36
import javax.swing.JSplitPane;
36 37
import javax.swing.JTabbedPane;
37 38
import javax.swing.JTable;
38 39
import javax.swing.JTextField;
......
92 93
	private TabInterpolated    tabInterpolated      = null;
93 94
	private ListViewComponent  listViewComponent    = null;
94 95
	private JTabbedPane        tabbedPane           = null;
95
	private JPanel             panelPreview         = null;
96
	private JSplitPane         panelPreview         = null;
96 97
	private JPanel             panelNoData          = null;
97 98
	private JPanel             panelButtons         = null;
98 99
	private JCheckBox          checkBoxInterpolated = null;
......
128 129
		panelLeft.add(getTabbedPane(), BorderLayout.CENTER);
129 130
		panelLeft.add(getPanelNoData(), BorderLayout.SOUTH);
130 131

  
131
		JPanel jSplitPane1 = new JPanel();
132
		jSplitPane1.setLayout(new BorderLayout(8, 8));
133
		jSplitPane1.add(panelLeft, BorderLayout.CENTER);
134
		jSplitPane1.add(getPanelPreview(), BorderLayout.EAST);
132
		JSplitPane jSplitPane1 = new JSplitPane();
133
		jSplitPane1.setLeftComponent(panelLeft);
134
		jSplitPane1.setRightComponent(getPanelPreview());
135
		jSplitPane1.setResizeWeight(1.0);
136
		jSplitPane1.setOneTouchExpandable(true);
137
		jSplitPane1.setContinuousLayout(true);
138
		jSplitPane1.setBorder(null);
135 139

  
136 140
		add(jSplitPane1, BorderLayout.CENTER);
137 141

  
......
200 204
	 * Devuelve el panel donde estar? el widget de preview
201 205
	 * @return
202 206
	 */
203
	private JPanel getPanelPreview() {
207
	private JSplitPane getPanelPreview() {
204 208
		if (panelPreview == null) {
205
			panelPreview = new JPanel();
206
			panelPreview.setLayout(new BorderLayout(8, 8));
209
			panelPreview = new JSplitPane();
210
			panelPreview.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
211
			panelPreview.setOneTouchExpandable(true);
212
			panelPreview.setContinuousLayout(true);
213
			panelPreview.setBorder(null);
214
			panelPreview.setResizeWeight(0.0);
207 215
			panelPreview.setPreferredSize(new Dimension(220, 0));
216
			panelPreview.setMinimumSize(new Dimension(220, 0));
208 217

  
218

  
209 219
			JPanel jsubpanel = new JPanel();
210 220
			JPanel jsubpanel2 = new JPanel();
211 221
			jsubpanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this, "vista_previa"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
......
216 226
			jsubpanel2.add(getImageNavigator(), BorderLayout.CENTER);
217 227
			jsubpanel.add(jsubpanel2, BorderLayout.CENTER);
218 228

  
219
			panelPreview.add(jsubpanel, BorderLayout.CENTER);
229
			jsubpanel.setPreferredSize(new Dimension(237, 237));
230
			jsubpanel.setMinimumSize(new Dimension(237, 237));
231
			jsubpanel.setMaximumSize(new Dimension(237, 237));
220 232

  
233
			panelPreview.setTopComponent(jsubpanel);
234

  
221 235
			JPanel jsubpanel3 = new JPanel();
222 236
			JPanel jsubpanel4 = new JPanel();
223 237
			jsubpanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this, "libreria"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
......
236 250

  
237 251
			jsubpanel3.setPreferredSize(new Dimension(0, 192));
238 252

  
239
			panelPreview.add(jsubpanel3, BorderLayout.SOUTH);
253
			panelPreview.setBottomComponent(jsubpanel3);
240 254
		}
241 255
		return panelPreview;
242 256
	}
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/colortable/panels/TabInterpolated.java
129 129
	}
130 130

  
131 131
	public void actionValueDragged(ColorSliderEvent e) {
132
		colorTablePanel.tabInterpolatedChanged();
132
		//colorTablePanel.tabInterpolatedChanged();
133 133
	}
134 134

  
135 135
	private void callValueColorChanged() {
trunk/extensions/extRasterTools-SE/src-test-ui/org/gvsig/rastertools/colortable/combobox/TestComboBoxColorTable.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.rastertools.colortable.combobox;
20

  
21
import java.awt.Component;
22
import java.io.File;
23
import java.util.ArrayList;
24

  
25
import javax.swing.JComboBox;
26
import javax.swing.JFrame;
27
import javax.swing.JList;
28
import javax.swing.ListCellRenderer;
29

  
30
import org.gvsig.raster.datastruct.ColorTable;
31
import org.gvsig.raster.datastruct.serializer.ColorTableLibraryPersistence;
32
import org.gvsig.rastertools.colortable.ui.ColorTablePaint;
33
/**
34
 *
35
 * @version 17/04/2007
36
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
37
 */
38
public class TestComboBoxColorTable {
39
	private JFrame      frame        = new JFrame();
40
	private JComboBox   jComboBox    = null;
41

  
42
	private String palettesPath = System.getProperty("user.home") +
43
	File.separator +
44
	"gvSIG" + // PluginServices.getArguments()[0] +
45
	File.separator + "colortable";
46

  
47
	public TestComboBoxColorTable() {
48
		super();
49
		initialize();
50
	}
51

  
52
	public static void main(String[] args){
53
		new TestComboBoxColorTable();
54
	}
55

  
56
	private void initialize() {
57
		jComboBox = new JComboBox();
58

  
59
		ArrayList fileList = ColorTableLibraryPersistence.getPaletteFileList(palettesPath);
60

  
61
		for (int i = 0; i < fileList.size(); i++) {
62
			ArrayList paletteItems = new ArrayList();
63
			String paletteName = ColorTableLibraryPersistence.loadPalette(palettesPath, (String) fileList.get(i), paletteItems);
64

  
65
			if (paletteItems.size() <= 0)
66
				continue;
67

  
68
			ColorTable colorTable = new ColorTable();
69
			colorTable.setName(paletteName);
70
			colorTable.createPaletteFromColorItems(paletteItems, true);
71
			colorTable.setInterpolated(true);
72

  
73
			ArrayList array = new ArrayList();
74
			array.add(paletteName);
75
			array.add(new ColorTablePaint(colorTable));
76

  
77
			jComboBox.addItem(array);
78
		}
79

  
80
		frame.setContentPane(jComboBox);
81
		frame.setSize(new java.awt.Dimension(400, 60));
82
		frame.setResizable(true);
83
		frame.setTitle("Tablas de color");
84
		frame.setVisible(true);
85
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
86

  
87
		jComboBox.setRenderer(new ListCellRenderer() {
88
			public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
89
				ArrayList array = (ArrayList) value;
90

  
91

  
92
				PaintItem paintItem = new PaintItem((String) array.get(0), (ColorTablePaint) array.get(1), isSelected);
93
				return paintItem;
94
			}
95
		});
96
	}
97
}
0 98

  
trunk/extensions/extRasterTools-SE/src-test-ui/org/gvsig/rastertools/colortable/combobox/PaintItem.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.rastertools.colortable.combobox;
20

  
21
import java.awt.Color;
22
import java.awt.Component;
23
import java.awt.Dimension;
24
import java.awt.FontMetrics;
25
import java.awt.GradientPaint;
26
import java.awt.Graphics;
27
import java.awt.Graphics2D;
28
import java.awt.Rectangle;
29

  
30
import org.gvsig.rastertools.colortable.ui.ColorTablePaint;
31
/**
32
 *
33
 * @version 17/04/2007
34
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
35
 */
36
public class PaintItem extends Component {
37
	private static final long serialVersionUID = -6448740563809113949L;
38
//	private ListViewItem listViewItem = null;
39
	private boolean isSelected = false;
40
	private String name = "";
41
	private ColorTablePaint colorTablePaint = null;
42

  
43
	public PaintItem(String name, ColorTablePaint colorTablePaint, boolean isSelected) {
44
		this.name = name;
45
		this.colorTablePaint = colorTablePaint;
46
		this.isSelected = isSelected;
47

  
48
		setSize(getWidth(), 19);
49
		setPreferredSize(new Dimension(getWidth(), 19));
50
	}
51

  
52
	public void paint(Graphics g) {
53
		Graphics2D g2 = (Graphics2D) g;
54
		if (isSelected) {
55
			Color color1 = new Color(89, 153, 229);
56
			Color color2 = new Color(31, 92, 207);
57
			g2.setPaint(new GradientPaint(0, 1, color1, 0, getHeight() - 1, color2, false));
58
			g2.fillRect(0, 1, getWidth(), getHeight() - 1);
59
			g2.setColor(new Color(61, 123, 218));
60
			g2.drawLine(0, 0, getWidth(), 0);
61
			g2.setColor(Color.white);
62
		} else {
63
			g2.setColor(Color.white);
64
			g2.fillRect(0, 0, getWidth(), getHeight());
65
			g2.setColor(Color.black);
66
		}
67

  
68
		Rectangle bounds = getBounds();
69

  
70
		FontMetrics fm = g2.getFontMetrics();
71
		int upper = (bounds.height + fm.getHeight()) / 2 - fm.getDescent();
72

  
73
		g2.setClip(bounds.x, 0, bounds.width, bounds.height);
74
		g2.drawString(name, bounds.width - 146, upper);
75

  
76
		g2.setClip(bounds.x, 0, bounds.width - 150, bounds.height);
77

  
78
		colorTablePaint.paint((Graphics2D) g2, isSelected);
79
	}
80
}
0 81

  

Also available in: Unified diff