experimental: quick-n-dirty way to indicate compilation progress when (re)loading simulations
This commit is contained in:
parent
9b2a1097d1
commit
14924bae66
|
@ -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.113 2009/03/11 19:19:39 fros4943 Exp $
|
* $Id: GUI.java,v 1.114 2009/03/11 20:14:52 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja;
|
package se.sics.cooja;
|
||||||
|
@ -1972,7 +1972,9 @@ public class GUI extends Observable {
|
||||||
/* Use provided configuration, or open File Chooser */
|
/* Use provided configuration, or open File Chooser */
|
||||||
if (configFile != null && !configFile.isDirectory()) {
|
if (configFile != null && !configFile.isDirectory()) {
|
||||||
if (!configFile.exists() || !configFile.canRead()) {
|
if (!configFile.exists() || !configFile.canRead()) {
|
||||||
logger.fatal("No read access to file");
|
logger.fatal("No read access to file: " + configFile.getAbsolutePath());
|
||||||
|
/* File does not exist, open dialog */
|
||||||
|
doLoadConfig(askForConfirmation, quick, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2048,8 +2050,10 @@ public class GUI extends Observable {
|
||||||
progressBar = new JProgressBar(0, 100);
|
progressBar = new JProgressBar(0, 100);
|
||||||
progressBar.setValue(0);
|
progressBar.setValue(0);
|
||||||
progressBar.setIndeterminate(true);
|
progressBar.setIndeterminate(true);
|
||||||
button = new JButton("Cancel");
|
|
||||||
|
|
||||||
|
PROGRESS_BAR = progressBar; /* Allow various parts of COOJA to show messages */
|
||||||
|
|
||||||
|
button = new JButton("Cancel");
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (loadThread.isAlive()) {
|
if (loadThread.isAlive()) {
|
||||||
|
@ -2069,7 +2073,7 @@ public class GUI extends Observable {
|
||||||
progressPanel.setVisible(true);
|
progressPanel.setVisible(true);
|
||||||
|
|
||||||
progressDialog.getContentPane().add(progressPanel);
|
progressDialog.getContentPane().add(progressPanel);
|
||||||
progressDialog.pack();
|
progressDialog.setSize(400, 200);
|
||||||
|
|
||||||
progressDialog.getRootPane().setDefaultButton(button);
|
progressDialog.getRootPane().setDefaultButton(button);
|
||||||
progressDialog.setLocationRelativeTo(GUI.getTopParentContainer());
|
progressDialog.setLocationRelativeTo(GUI.getTopParentContainer());
|
||||||
|
@ -2106,7 +2110,6 @@ public class GUI extends Observable {
|
||||||
if (newSim != null) {
|
if (newSim != null) {
|
||||||
myGUI.setSimulation(newSim);
|
myGUI.setSimulation(newSim);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2173,6 +2176,8 @@ public class GUI extends Observable {
|
||||||
progressBar.setValue(0);
|
progressBar.setValue(0);
|
||||||
progressBar.setIndeterminate(true);
|
progressBar.setIndeterminate(true);
|
||||||
|
|
||||||
|
PROGRESS_BAR = progressBar; /* Allow various parts of COOJA to show messages */
|
||||||
|
|
||||||
JButton button = new JButton("Cancel");
|
JButton button = new JButton("Cancel");
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
@ -2194,7 +2199,7 @@ public class GUI extends Observable {
|
||||||
progressPanel.setVisible(true);
|
progressPanel.setVisible(true);
|
||||||
|
|
||||||
progressDialog.getContentPane().add(progressPanel);
|
progressDialog.getContentPane().add(progressPanel);
|
||||||
progressDialog.pack();
|
progressDialog.setSize(400, 200);
|
||||||
|
|
||||||
progressDialog.getRootPane().setDefaultButton(button);
|
progressDialog.getRootPane().setDefaultButton(button);
|
||||||
progressDialog.setLocationRelativeTo(frame);
|
progressDialog.setLocationRelativeTo(frame);
|
||||||
|
@ -3789,4 +3794,13 @@ public class GUI extends Observable {
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static JProgressBar PROGRESS_BAR = null;
|
||||||
|
public static void setProgressMessage(String msg) {
|
||||||
|
if (PROGRESS_BAR != null && PROGRESS_BAR.isShowing()) {
|
||||||
|
PROGRESS_BAR.setString(msg);
|
||||||
|
PROGRESS_BAR.setStringPainted(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,14 +26,14 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: MessageList.java,v 1.9 2009/03/09 13:19:07 fros4943 Exp $
|
* $Id: MessageList.java,v 1.10 2009/03/11 20:14:58 fros4943 Exp $
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------
|
* -----------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne, Fredrik Osterlind
|
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne, Fredrik Osterlind
|
||||||
* Created : 2006-06-14
|
* Created : 2006-06-14
|
||||||
* Updated : $Date: 2009/03/09 13:19:07 $
|
* Updated : $Date: 2009/03/11 20:14:58 $
|
||||||
* $Revision: 1.9 $
|
* $Revision: 1.10 $
|
||||||
*/
|
*/
|
||||||
package se.sics.cooja.dialogs;
|
package se.sics.cooja.dialogs;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
@ -62,6 +62,8 @@ import javax.swing.ListModel;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import se.sics.cooja.GUI;
|
||||||
|
|
||||||
public class MessageList extends JList {
|
public class MessageList extends JList {
|
||||||
|
|
||||||
public static final int NORMAL = 0;
|
public static final int NORMAL = 0;
|
||||||
|
@ -160,6 +162,8 @@ public class MessageList extends JList {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMessage(final String message, final int type) {
|
public void addMessage(final String message, final int type) {
|
||||||
|
GUI.setProgressMessage(message);
|
||||||
|
|
||||||
MessageContainer msg = new MessageContainer(message, type);
|
MessageContainer msg = new MessageContainer(message, type);
|
||||||
messages.add(msg);
|
messages.add(msg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue