Revision 12438

View differences:

trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/graphic/GraphicChartPanel.java
32 32
import org.jfree.chart.plot.XYPlot;
33 33
import org.jfree.data.xy.XYSeries;
34 34
import org.jfree.data.xy.XYSeriesCollection;
35

  
36 35
/**
37 36
 * Componente gr?fico de JFree
38 37
 *
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/translations/text.properties
6 6
bandas=Bandas
7 7
crear_tabla=Crear Tabla
8 8
extraer=Extraer
9
espere=Espere
9 10
filtros=Filtros
10 11
formato_no_numerico=Formato no num?rico
11 12
limpiar=Limpiar
......
24 25
vista=Vista
25 26
aceptar=Aceptar
26 27
cancelar=Cancelar
28
select_color=Seleccione un color
27 29
si=S?
28 30
no=No
29 31
aplicar=Aplicar
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/progresspanel/ProgressPanel.java
100 100
		if (jPanel == null) {
101 101
			jLabel1 = new JLabel();
102 102
			jLabel = new JLabel();
103
			jLabel.setText("Espere...");
103
			jLabel.setText(Messages.getText("espere") + "...");
104 104
			jPanel = new JPanel();
105 105
			jPanel.setLayout(new java.awt.BorderLayout(5, 5));
106 106
			jPanel.add(jLabel, java.awt.BorderLayout.WEST);
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/imagenavigator/ImageNavigator.java
35 35
import java.awt.event.MouseWheelEvent;
36 36
import java.awt.event.MouseWheelListener;
37 37

  
38
import javax.swing.ImageIcon;
38 39
import javax.swing.JComponent;
39 40
/**
40 41
 * <code>ImageNavigator</code> es un componente que representa un manejador
......
55 56
 *
56 57
 * @version 04/05/2007
57 58
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
58
 *
59 59
 */
60 60
public class ImageNavigator extends JComponent implements KeyListener, MouseMotionListener, MouseListener, MouseWheelListener {
61 61
	private static final long serialVersionUID = 1164788214432359272L;
62
	private IClientImageNavigator iClient = null;
62
	private IClientImageNavigator iClient        = null;
63 63

  
64
	private Image				image = null;
65
	private Graphics2D	widgetGraphics = null;
66
	private Image				imageCache = null;
67
	private Graphics2D	cacheGraphics = null;
64
	private Image                 image          = null;
65
	private Graphics2D            widgetGraphics = null;
66
	private Image                 imageCache     = null;
67
	private Graphics2D            cacheGraphics  = null;
68 68

  
69
	private double			zoom = 1.0;
70
	private double			x1 = 0.0;
71
	private double			y1 = 0.0;
72
	private boolean			yInverted = false;
73
	private boolean			xInverted = false;
74
	private int					width = 0, height = 0;
75
	private boolean     showHelp = false;
69
	private double                zoom           = 1.0;
70
	private double                x1             = 0.0;
71
	private double                y1             = 0.0;
72
	private boolean               yInverted      = false;
73
	private boolean               xInverted      = false;
74
	private int                   width          = 0;
75
	private int                   height         = 0;
76
	private boolean               showHelp       = false;
77
	ImageIcon                     imageIconClose;
78
	ImageIcon                     imageIconHelp;
76 79

  
77 80
	/**
78 81
	 * Crea un <code>ImageNavigator</code> especificandole quien pintara el
79 82
	 * componente
80
	 *
81 83
	 * @param iClient
82 84
	 */
83 85
	public ImageNavigator(IClientImageNavigator iClient) {
......
88 90
		this.addMouseMotionListener(this);
89 91
		this.addMouseListener(this);
90 92
		this.addMouseWheelListener(this);
91
		this.setCursor(new Cursor(Cursor.MOVE_CURSOR));
92 93
	}
93 94

  
94 95
	double initX1 = 0.0;
......
261 262
	 */
262 263
	private void callShowHelp() {
263 264
		showHelp = !showHelp;
264
		if (showHelp)
265
			this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
266
		else
267
			this.setCursor(new Cursor(Cursor.MOVE_CURSOR));
268 265
		updateImageCache(true);
269 266
		refreshImage(0, 0);
270 267
	}
......
279 276
			case 'H':
280 277
				callShowHelp();
281 278
				break;
282
		}
283

  
284
		if (showHelp)
285
			return;
286

  
287
		switch (e.getKeyChar()) {
288 279
			case '+':
289 280
				ZoomIn(width / 2.0, height / 2.0);
290 281
				autoAdjusted = false;
......
428 419
		getWidgetGraphics().fillRect(0, 0, width, height);
429 420

  
430 421
		getWidgetGraphics().drawImage(imageCache, x, y, null);
422

  
423
		if (showHelp)
424
			paintHelp((Graphics2D) getWidgetGraphics());
425
		else
426
			getWidgetGraphics().drawImage(getIconHelp().getImage(), width - getIconHelp().getIconWidth() - 4, 3, null);
431 427
	}
432 428

  
433 429
	/*
......
448 444
		if (image != null)
449 445
			g.drawImage(image, 0, 0, this);
450 446

  
451
		paintHelp((Graphics2D) g);
447
//		paintHelp((Graphics2D) g);
452 448
	}
453 449

  
454 450
	/**
......
467 463
		if (image != null)
468 464
			getGraphics().drawImage(image, 0, 0, this);
469 465

  
470
		paintHelp((Graphics2D) getGraphics());
466
//		paintHelp((Graphics2D) getGraphics());
471 467
	}
472 468

  
469
	/**
470
	 * Devuelve el icono de cerrar
471
	 * @return
472
	 */
473
	private ImageIcon getIconClose() {
474
		if (imageIconClose == null) {
475
			imageIconClose = new ImageIcon(getClass().getResource("images/close.png"));
476
		}
477
		return imageIconClose;
478
	}
479

  
480
	/**
481
	 * Devuelve el icono ayuda
482
	 * @return
483
	 */
484
	private ImageIcon getIconHelp() {
485
		if (imageIconHelp == null) {
486
			imageIconHelp = new ImageIcon(getClass().getResource("images/help.png"));
487
		}
488
		return imageIconHelp;
489
	}
490

  
473 491
	private void paintHelp(Graphics2D g) {
474
		if (!showHelp)
475
			return;
476

  
477 492
		int sep = 13;
478 493
		int pos = sep + 1;
479 494

  
......
516 531
		graphics2.setColor(new Color(185, 185, 185));
517 532
		graphics2.drawLine(0, alto, width, alto);
518 533

  
519
		AlphaComposite myAlpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f);
534
		graphics2.drawImage(getIconClose().getImage(), width - getIconClose().getIconWidth() - 4, 3, null);
535

  
536
		AlphaComposite myAlpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f);
520 537
		g.setComposite(myAlpha);
521 538

  
522 539
		g.drawImage(image2, 0, 0, this);
540

  
541
		myAlpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f);
542
		g.setComposite(myAlpha);
523 543
	}
524 544

  
525 545
	Point mouse = null;
......
528 548
	 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
529 549
	 */
530 550
	public void mousePressed(MouseEvent e) {
531
		if (showHelp) return;
551
		if ((e.getX() > (width - 20)) && (e.getY() < 20)) {
552
			callShowHelp();
553
			return;
554
		}
555

  
532 556
		requestFocus();
533 557
		if ((e.getButton() != MouseEvent.BUTTON1) && (e.getButton() != MouseEvent.BUTTON2))
534 558
			return;
......
549 573
	 * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
550 574
	 */
551 575
	public void mouseDragged(MouseEvent e) {
552
		if (showHelp) return;
553 576
		changePos(e.getX(), e.getY());
554 577
	}
555 578

  
......
558 581
	 * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
559 582
	 */
560 583
	public void mouseReleased(MouseEvent e) {
561
		if (showHelp) return;
562 584
		if (mouse != null) {
563 585
			x1 = x1 - ((e.getX() - mouse.getX())/zoom);
564 586
			y1 = y1 - ((e.getY() - mouse.getY())/zoom);
......
578 600
	 * del puntero.
579 601
	 */
580 602
	public void mouseWheelMoved(MouseWheelEvent e) {
581
		if (showHelp) return;
582 603
		if (e.getWheelRotation() > 0) {
583 604
			ZoomOut(isXInverted() ? this.getWidth() - e.getX() : e.getX(), isYInverted() ? this.getHeight() - e.getY() : e.getY());
584 605
			autoAdjusted = false;
......
605 626
		return xInverted;
606 627
	}
607 628

  
629
	/*
630
	 * (non-Javadoc)
631
	 * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
632
	 */
633
	public void mouseMoved(MouseEvent e) {
634
		if ((e.getX() > (width - 20)) && (e.getY() < 20)) {
635
			setCursor(new Cursor(Cursor.HAND_CURSOR));
636
		} else {
637
			setCursor(new Cursor(Cursor.MOVE_CURSOR));
638
		}
639
	}
640

  
608 641
	public void keyReleased(KeyEvent e) {}
609 642
	public void keyTyped(KeyEvent e) {}
610
	public void mouseMoved(MouseEvent e) {}
611 643
	public void mouseClicked(MouseEvent e) {}
612 644
	public void mouseEntered(MouseEvent e) {}
613 645
	public void mouseExited(MouseEvent e) {}
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/buttonscolor/ButtonColor.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.gui.beans.buttonscolor;
20

  
21
import java.awt.Color;
22
import java.awt.Dimension;
23
import java.awt.event.ActionEvent;
24
import java.awt.event.ActionListener;
25

  
26
import javax.swing.JButton;
27
import javax.swing.JColorChooser;
28

  
29
import org.gvsig.gui.beans.messages.Messages;
30
/**
31
 * Componente de selecci?n de un color
32
 *
33
 * @version 02/07/2007
34
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
35
 */
36
public class ButtonColor extends JButton implements ActionListener {
37
	private static final long serialVersionUID = 8037973734807388692L;
38

  
39
	public ButtonColor() {
40
		setText("");
41
		setPreferredSize(new Dimension(34, 16));
42
		addActionListener(this);
43
		setBackground(Color.WHITE);
44
		setOpaque(true);
45
	}
46

  
47
	/*
48
	 * (non-Javadoc)
49
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
50
	 */
51
	public void actionPerformed(ActionEvent e) {
52
		Color ret = JColorChooser.showDialog(this, Messages.getText("select_color"), getBackground());
53

  
54
		if (ret != null)
55
			setBackground(ret);
56
	}
57

  
58
	/**
59
	 * Obtiene el color
60
	 * @return
61
	 */
62
	public Color getColor() {
63
		return getBackground();
64
	}
65

  
66
	/**
67
	 * Especifica el color
68
	 * @param color
69
	 */
70
	public void setColor(Color color) {
71
		setBackground(color);
72
	}
73
}
0 74

  
trunk/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/buttoncolor/TestButtonColor.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.gui.beans.buttoncolor;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.gui.beans.buttonscolor.ButtonColor;
24
/**
25
 * Test para ButtonColor
26
 *
27
 * @version 02/07/2007
28
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
29
 */
30
public class TestButtonColor {
31
	private JFrame frame = null;
32

  
33
	public TestButtonColor() {
34
		frame = new JFrame();
35
		ButtonColor cont = new ButtonColor();
36
		frame.setSize(410, 45);
37
		frame.getContentPane().add(cont);
38
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
39
		frame.setVisible(true);
40
	}
41

  
42
	public static void main(String[] args){
43
		new TestButtonColor();
44
	}
45
}
0 46

  

Also available in: Unified diff