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/MainWindow.java

View differences:

MainWindow.java
35 35

  
36 36

  
37 37
/**
38
 * Basic frame for a gvSIG <code>IWindow</code> object. This frame adds buttons 
38
 * Basic frame for a gvSIG <code>IWindow</code> object. This frame adds buttons
39 39
 * of Cancel, Accept and others.
40
 * 
40
 *
41 41
 * @author Nacho Brodin (nachobrodin@gmail.com)
42 42
 */
43 43
public class MainWindow extends AbstractButtonsPanel implements IWindow, ActionListener {
44
    
44

  
45 45
    private static final long  serialVersionUID = -4401123724140025094L;
46 46
    private ActionListener     listener         = null;
47 47
    private WindowInfo         info             = null;
48 48

  
49 49
    private Object profile = WindowInfo.EDITOR_PROFILE;
50 50

  
51
    /**
52
     * @param panel
53
     * @param title
54
     * @param w
55
     * @param h
56
     * @param actionListener
57
     */
51 58
    public MainWindow(JComponent panel, String title, int w, int h, ActionListener actionListener) {
52 59
    	this.listener = actionListener;
53
    	
60

  
54 61
    	setLayout(new BorderLayout());
55 62
		add(panel, BorderLayout.CENTER);
56 63

  
57 64
		getButtonsPanel().getButton(IButtonsPanel.BUTTON_APPLY).setVisible(false);
58 65
        getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT).addActionListener(this);
59 66
        getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL).addActionListener(this);
60
        
67

  
61 68
        info = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE);
62 69
        info.setTitle(title);
63 70
        info.setWidth(w);
64 71
        info.setHeight(h);
65 72
    }
66
    
73

  
74
    /**
75
     * @param panel
76
     * @param title
77
     * @param w
78
     * @param h
79
     * @param actionListener
80
     * @param mainPanel
81
     */
67 82
    public MainWindow(JComponent panel, String title, int w, int h, ActionListener actionListener, boolean mainPanel) {
68 83
    	this.listener = actionListener;
69
    	
84

  
70 85
    	setLayout(new BorderLayout());
71 86
		add(panel, BorderLayout.CENTER);
72 87

  
73 88
		getButtonsPanel().getButton(IButtonsPanel.BUTTON_APPLY).setVisible(false);
74
		
89

  
75 90
		if(mainPanel) {
76 91
			getButtonsPanel().addButton(Messages.getText("load_layer"), IButtonsPanel.BUTTON_USR1);
77 92
			getButtonsPanel().addButton(Messages.getText("generate_file"), IButtonsPanel.BUTTON_USR2);
......
86 101
			getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT).addActionListener(this);
87 102
			getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL).addActionListener(this);
88 103
		}
89
        
104

  
90 105
        info = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE);
91 106
        info.setTitle(title);
92 107
        info.setWidth(w);
......
106 121
    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_USR1, e.getActionCommand()));
107 122
    		PluginServices.getMDIManager().closeWindow(this);
108 123
    	}
109
    	
124

  
110 125
    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR2)) {
111 126
    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_USR2, e.getActionCommand()));
112 127
    		PluginServices.getMDIManager().closeWindow(this);
113 128
    	}
114
    	
129

  
115 130
    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT)) {
116 131
    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_ACCEPT, e.getActionCommand()));
117 132
    		PluginServices.getMDIManager().closeWindow(this);
118 133
    	}
119
    	
134

  
120 135
    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_APPLY)) {
121 136
    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_APPLY, e.getActionCommand()));
122 137
    	}
123
    	
138

  
124 139
    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL)) {
125 140
    		PluginServices.getMDIManager().closeWindow(this);
126 141
    	}
127
    	
142

  
128 143
    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_CLOSE)) {
129 144
    		PluginServices.getMDIManager().closeWindow(this);
130 145
    	}

Also available in: Unified diff