Revision: 1363
http://svn.sourceforge.net/spring-rich-c/?rev=1363&view=rev
Author: peterdb
Date: 2006-09-03 23:51:21 -0700 (Sun, 03 Sep 2006)
Log Message:
-----------
changes for RCP-174: Show icon in nodes of TreeCompositeDialogPage
Modified Paths:
--------------
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/AbstractDialogPage.java
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/DialogPage.java
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/TabbedDialogPage.java
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/TreeCompositeDialogPage.java
Modified:
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/AbstractDialogPage.java
===================================================================
---
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/AbstractDialogPage.java
2006-09-03 08:29:58 UTC (rev 1362)
+++
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/AbstractDialogPage.java
2006-09-04 06:51:21 UTC (rev 1363)
@@ -20,6 +20,7 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
@@ -28,21 +29,25 @@
import org.springframework.richclient.core.Message;
import org.springframework.richclient.factory.AbstractControlFactory;
import org.springframework.richclient.factory.ControlFactory;
+import org.springframework.richclient.image.config.IconConfigurable;
import org.springframework.util.Assert;
/**
- * A convenience implementation of the DialogPage interface. Recommended to be
- * used as a base class for all GUI dialog pages (or panes.)
+ * A convenience implementation of the DialogPage interface. Recommended to be
used as a
+ * base class for all GUI dialog pages (or panes.)
*
* @author Keith Donald
* @see DialogPage
*/
-public abstract class AbstractDialogPage extends LabeledObjectSupport
implements DialogPage, ControlFactory, Guarded {
+public abstract class AbstractDialogPage extends LabeledObjectSupport
implements DialogPage, ControlFactory, Guarded,
+ IconConfigurable {
private final MessageChangeHandler messageChangeHandler = new
MessageChangeHandler();
private String pageId;
+ private Icon icon;
+
private boolean pageComplete = true;
private DefaultMessageAreaModel messageBuffer;
@@ -58,67 +63,56 @@
}
/**
- * Creates a new dialog page. This titles of this dialog page will be
- * configured using the default ObjectConfigurer.
+ * Creates a new dialog page. This titles of this dialog page will be
configured using
+ * the default ObjectConfigurer.
*
- * @param pageId
- * the id of this dialog page. This will be used to configure
the
- * page.
+ * @param pageId the id of this dialog page. This will be used to
configure the page.
*/
- protected AbstractDialogPage(String pageId) {
- this(pageId, true);
+ protected AbstractDialogPage( String pageId ) {
+ this( pageId, true );
}
/**
* Creates a new dialog page.
*
- * @param pageId
- * the id of this dialog page
- * @param autoConfigure
- * whether or not to use an ObjectConfigurer to configure the
- * titles of this dialog page using the given pageId
+ * @param pageId the id of this dialog page
+ * @param autoConfigure whether or not to use an ObjectConfigurer to
configure the
+ * titles of this dialog page using the given pageId
*/
- protected AbstractDialogPage(String pageId, boolean autoConfigure) {
- this.messageBuffer = new DefaultMessageAreaModel(this);
- this.messageBuffer.addPropertyChangeListener(messageChangeHandler);
- setId(pageId, autoConfigure);
+ protected AbstractDialogPage( String pageId, boolean autoConfigure ) {
+ this.messageBuffer = new DefaultMessageAreaModel( this );
+ this.messageBuffer.addPropertyChangeListener( messageChangeHandler );
+ setId( pageId, autoConfigure );
}
/**
* Creates a new dialog page with the given title.
*
- * @param pageId
- * the id of this dialog page
- * @param autoConfigure
- * whether or not to use an ObjectConfigurer to configure the
- * titles of this dialog page using the given pageId
- * @param title
- * the title of this dialog page, or <code>null</code> if none
+ * @param pageId the id of this dialog page
+ * @param autoConfigure whether or not to use an ObjectConfigurer to
configure the
+ * titles of this dialog page using the given pageId
+ * @param title the title of this dialog page, or <code>null</code> if none
*/
- protected AbstractDialogPage(String pageId, boolean autoConfigure, String
title) {
- this(pageId, autoConfigure);
- if (title != null) {
- setTitle(title);
+ protected AbstractDialogPage( String pageId, boolean autoConfigure, String
title ) {
+ this( pageId, autoConfigure );
+ if( title != null ) {
+ setTitle( title );
}
}
/**
* Creates a new dialog page with the given title and image.
*
- * @param pageId
- * the id of this dialog page
- * @param autoConfigure
- * whether or not to use an ObjectConfigurer to configure the
- * titles of this dialog page using the given pageId
- * @param title
- * the title of this dialog page, or <code>null</code> if none
- * @param icon
- * the image for this dialog page, or <code>null</code> if none
+ * @param pageId the id of this dialog page
+ * @param autoConfigure whether or not to use an ObjectConfigurer to
configure the
+ * titles of this dialog page using the given pageId
+ * @param title the title of this dialog page, or <code>null</code> if none
+ * @param icon the image for this dialog page, or <code>null</code> if none
*/
- protected AbstractDialogPage(String pageId, boolean autoConfigure, String
title, Image icon) {
- this(pageId, autoConfigure, title);
- if (icon != null) {
- setImage(icon);
+ protected AbstractDialogPage( String pageId, boolean autoConfigure, String
title, Image icon ) {
+ this( pageId, autoConfigure, title );
+ if( icon != null ) {
+ setImage( icon );
}
}
@@ -126,16 +120,16 @@
return pageId;
}
- protected void setId(String pageId, boolean autoConfigure) {
- Assert.hasText(pageId, "pageId is required");
+ protected void setId( String pageId, boolean autoConfigure ) {
+ Assert.hasText( pageId, "pageId is required" );
String oldValue = this.pageId;
this.pageId = pageId;
- firePropertyChange("id", oldValue, pageId);
- if (autoConfigure) {
- if (logger.isDebugEnabled()) {
- logger.debug("Auto configuring dialog page with id " + pageId);
+ firePropertyChange( "id", oldValue, pageId );
+ if( autoConfigure ) {
+ if( logger.isDebugEnabled() ) {
+ logger.debug( "Auto configuring dialog page with id " + pageId
);
}
- getObjectConfigurer().configure(this, pageId);
+ getObjectConfigurer().configure( this, pageId );
}
}
@@ -150,11 +144,10 @@
/**
* Sets or clears the message for this page.
*
- * @param newMessage
- * the message, or <code>null</code> to clear the message
+ * @param newMessage the message, or <code>null</code> to clear the message
*/
- public void setMessage(Message newMessage) {
- messageBuffer.setMessage(newMessage);
+ public void setMessage( Message newMessage ) {
+ messageBuffer.setMessage( newMessage );
}
public boolean hasErrorMessage() {
@@ -169,12 +162,12 @@
return messageBuffer.hasInfoMessage();
}
- public void setVisible(boolean visible) {
+ public void setVisible( boolean visible ) {
boolean oldValue = getControl().isVisible();
- getControl().setVisible(visible);
- firePropertyChange("visible", oldValue, visible);
+ getControl().setVisible( visible );
+ firePropertyChange( "visible", oldValue, visible );
}
-
+
public boolean isVisible() {
return getControl().isVisible();
}
@@ -183,18 +176,18 @@
return pageComplete;
}
- public void setPageComplete(boolean pageComplete) {
+ public void setPageComplete( boolean pageComplete ) {
boolean oldValue = this.pageComplete;
this.pageComplete = pageComplete;
- firePropertyChange("pageComplete", oldValue, pageComplete);
+ firePropertyChange( "pageComplete", oldValue, pageComplete );
}
public boolean isEnabled() {
return isPageComplete();
}
- public void setEnabled(boolean enabled) {
- setPageComplete(enabled);
+ public void setEnabled( boolean enabled ) {
+ setPageComplete( enabled );
}
public JComponent getControl() {
@@ -206,13 +199,13 @@
}
public Window getParentWindowControl() {
- return SwingUtilities.getWindowAncestor(getControl());
+ return SwingUtilities.getWindowAncestor( getControl() );
}
/**
- * This default implementation of an <code>AbstractDialogPage</code>
- * method does nothing. Subclasses should override to take some action in
- * response to a help request.
+ * This default implementation of an <code>AbstractDialogPage</code>
method does
+ * nothing. Subclasses should override to take some action in response to
a help
+ * request.
*/
public void performHelp() {
// do nothing by default
@@ -221,8 +214,16 @@
protected abstract JComponent createControl();
private class MessageChangeHandler implements PropertyChangeListener {
- public void propertyChange(PropertyChangeEvent evt) {
- firePropertyChange(evt.getPropertyName(), evt.getOldValue(),
evt.getNewValue());
+ public void propertyChange( PropertyChangeEvent evt ) {
+ firePropertyChange( evt.getPropertyName(), evt.getOldValue(),
evt.getNewValue() );
}
}
-}
\ No newline at end of file
+
+ public void setIcon( Icon icon ) {
+ this.icon = icon;
+ }
+
+ public Icon getIcon() {
+ return icon;
+ }
+}
Modified:
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/DialogPage.java
===================================================================
---
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/DialogPage.java
2006-09-03 08:29:58 UTC (rev 1362)
+++
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/DialogPage.java
2006-09-04 06:51:21 UTC (rev 1363)
@@ -17,6 +17,8 @@
import java.awt.Image;
+import javax.swing.Icon;
+
import org.springframework.binding.value.PropertyChangePublisher;
import org.springframework.richclient.core.Guarded;
import org.springframework.richclient.core.Message;
@@ -45,8 +47,7 @@
/**
* Returns this dialog page's description text.
*
- * @return the description text for this dialog page, or <code>null</code>
- * if none
+ * @return the description text for this dialog page, or <code>null</code>
if none
*/
public String getDescription();
@@ -65,6 +66,13 @@
public Image getImage();
/**
+ * Returns this dialog page's icon.
+ *
+ * @return the icon for this dialog page, or <code>null</code> if none
+ */
+ public Icon getIcon();
+
+ /**
* Notifies that help has been requested for this dialog page.
*/
public void performHelp();
@@ -72,16 +80,16 @@
/**
* Sets the visibility of this dialog page.
*
- * @param visible
- * <code>true</code> to make this page visible, and
- * <code>false</code> to hide it
+ * @param visible <code>true</code> to make this page visible, and
+ * <code>false</code> to hide it
*/
- public void setVisible(boolean visible);
-
+ public void setVisible( boolean visible );
+
/**
* Returns the visibility of this dialog page.
*
- * @return <code>true</code> this page is visible, or <code>false</code>
if this page is hidden
+ * @return <code>true</code> this page is visible, or <code>false</code>
if this
+ * page is hidden
*/
public boolean isVisible();
@@ -91,9 +99,9 @@
* This information is typically to decide when it is okay to submit a
form.
* </p>
*
- * @return <code>true</code> if this page is complete, and
- * <code>false</code> otherwise
+ * @return <code>true</code> if this page is complete, and
<code>false</code>
+ * otherwise
*/
public boolean isPageComplete();
-}
\ No newline at end of file
+}
Modified:
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/TabbedDialogPage.java
===================================================================
---
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/TabbedDialogPage.java
2006-09-03 08:29:58 UTC (rev 1362)
+++
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/TabbedDialogPage.java
2006-09-04 06:51:21 UTC (rev 1363)
@@ -41,6 +41,10 @@
public TabbedDialogPage(String pageId) {
super(pageId);
}
+
+ public TabbedDialogPage(String pageId, boolean autoConfigure) {
+ super(pageId, autoConfigure);
+ }
protected JComponent createControl() {
createPageControls();
@@ -108,5 +112,6 @@
if (page instanceof LabeledObjectSupport) {
tabbedPane.setMnemonicAt(pageIndex, ((LabeledObjectSupport)
page).getMnemonic());
}
+ tabbedPane.setIconAt( pageIndex, page.getIcon() );
}
}
\ No newline at end of file
Modified:
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/TreeCompositeDialogPage.java
===================================================================
---
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/TreeCompositeDialogPage.java
2006-09-03 08:29:58 UTC (rev 1362)
+++
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/dialog/TreeCompositeDialogPage.java
2006-09-04 06:51:21 UTC (rev 1363)
@@ -333,7 +333,7 @@
DialogPage page = (DialogPage)node.getUserObject();
this.setText(decoratePageTitle(page));
- this.setIcon(null);
+ this.setIcon(page.getIcon());
}
return this;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs