CustomerDataEditorSupport.java Sample

This topic inludes the source code for the CustomerDataEditorSupport.java Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/ExtensionDevKit/ControlDevKit/ControlFeatures/propEditor/ide/

Sample Source Code


01 package propEditor.ide; 
02 
03 import com.bea.ide.control.ControlBehaviorContext;
04 import com.bea.ide.control.EditorSupport;
05 import com.bea.ide.control.ControlAttribute;
06 import com.bea.ide.control.DefaultEditorSupport;
07 
08 
09 /*
10  * Represents support for actions in the IDE. In particular, this
11  * class provides code that executes when the user clicks the ... in the 
12  * Property Editor to edit the customer-id attribute.
13  */
14 public class CustomerDataEditorSupport extends DefaultEditorSupport
15 
16     public Object getBehavior(String behavior, ControlBehaviorContext ctx)
17     {
18         // if both editor and validator are specified only editor is used
19         // TODO: validator example.
20         if (behavior.equals(EditorSupport.BEHAVIOR_ATTRIBUTE_EDITOR))
21         {
22             if (ctx instanceof ControlAttribute && 
23                 ((ControlAttribute)ctx).getName().equals("customer-id"))
24             {
25                 return new CustomerIdEditorSimple(((ControlAttribute)ctx).getValue());
26             }            
27         }        
28         return super.getBehavior(behavior, ctx);
29     }
30     
31  
32