[skycastle-commits] SF.net SVN: skycastle: [461] trunk/skycastle/modules/ui/src/main/java/org/ skycastle/ui

  • From: zzorn@xxxxxxxxxxxxxxxxxxxxx
  • To: skycastle-commits@xxxxxxxxxxxxx
  • Date: Mon, 14 Apr 2008 11:52:30 -0700

Revision: 461
          http://skycastle.svn.sourceforge.net/skycastle/?rev=461&view=rev
Author:   zzorn
Date:     2008-04-14 11:52:29 -0700 (Mon, 14 Apr 2008)

Log Message:
-----------
Some cosmetic changes

Removed Paths:
-------------
    
trunk/skycastle/modules/ui/src/main/java/org/skycastle/ui/AbstractPropertyUiObject.java
    trunk/skycastle/modules/ui/src/main/java/org/skycastle/ui/TableUiObject.java

Deleted: 
trunk/skycastle/modules/ui/src/main/java/org/skycastle/ui/AbstractPropertyUiObject.java
===================================================================
--- 
trunk/skycastle/modules/ui/src/main/java/org/skycastle/ui/AbstractPropertyUiObject.java
     2008-04-14 18:37:59 UTC (rev 460)
+++ 
trunk/skycastle/modules/ui/src/main/java/org/skycastle/ui/AbstractPropertyUiObject.java
     2008-04-14 18:52:29 UTC (rev 461)
@@ -1,266 +0,0 @@
-package org.skycastle.ui;
-
-import org.skycastle.core.GameObject;
-import org.skycastle.core.GameObjectId;
-import org.skycastle.util.parameters.ParameterMetadata;
-
-import javax.swing.*;
-import java.io.Serializable;
-
-/**
- * A base class for {@link UiObject}s that are bound to a specific property, 
and require updates when it
- * changes.
- * <p/>
- * Calls the abstract update functions when the UI needs to update as a result 
of changes in the property.
- * <p/>
- * Automatically disables the UI component when the referenced property is not 
available.
- *
- * @author Hans Häggström
- */
-public abstract class AbstractPropertyUiObject
-        extends UiObject
-{
-
-    //======================================================================
-    // Private Fields
-
-    private final PropertyReference myPropertyReference = new 
PropertyReferenceImpl();
-
-    private JComponent myPropertyUi;
-
-    //======================================================================
-    // Private Constants
-
-    private static final long serialVersionUID = 1L;
-
-    //======================================================================
-    // Protected Methods
-
-    //----------------------------------------------------------------------
-    // Protected Constructors
-
-    /**
-     * Creates a new  AbstractPropertyUiObject with a {@link 
PropertyReference} not bound to any property.
-     */
-    protected AbstractPropertyUiObject()
-    {
-    }
-
-
-    /**
-     * Creates a new  AbstractPropertyUiObject with a {@link 
PropertyReference} bound to the specified
-     * property.
-     *
-     * @param gameObjectId       the id of the {@link GameObject} where the 
property is.
-     * @param propertyIdentifier the identifier of the property to bind to.
-     */
-    protected AbstractPropertyUiObject( final GameObjectId gameObjectId, final 
String propertyIdentifier )
-    {
-        myPropertyReference.setReference( gameObjectId, propertyIdentifier );
-    }
-
-    //----------------------------------------------------------------------
-    // Abstract Protected Methods
-
-    /**
-     * Does not need to register as listener to the {@link PropertyReference}, 
the calling code does that.
-     *
-     * @return the UI for the {@link UiObject}.
-     */
-    protected abstract JComponent createUiInDerivedClass();
-
-    /**
-     * Called when there is an update in the editability or availability of 
the property.
-     *
-     * @param available true if the property is available, false if it is not 
(it was removed, or no access
-     *                  rights, or connection terminated, etc)
-     * @param editable  true if the property is editable, false if not.
-     */
-    protected abstract void updateStatus( final boolean available, final 
boolean editable );
-
-
-    /**
-     * @param description the new user readable description for the property.
-     */
-    protected abstract void updateDescription( final String description );
-
-
-    /**
-     * @param propertyValue the new value of the property.
-     */
-    protected abstract void updateValue( final Object propertyValue );
-
-    //----------------------------------------------------------------------
-    // Other Protected Methods
-
-    /**
-     * Override if collection properties are handled specially.
-     *
-     * @param addedElement an element that was added to the collection 
property.
-     */
-    protected void updateAddedElement( final Serializable addedElement )
-    {
-        updateValueFromModel();
-    }
-
-
-    /**
-     * Override if collection properties are handled specially.
-     *
-     * @param removedElement an element that was removed from the collection 
property.
-     */
-    protected void updateRemovedElement( final Serializable removedElement )
-    {
-        updateValueFromModel();
-    }
-
-
-    /**
-     * Called when an entry is added to or changed in a map property.
-     * <p/>
-     * Override if map properties are handled specially.
-     *
-     * @param key   the key of the added entry.
-     * @param value the value for the key.
-     */
-    protected void updatePutEntry( final Serializable key, final Serializable 
value )
-    {
-        updateValueFromModel();
-    }
-
-
-    /**
-     * Called when an entry is removed from a map property.
-     * <p/>
-     * Override if map properties are handled specially.
-     *
-     * @param key the key of the removed entry.
-     */
-    protected void updateRemovedEntry( final Serializable key )
-    {
-        updateValueFromModel();
-    }
-
-
-    /**
-     * @return the {@link PropertyReference} to the property that this {@link 
AbstractPropertyUiObject} is
-     *         bound to.
-     */
-    protected final PropertyReference getPropertyReference()
-    {
-        return myPropertyReference;
-    }
-
-
-    @Override
-    protected final JComponent createUi()
-    {
-        myPropertyUi = createUiInDerivedClass();
-
-        myPropertyReference.addChangeListener( 
createPropertyReferenceListener() );
-
-        updateUiFromModel();
-
-        return myPropertyUi;
-    }
-
-
-    /**
-     * @return user readable description of the property, or null if not 
available.
-     */
-    protected final String getDescription()
-    {
-        final ParameterMetadata propertyMetadata = 
myPropertyReference.getPropertyMetadata();
-
-        String description = null;
-        if ( propertyMetadata != null )
-        {
-            description = propertyMetadata.getUiMetadata().getDescription();
-        }
-
-        return description;
-    }
-
-
-    /**
-     * Updates the UI to reflect the current status of the model (the {@link 
PropertyReference}).
-     */
-    protected final void updateUiFromModel()
-    {
-        updateUiEnabledStateFromModel();
-
-        updateStatus( myPropertyReference.isAvailable(),
-                      myPropertyReference.isEditable() );
-
-        updateDescription( getDescription() );
-
-        updateValueFromModel();
-    }
-
-    //======================================================================
-    // Private Methods
-
-    private void updateUiEnabledStateFromModel()
-    {
-        if ( myPropertyUi != null )
-        {
-            myPropertyUi.setEnabled( myPropertyReference.isAvailable() );
-        }
-    }
-
-
-    private PropertyReferenceListener createPropertyReferenceListener()
-    {
-        return new PropertyReferenceListener()
-        {
-
-            public void onPropertyValueChange( final PropertyReference 
propertyReference )
-            {
-                updateValueFromModel();
-            }
-
-
-            public void onPropertyChanged( final PropertyReference 
propertyReference )
-            {
-                updateUiFromModel();
-            }
-
-
-            public void onPropertyElementAdded( final PropertyReference 
propertyReference,
-                                                final Serializable 
addedElement )
-            {
-                updateAddedElement( addedElement );
-            }
-
-
-            public void onPropertyElementRemoved( final PropertyReference 
propertyReference,
-                                                  final Serializable 
removedElement )
-            {
-                updateRemovedElement( removedElement );
-            }
-
-
-            public void onPropertyEntryPut( final PropertyReference 
propertyReference,
-                                            final Serializable key,
-                                            final Serializable value )
-            {
-                updatePutEntry( key, value );
-            }
-
-
-            public void onPropertyEntryRemoved( final PropertyReference 
propertyReference,
-                                                final Serializable key )
-            {
-                updateRemovedEntry( key );
-            }
-
-        };
-    }
-
-
-    private void updateValueFromModel()
-    {
-        updateValue( myPropertyReference.getProperty( getId(), Object.class, 
null ) );
-    }
-
-}

Deleted: 
trunk/skycastle/modules/ui/src/main/java/org/skycastle/ui/TableUiObject.java
===================================================================
--- 
trunk/skycastle/modules/ui/src/main/java/org/skycastle/ui/TableUiObject.java    
    2008-04-14 18:37:59 UTC (rev 460)
+++ 
trunk/skycastle/modules/ui/src/main/java/org/skycastle/ui/TableUiObject.java    
    2008-04-14 18:52:29 UTC (rev 461)
@@ -1,37 +0,0 @@
-package org.skycastle.ui;
-
-import javax.swing.*;
-
-/**
- * A table where each row is a GameObject and the columns specify which 
properties to show.
- * <p/>
- * Can be set to always show the last rows, allowing it to be used as a chat 
window.
- *
- * @author Hans Häggström
- */
-// TODO: We need a concept of a collection property of game objects, and 
listener support for added and removed GameObjects.
-// The server should send info on added and removed game objects.    
-public class TableUiObject
-        extends UiObject
-{
-
-    //----------------------------------------------------------------------
-    // Constructors
-
-    /**
-     * Creates a new {@link org.skycastle.ui.TableUiObject}.
-     */
-    public TableUiObject()
-    {
-        throw new UnsupportedOperationException( "Constructor not yet 
implemented." ); // IMPLEMENT
-    }
-
-    //======================================================================
-    // Protected Methods
-
-    protected JComponent createUi()
-    {
-        throw new UnsupportedOperationException( "This method has not yet been 
implemented." ); // IMPLEMENT
-    }
-
-}


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

Other related posts:

  • » [skycastle-commits] SF.net SVN: skycastle: [461] trunk/skycastle/modules/ui/src/main/java/org/ skycastle/ui