fix: only toggle actions state in visualized mode + documentation

This commit is contained in:
fros4943 2009-05-28 12:59:02 +00:00
parent 02b5d5e230
commit c9e97fd1ae
1 changed files with 10 additions and 1 deletions

View File

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: GUI.java,v 1.127 2009/05/28 12:55:14 fros4943 Exp $ * $Id: GUI.java,v 1.128 2009/05/28 12:59:02 fros4943 Exp $
*/ */
package se.sics.cooja; package se.sics.cooja;
@ -580,7 +580,15 @@ public class GUI extends Observable {
} }
} }
/**
* Enables/disables menues and menu items depending on whether a simulation is loaded etc.
*/
private void updateGUIComponentState() { private void updateGUIComponentState() {
if (!isVisualized()) {
return;
}
/* Update action state */
Action[] arr = guiActions.toArray(new Action[0]); Action[] arr = guiActions.toArray(new Action[0]);
for (Action a: arr) { for (Action a: arr) {
a.setEnabled(a.isEnabled()); a.setEnabled(a.isEnabled());
@ -594,6 +602,7 @@ public class GUI extends Observable {
} }
} }
/* Mote and mote type menues */
menuMoteTypeClasses.setEnabled(getSimulation() != null); menuMoteTypeClasses.setEnabled(getSimulation() != null);
menuMoteTypes.setEnabled(getSimulation() != null); menuMoteTypes.setEnabled(getSimulation() != null);
} }