Revision 5988 org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/LayerNameDialog.java

View differences:

LayerNameDialog.java
38 38
import org.gvsig.raster.swing.basepanel.IButtonsPanel;
39 39

  
40 40
/**
41
 * <code>LayerNameDialog</code>. 
42
 * Window to introduce the name of the new layer 
41
 * <code>LayerNameDialog</code>.
42
 * Window to introduce the name of the new layer
43 43
 * @author Nacho Brodin (nachobrodin@gmail.com)
44 44
 */
45 45
public class LayerNameDialog extends AbstractButtonsPanel implements IWindow, ButtonsPanelListener {
......
47 47
	private JPanel                panel            = null;
48 48
	private String                layerName        = null;
49 49
	private JTextField            name             = null;
50
	private ButtonsPanelListener  listener         = null;  
50
	private ButtonsPanelListener  listener         = null;
51 51
	private Point2D               position         = null;
52 52

  
53 53
	/**
54 54
	 * Builds a new window.
55
	 * @param width 
56
	 * @param height 
55
	 * @param position
56
	 * @param width
57
	 * @param height
58
	 * @param listener
57 59
	 */
58 60
	public LayerNameDialog(Point2D position, int width, int height, ButtonsPanelListener listener) {
59 61
		super(IButtonsPanel.BUTTONS_ACCEPTCANCEL);
......
65 67
		this.add(getMainPanel(), java.awt.BorderLayout.CENTER);
66 68
		this.addButtonPressedListener(this);
67 69
	}
68
	
70

  
69 71
	/**
70 72
	 * Builds a new window.
71
	 * @param width 
72
	 * @param height 
73
	 * @param width
74
	 * @param height
75
	 * @param listener
73 76
	 */
74 77
	public LayerNameDialog(int width, int height, ButtonsPanelListener listener) {
75 78
		this(new Point2D.Double(), width, height, listener);
......
92 95
		}
93 96
		return panel;
94 97
	}
95
	
98

  
96 99
	private JTextField getNameField() {
97 100
		if(name == null) {
98 101
			name = new JTextField();
......
120 123
			//Si la ventana no se puede eliminar no hacemos nada
121 124
		}
122 125
	}
123
	
126

  
124 127
	/**
125 128
	 * Accept actions
126 129
	 */
......
130 133
			JOptionPane.showMessageDialog(null, Messages.getText("character_not_valid"), "", JOptionPane.ERROR_MESSAGE);
131 134
			return;
132 135
		}
133
		
136

  
134 137
		byte[] byteList = txt.getBytes();
135 138
		for (int i = 0; i < byteList.length; i++) {
136 139
			if(byteList[i] < 45 ||
......
144 147
				return;
145 148
			}
146 149
		}
147
		
150

  
148 151
		layerName = txt;
149 152
		close();
150 153
		listener.actionButtonPressed(new ButtonsPanelEvent(layerName, IButtonsPanel.BUTTON_ACCEPT));
......
154 157
		if (e.getButton() == IButtonsPanel.BUTTON_CANCEL) {
155 158
			close();
156 159
		}
157
		
160

  
158 161
		if (e.getButton() == IButtonsPanel.BUTTON_ACCEPT) {
159 162
			accept();
160 163
		}

Also available in: Unified diff