Author: tfmorris
Date: 2007-07-10 10:54:02-0700
New Revision: 13026
Added:
trunk/src_new/org/argouml/application/events/ArgoStatusEvent.java (contents, props changed)
trunk/src_new/org/argouml/application/events/ArgoStatusEventListener.java (contents, props changed)
trunk/src_new/org/argouml/uml/diagram/ui/StatusBarAdapter.java (contents, props changed)
Modified:
trunk/src_new/org/argouml/application/events/ArgoEventTypes.java
Log:
Issue 4789 - Add status event to be used for communicating with status line in browser (and other interested listeners)
Modified: trunk/src_new/org/argouml/application/events/ArgoEventTypes.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/application/events/ArgoEventTypes.java?view=diff&rev=13026&p1=trunk/src_new/org/argouml/application/events/ArgoEventTypes.java&p2=trunk/src_new/org/argouml/application/events/ArgoEventTypes.java&r1=13025&r2=13026
==============================================================================
--- trunk/src_new/org/argouml/application/events/ArgoEventTypes.java (original)
+++ trunk/src_new/org/argouml/application/events/ArgoEventTypes.java 2007-07-10 10:54:02-0700
@@ -131,25 +131,60 @@
/**
- * Id indicating any GENERATION event.
+ * Id indicating any HELP event.
*/
int ANY_HELP_EVENT = 1400;
/**
- * Id indicating the default GENERATION was changed.
+ * Id indicating the help text was changed.
*/
int HELP_CHANGED = 1401;
/**
- * Id indicating a GENERATION was removed.
+ * Id indicating a help text was removed.
*/
int HELP_REMOVED = 1403;
/**
- * Last generation event.
+ * Last help event.
*/
int LAST_HELP_EVENT = 1499;
+
+
+ /**
+ * Id indicating any STATUS event.
+ */
+ int ANY_STATUS_EVENT = 1500;
+
+ /**
+ * Id indicating the status text was changed.
+ */
+ int STATUS_TEXT = 1501;
+
+ /**
+ * Id indicating that there is no current status text.
+ */
+ int STATUS_CLEARED = 1503;
+
+ /**
+ * Id indicating that a project was saved.
+ */
+ int STATUS_PROJECT_SAVED = 1504;
+
+ /**
+ * Id indicating that a project was loaded.
+ */
+ int STATUS_PROJECT_LOADED = 1505;
+
+ /**
+ * Id indicating that a project was modified.
+ */
+ int STATUS_PROJECT_MODIFIED = 1506;
+ /**
+ * Last help event.
+ */
+ int LAST_STATUS_EVENT = 1599;
/**
* Id marker for the last Argo event.
Added: trunk/src_new/org/argouml/application/events/ArgoStatusEvent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/application/events/ArgoStatusEvent.java?view=auto&rev=13026
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/application/events/ArgoStatusEvent.java 2007-07-10 10:54:02-0700
@@ -0,0 +1,65 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.application.events;
+
+/**
+ * The Status Event is used to notify interested parties of a status
+ * change. The status can be arbitrary text, or the name of a project
+ * which was saved or loaded.
+ *
+ * @author Tom Morris <[email protected]>
+ */
+public class ArgoStatusEvent extends ArgoEvent {
+
+ private String text;
+
+ /**
+ * @param eventType reported by this event.
+ * @param src object that caused the event.
+ * @param message the status text string (already translated) to be shown
+ */
+ public ArgoStatusEvent(int eventType, Object src, String message) {
+ super(eventType, src);
+ text = message;
+ }
+
+ /**
+ * Indicates the start of the 100-digit range for status events.
+ *
+ * @return the first id reserved for events.
+ */
+ @Override
+ public int getEventStartRange() {
+ return ANY_STATUS_EVENT;
+ }
+
+ /**
+ * @return Returns the event text containing either a status message or
+ * the name of the project that was saved/loaded.
+ */
+ public String getText() {
+ return text;
+ }
+}
Added: trunk/src_new/org/argouml/application/events/ArgoStatusEventListener.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/application/events/ArgoStatusEventListener.java?view=auto&rev=13026
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/application/events/ArgoStatusEventListener.java 2007-07-10 10:54:02-0700
@@ -0,0 +1,76 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.application.events;
+
+import org.argouml.application.api.ArgoEventListener;
+
+/**
+ * An interface that objects that are interested in StatusEvents
+ * must extend.
+ *
+ * @author Tom Morris <[email protected]>
+ */
+public interface ArgoStatusEventListener extends ArgoEventListener {
+
+ /**
+ * Invoked when there is a new status text to be shown,
+ * that should replace any previous one.
+ *
+ * @param e <code>ArgoStatusEvent</code> describing the changed text
+ */
+ public void statusText(ArgoStatusEvent e);
+
+ /**
+ * Invoked when a previously shown status text has to be removed.
+ *
+ * @param e <code>ArgoStatusEvent</code> describing the removed event
+ */
+ public void statusCleared(ArgoStatusEvent e);
+
+ /**
+ * A project has been saved.
+ *
+ * @param e <code>ArgoStatusEvent</code> with the name of the project that
+ * was saved.
+ */
+ public void projectSaved(ArgoStatusEvent e);
+
+ /**
+ * A project has been loaded.
+ *
+ * @param e <code>ArgoStatusEvent</code> with the name of the project that
+ * was loaded.
+ */
+ public void projectLoaded(ArgoStatusEvent e);
+
+ /**
+ * A project has been modified.
+ *
+ * @param e <code>ArgoStatusEvent</code> with the name of the project that
+ * was modified (ignored for current ArgoUML implementation where
+ * there is only a single project open at a time).
+ */
+ public void projectModified(ArgoStatusEvent e);
+}
Added: trunk/src_new/org/argouml/uml/diagram/ui/StatusBarAdapter.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/StatusBarAdapter.java?view=auto&rev=13026
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/uml/diagram/ui/StatusBarAdapter.java 2007-07-10 10:54:02-0700
@@ -0,0 +1,45 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.diagram.ui;
+
+import org.argouml.application.events.ArgoEventPump;
+import org.argouml.application.events.ArgoEventTypes;
+import org.argouml.application.events.ArgoStatusEvent;
+import org.tigris.gef.ui.IStatusBar;
+
+/**
+ * Adapter class to convert from direct call through GEF's IStatusBar interface
+ * into an event which can be received by any interested consumer.
+ *
+ * @author Tom Morris <[email protected]>
+ */
+public class StatusBarAdapter implements IStatusBar {
+
+ public void showStatus(String statusText) {
+ ArgoEventPump.fireEvent(new ArgoStatusEvent(ArgoEventTypes.STATUS_TEXT,
+ this, statusText));
+ }
+
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.