76 |
76 |
import javax.swing.JPanel;
|
77 |
77 |
import javax.swing.JPopupMenu;
|
78 |
78 |
import javax.swing.JSeparator;
|
|
79 |
import javax.swing.JToolBar;
|
79 |
80 |
import javax.swing.MenuElement;
|
80 |
81 |
import javax.swing.SwingUtilities;
|
81 |
82 |
import javax.swing.Timer;
|
... | ... | |
113 |
114 |
*
|
114 |
115 |
* @version $Revision$
|
115 |
116 |
*/
|
|
117 |
@SuppressWarnings("unchecked")
|
116 |
118 |
public class MDIFrame extends JFrame implements ComponentListener,
|
117 |
119 |
ContainerListener, ActionListener, MainFrame {
|
118 |
120 |
|
... | ... | |
167 |
169 |
private ArrayList progressListeners = new ArrayList();
|
168 |
170 |
|
169 |
171 |
/** Timer para invocar los enventos de la interfaz anterior */
|
170 |
|
private Timer progressTimer = null;
|
|
172 |
private Timer progressTimer = null;
|
171 |
173 |
|
172 |
174 |
/** Tabla hash que asocia las clases con las extensiones */
|
173 |
175 |
private Map classesExtensions = new HashMap<Class<? extends IExtension>, ExtensionDecorator>();
|
... | ... | |
177 |
179 |
|
178 |
180 |
/** Instancia que pone los tooltip en la barra de estado */
|
179 |
181 |
private TooltipListener tooltipListener = new TooltipListener();
|
180 |
|
private HashMap infoCodedMenus = new HashMap();
|
|
182 |
|
|
183 |
private HashMap infoCodedMenus = new HashMap();
|
181 |
184 |
|
182 |
185 |
private String titlePrefix;
|
183 |
186 |
|
... | ... | |
190 |
193 |
* DOCUMENT ME!
|
191 |
194 |
*/
|
192 |
195 |
public void init() {
|
193 |
|
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
|
|
196 |
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
|
194 |
197 |
if (!SwingUtilities.isEventDispatchThread()) {
|
195 |
198 |
throw new RuntimeException("Not Event Dispatch Thread");
|
196 |
199 |
}
|
... | ... | |
1066 |
1069 |
String actionlName = control.getName();
|
1067 |
1070 |
ActionInfo action = actionManager.getAction(actionlName);
|
1068 |
1071 |
try {
|
1069 |
|
//
|
1070 |
|
// org.gvsig.andami.plugins.IExtension ext =
|
1071 |
|
// (org.gvsig.andami.plugins.IExtension) classesExtensions
|
1072 |
|
// .get(controlClass.get(control));
|
1073 |
|
// boolean enabled =
|
1074 |
|
// ((Boolean) estadoExtensiones.get(ext)).booleanValue();
|
1075 |
|
// boolean visible =
|
1076 |
|
// ((Boolean) visibilidadExtensiones.get(ext)).booleanValue();
|
1077 |
|
|
1078 |
1072 |
boolean enabled = false;
|
1079 |
|
boolean visible = cache.isVisible(action);
|
1080 |
|
if( visible ) {
|
1081 |
|
enabled = cache.isEnabled(action);
|
1082 |
|
}
|
1083 |
|
|
|
1073 |
boolean visible = false;
|
|
1074 |
|
|
1075 |
if(action == null) {
|
|
1076 |
IExtension ext =
|
|
1077 |
(IExtension) classesExtensions.get(controlClass.get(control));
|
|
1078 |
enabled = ext.isEnabled();
|
|
1079 |
visible = ext.isVisible();
|
|
1080 |
} else {
|
|
1081 |
enabled = false;
|
|
1082 |
visible = cache.isVisible(action);
|
|
1083 |
if( visible ) {
|
|
1084 |
enabled = cache.isEnabled(action);
|
|
1085 |
}
|
|
1086 |
}
|
1084 |
1087 |
control.setEnabled(enabled);
|
1085 |
1088 |
control.setVisible(visible);
|
1086 |
1089 |
} catch (Exception ex) {
|
... | ... | |
1120 |
1123 |
Iterator it = toolBarMap.values().iterator();
|
1121 |
1124 |
|
1122 |
1125 |
while (it.hasNext()) {
|
1123 |
|
SelectableToolBar t = (SelectableToolBar) it.next();
|
|
1126 |
JComponent t = (JComponent) it.next();
|
1124 |
1127 |
boolean todosOcultos = true;
|
1125 |
1128 |
|
1126 |
1129 |
for (int i = 0; i < t.getComponentCount(); i++) {
|
... | ... | |
1134 |
1137 |
if (todosOcultos) {
|
1135 |
1138 |
t.setVisible(false);
|
1136 |
1139 |
} else {
|
1137 |
|
t.setVisible(t.getAndamiVisibility());
|
|
1140 |
if(t instanceof SelectableToolBar) {
|
|
1141 |
t.setVisible(((SelectableToolBar)t).getAndamiVisibility());
|
|
1142 |
} else
|
|
1143 |
t.setVisible(true);
|
1138 |
1144 |
}
|
1139 |
1145 |
}
|
1140 |
1146 |
|
... | ... | |
1491 |
1497 |
bEstado.addControl(control.getName(), (Component) control);
|
1492 |
1498 |
controlClass.put(control, extensionClass);
|
1493 |
1499 |
}
|
|
1500 |
|
|
1501 |
public void addToolBarControl(Class extensionClass, JToolBar control, String name) {
|
|
1502 |
//toolBarMap.put(name, control);
|
|
1503 |
toolBars.add(control);
|
|
1504 |
controlClass.put(control, extensionClass);
|
|
1505 |
}
|
1494 |
1506 |
|
1495 |
1507 |
public void removeStatusBarControl(String name) {
|
1496 |
1508 |
Component c = bEstado.removeControl(name);
|
... | ... | |
1675 |
1687 |
}
|
1676 |
1688 |
Iterator it = toolBarMap.values().iterator();
|
1677 |
1689 |
while (it.hasNext()) {
|
1678 |
|
SelectableToolBar t = (SelectableToolBar) it.next();
|
|
1690 |
JComponent t = (JComponent) it.next();
|
1679 |
1691 |
String nameCtrl = t.getName();
|
1680 |
1692 |
if (nameCtrl != null) {
|
1681 |
1693 |
if (nameCtrl.compareTo(name) == 0) {
|