Revision 38764 branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/toggle/DisplayGridExtension.java
DisplayGridExtension.java | ||
---|---|---|
37 | 37 |
*/ |
38 | 38 |
public class DisplayGridExtension extends AbstractTogglePropertyExtension { |
39 | 39 |
|
40 |
protected void doSetValue(MapControl mc, boolean new_value) {
|
|
40 |
protected void doToggleValue(MapControl mc) {
|
|
41 | 41 |
|
42 |
mc.setGridVisibility(new_value); |
|
42 |
Boolean curr = mc.getGrid().isShowGrid(); |
|
43 |
mc.setGridVisibility(!curr); |
|
43 | 44 |
Preferences prefs = GridPage.prefs; |
44 | 45 |
prefs.putBoolean("grid.showgrid", mc.getGrid().isShowGrid()); |
45 | 46 |
} |
46 | 47 |
|
47 |
protected boolean isToggleActive() { |
|
48 |
|
|
49 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
|
50 |
if (v instanceof org.gvsig.app.project.documents.view.gui.DefaultViewPanel) { |
|
51 |
MapControl mc = ((DefaultViewPanel)v).getMapControl(); |
|
52 |
return mc.getGrid().isShowGrid(); |
|
53 |
} else { |
|
54 |
return false; |
|
55 |
} |
|
48 |
protected String getActionCommand() { |
|
49 |
return "show-grid-toggle-display-grid"; |
|
56 | 50 |
} |
57 |
|
|
58 |
protected String getActionCommand(boolean on_off) { |
|
59 |
|
|
60 |
if (on_off) { |
|
61 |
return "show-grid-toggle-display-grid"; |
|
62 |
} else { |
|
63 |
return "show-grid-toggle-hide-grid"; |
|
64 |
} |
|
65 |
|
|
66 |
} |
|
67 | 51 |
} |
Also available in: Unified diff