minor fix: save iconified plugins

This commit is contained in:
fros4943 2010-04-26 08:19:32 +00:00
parent a430573688
commit c2876b2d25

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.167 2010/03/19 15:04:51 fros4943 Exp $ * $Id: GUI.java,v 1.168 2010/04/26 08:19:32 fros4943 Exp $
*/ */
package se.sics.cooja; package se.sics.cooja;
@ -3481,9 +3481,11 @@ public class GUI extends Observable {
pluginSubElement.setText("" + pluginFrame.getLocation().y); pluginSubElement.setText("" + pluginFrame.getLocation().y);
pluginElement.addContent(pluginSubElement); pluginElement.addContent(pluginSubElement);
pluginSubElement = new Element("minimized"); if (pluginFrame.isIcon()) {
pluginSubElement.setText(new Boolean(pluginFrame.isIcon()).toString()); pluginSubElement = new Element("minimized");
pluginElement.addContent(pluginSubElement); pluginSubElement.setText("" + true);
pluginElement.addContent(pluginSubElement);
}
} }
config.add(pluginElement); config.add(pluginElement);
@ -3615,9 +3617,18 @@ public class GUI extends Observable {
location.y = Integer.parseInt(pluginSubElement.getText()); location.y = Integer.parseInt(pluginSubElement.getText());
startedPlugin.getGUI().setLocation(location); startedPlugin.getGUI().setLocation(location);
} else if (pluginSubElement.getName().equals("minimized")) { } else if (pluginSubElement.getName().equals("minimized")) {
try { boolean minimized = Boolean.parseBoolean(pluginSubElement.getText());
startedPlugin.getGUI().setIcon(Boolean.parseBoolean(pluginSubElement.getText())); final JInternalFrame pluginGUI = startedPlugin.getGUI();
} catch (PropertyVetoException e) { } if (minimized && pluginGUI != null) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
pluginGUI.setIcon(true);
} catch (PropertyVetoException e) {
}
};
});
}
} }
} }