// $Id: ExampleUpdateProperties.java,v 1.1 2003/02/19 20:11:04 martin Exp $ ; $Name:  $
//
// Example code for UpdateProperties

import rsdesigner.uiextension.*;
import rsdesigner.component.*;
import rsdesigner.design.*;
import rsdesigner.javagateway.*;

/**
 * Describe class <code>UpdateProperties</code> here.
 *
 * @author Simon Geard
 * @version $Revision: 1.1 $
 */
public class ExampleUpdateProperties extends Object implements rsdesigner.uiextension.UpdateProperties {

    /**
     * Creates a new <code>UpdateProperties</code> instance - this constructor must be public
     * and must not have any arguments
     *
     */
    public ExampleUpdateProperties() {}

    /**
     * <code>update</code> properties - this is the method that is called post-create
     * allows the setting of properties on an Artifact after it has been created. It is
     * useful for adding extra properties, such as a timestamp of when the object was
     * created, or who created it
     *
     * @param props a <code>Properties</code> value
     * @return a <code>boolean</code> value - if true the properties will be updated
     */
    public boolean update(Properties props) {

        try {
            // Modify the properties on a lamp
            if (props.exists("category") && props.getValue("category").toString().equalsIgnoreCase("lamps")) {
                // Add the model property
                props.add("model","string","softone");

                // Amend description
                props.add("description","string","flashing monochrome");

                return true;
            }

        } catch (rsdesigner.design.RSDException e) {
        }
        return false;
    }

}
