Author: mes
Date: 2010-11-10 14:32:39 -0800 (Wed, 10 Nov 2010)
New Revision: 22807
Added:
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanelComponent.java
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelComponentSelectedEvent.java
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelComponentSelectedListener.java
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelStateChangedEvent.java
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelStateChangedListener.java
Removed:
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanelListener.java
Modified:
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanel.java
Log:
refactored CytoPanels so that panel components are OSGi services
Modified:
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanel.java
===================================================================
---
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanel.java
2010-11-10 22:28:30 UTC (rev 22806)
+++
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanel.java
2010-11-10 22:32:39 UTC (rev 22807)
@@ -40,59 +40,8 @@
* @author Ben Gross.
*/
public interface CytoPanel {
- /**
- * Adds a component to the CytoPanel.
- *
- * @param component Component reference.
- * @return component Component reference.
- */
- public Component add(Component component);
/**
- * Adds a component to the CytoPanel at specified index.
- *
- * @param component Component reference.
- * @param index Component index.
- * @return component Component reference.
- */
- public Component add(Component component, int index);
-
- /**
- * Adds a component to the CytoPanel with a specified title.
- *
- * @param title Component title.
- * @param component Component reference.
- * @return component Component reference.
- */
- public Component add(String title, Component component);
-
- /**
- * Adds a component to the CytoPanel with specified title and icon.
- *
- * @param title Component title (can be null).
- * @param icon Component icon (can be null).
- * @param component Component reference.
- */
- public void add(String title, Icon icon, Component component);
-
- /**
- * Adds a component to the CytoPanel with specified title, icon, and
tool tip.
- *
- * @param title Component title (can be null).
- * @param icon Component icon (can be null).
- * @param component Component reference.
- * @param tip Component Tool tip text.
- */
- public void add(String title, Icon icon, Component component, String
tip);
-
- /**
- * Returns the title of the CytoPanel.
- *
- * @return String Title.
- */
- public String getTitle();
-
- /**
* Returns the number of components in the CytoPanel.
*
* @return int Number of components.
@@ -102,7 +51,7 @@
/**
* Returns the currently selected component.
*
- * @return component Currently selected Component reference.
+ * @return component Currently selected CytoPanelComponent reference.
*/
public Component getSelectedComponent();
@@ -136,33 +85,6 @@
public int indexOfComponent(Component component);
/**
- * Returns the first Component index with given title.
- *
- * @param title Component title.
- * @return int Component index with given title or -1 if not found.
- */
- public int indexOfComponent(String title);
-
- /**
- * Removes specified component from the CytoPanel.
- *
- * @param component Component reference.
- */
- public void remove(Component component);
-
- /**
- * Removes the component from the CytoPanel at the specified index.
- *
- * @param index Component index.
- */
- public void remove(int index);
-
- /**
- * Removes all the components from the CytoPanel.
- */
- public void removeAll();
-
- /**
* Sets the selected index on the CytoPanel.
*
* @param index The desired index.
@@ -177,25 +99,11 @@
public void setState(CytoPanelState cytoPanelState);
/**
- * Adds a CytoPanel listener.
- *
- * @param cytoPanelListener Reference to a CytoPanelListener.
- */
- public void addCytoPanelListener(CytoPanelListener cytoPanelListener);
-
- /**
- * Removes a CytoPanel listener.
- *
- * @param cytoPanelListener Reference to a CytoPanelListener.
- */
- public void removeCytoPanelListener(CytoPanelListener
cytoPanelListener);
-
- /**
* Returns the position in the layout.
*
* @return The CytoPanelName enum value indicating the position in the
layout.
*/
- public CytoPanelName getCompassDirection();
+ public CytoPanelName getCytoPanelName();
/**
* Returns the Component that is this CytoPanel. This is a hack to
allow
Added:
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanelComponent.java
===================================================================
---
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanelComponent.java
(rev 0)
+++
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanelComponent.java
2010-11-10 22:32:39 UTC (rev 22807)
@@ -0,0 +1,69 @@
+
+/*
+ File: CytoPanelComponent.java
+
+ Copyright (c) 2006, 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ 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
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.view;
+
+
+import java.awt.Component;
+import javax.swing.Icon;
+
+
+/**
+ * An interface that allows a component to be registered as a service
+ * that will then be added to the appropriate CytoPanel.
+ */
+public interface CytoPanelComponent {
+
+ /**
+ * Returns the Component to be added to the CytoPanel.
+ * @return The Component to be added to the CytoPanel.
+ */
+ Component getComponent();
+
+ /**
+ * Returns the name of the CytoPanel that this component should be
added to.
+ * @return the name of the CytoPanel that this component should be
added to.
+ */
+ CytoPanelName getCytoPanelName();
+
+ /**
+ * Returns the title of the tab within the CytoPanel for this component.
+ * @return the title of the tab within the CytoPanel for this component.
+ */
+ String getTitle();
+
+ /**
+ * Returns the Icon to be used along with the title in the tab for this
+ * this component. May be null!
+ * @return the Icon to be used along with the title in the tab for this
+ * this component. May be null!
+ */
+ Icon getIcon();
+}
Deleted:
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanelListener.java
===================================================================
---
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanelListener.java
2010-11-10 22:28:30 UTC (rev 22806)
+++
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/CytoPanelListener.java
2010-11-10 22:32:39 UTC (rev 22807)
@@ -1,84 +0,0 @@
-/*
- File: CytoPanelListener.java
-
- Copyright (c) 2006, The Cytoscape Consortium (www.cytoscape.org)
-
- The Cytoscape Consortium is:
- - Institute for Systems Biology
- - University of California San Diego
- - Memorial Sloan-Kettering Cancer Center
- - Institut Pasteur
- - Agilent Technologies
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
- documentation provided hereunder is on an "as is" basis, and the
- Institute for Systems Biology and the Whitehead Institute
- have no obligations to provide maintenance, support,
- updates, enhancements or modifications. In no event shall the
- Institute for Systems Biology and the Whitehead Institute
- 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
- Institute for Systems Biology and the Whitehead Institute
- have been advised of the possibility of such damage. See
- the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
-
-//
-// $Id: CytoPanelListener.java 9565 2007-02-13 19:36:50Z mes $
-//------------------------------------------------------------------------------
-
-// our package
-package org.cytoscape.view;
-
-
-// imports
-import java.util.EventListener;
-
-
-/**
- * This listener interface provides the
- * mechanism to respond to CytoPanel Events.
- *
- * @author Ben Gross
- */
-public interface CytoPanelListener extends EventListener {
- /**
- * Notifies the listener on a change in the CytoPanel state.
- *
- * @param newState The new CytoPanel state - see {...@link
CytoPanelState}.
- */
- public void onStateChange(CytoPanelState newState);
-
- /**
- * Notifies the listener when a new component on the CytoPanel is
selected.
- *
- * @param componentIndex The index of the component selected.
- */
- public void onComponentSelected(int componentIndex);
-
- /**
- * Notifies the listener when a component is added to the CytoPanel.
- *
- * @param count The number of components on the CytoPanel after the add.
- */
- public void onComponentAdded(int count);
-
- /**
- * Notifies the listener when a component is removed from the CytoPanel.
- *
- * @param count The number of components on the CytoPanel after the
remove.
- */
- public void onComponentRemoved(int count);
-}
Added:
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelComponentSelectedEvent.java
===================================================================
---
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelComponentSelectedEvent.java
(rev 0)
+++
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelComponentSelectedEvent.java
2010-11-10 22:32:39 UTC (rev 22807)
@@ -0,0 +1,29 @@
+
+package org.cytoscape.view.events;
+
+import org.cytoscape.event.AbstractCyEvent;
+import org.cytoscape.view.CytoPanel;
+import org.cytoscape.view.CytoPanelState;
+
+/**
+ *
+ */
+public final class CytoPanelComponentSelectedEvent extends
AbstractCyEvent<Object> {
+
+ private final CytoPanel cp;
+ private final int index;
+
+ public CytoPanelComponentSelectedEvent(final Object source, final
CytoPanel cp, int index) {
+ super(source, CytoPanelComponentSelectedListener.class);
+ this.cp = cp;
+ this.index = index;
+ }
+
+ public CytoPanel getCytoPanel() {
+ return cp;
+ }
+
+ public int getSelectedIndex() {
+ return index;
+ }
+}
Added:
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelComponentSelectedListener.java
===================================================================
---
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelComponentSelectedListener.java
(rev 0)
+++
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelComponentSelectedListener.java
2010-11-10 22:32:39 UTC (rev 22807)
@@ -0,0 +1,11 @@
+
+package org.cytoscape.view.events;
+
+import org.cytoscape.event.CyListener;
+
+/**
+ *
+ */
+public interface CytoPanelComponentSelectedListener extends CyListener {
+ public void handleEvent(CytoPanelComponentSelectedEvent e);
+}
Added:
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelStateChangedEvent.java
===================================================================
---
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelStateChangedEvent.java
(rev 0)
+++
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelStateChangedEvent.java
2010-11-10 22:32:39 UTC (rev 22807)
@@ -0,0 +1,29 @@
+
+package org.cytoscape.view.events;
+
+import org.cytoscape.event.AbstractCyEvent;
+import org.cytoscape.view.CytoPanel;
+import org.cytoscape.view.CytoPanelState;
+
+/**
+ *
+ */
+public final class CytoPanelStateChangedEvent extends AbstractCyEvent<Object> {
+
+ private final CytoPanel cp;
+ private final CytoPanelState newState;
+
+ public CytoPanelStateChangedEvent(final Object source, final CytoPanel
cp, final CytoPanelState newState) {
+ super(source, CytoPanelStateChangedListener.class);
+ this.cp = cp;
+ this.newState = newState;
+ }
+
+ public CytoPanel getCytoPanel() {
+ return cp;
+ }
+
+ public CytoPanelState getNewState() {
+ return newState;
+ }
+}
Added:
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelStateChangedListener.java
===================================================================
---
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelStateChangedListener.java
(rev 0)
+++
core3/swing-application-api/trunk/src/main/java/org/cytoscape/view/events/CytoPanelStateChangedListener.java
2010-11-10 22:32:39 UTC (rev 22807)
@@ -0,0 +1,11 @@
+
+package org.cytoscape.view.events;
+
+import org.cytoscape.event.CyListener;
+
+/**
+ *
+ */
+public interface CytoPanelStateChangedListener extends CyListener {
+ public void handleEvent(CytoPanelStateChangedEvent e);
+}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.