I don't know of a component, but i implemented a property editor 
several years ago.  the core is the input item REnderer.  Here is the 
code, maybe it will help

Tracy

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns="*" 
width="100%" 
    horizontalAlign="right" verticalAlign="middle" >
<mx:Script><![CDATA[
  import mx.core.IFlexDisplayObject;
  import mx.core.UIComponent;
  import mx.collections.XMLListCollection;
  import mx.collections.ArrayCollection;
  import mx.managers.PopUpManager;
  import components.RTEPopUp;
  import components.TAPopUp;

  [Bindable]private var _xmlAttribute:XML;
  private var _xmlComponentDef:XML;
  [Bindable]private var _xlOptions:XMLList;
  [Bindable]private var _iOptionItemIndex:int;
  private var _popUpRTE:RTEPopUp;
  private var _popUpTA:TAPopUp;
  

  override public function set data(value:Object) : void
  {
    //trace("IRPropertyInput.set data");
    super.data = value;
    _xmlAttribute = XML(value)
    _xmlComponentDef = _xmlAttribute.parent();
    var sControlType:String = _xmlattribu...@inputtype;
    try  {
    currentState = sControlType;
    }
    catch (error:Error)  {
    currentState = "TextInput";
    }
    if (sControlType == "ComboBox")  {
      _xlOptions = _xmlAttribute.option; 
      selectOptionItem();
    }  
  }//
  
    
  private function selectOptionItem():void
  {
    var xmlOption:XML;
    var sValue:String = _xmlattribu...@value;
    for (var i:int=0; i<_xlOptions.length();i++)  {
      xmlOption = _xlOptions[i];
      if (xmlopti...@value == sValue)  {
        _iOptionItemIndex = i;
        break;
      }
    }
  }//
  
 
  private function showRTE():void
  {
    var iX:int = int(getAttrValue("x"));
    var iY:int = int(getAttrValue("y"));
    iY = (iY > 30) ?  iY-30:0 ;
    var iWidth:int = int(getAttrValue("width"));
    iWidth = (iWidth > 400)  ?  iWidth:400;
    var iHeight:int = int(getAttrValue("height")) + 30;
    iHeight = (iHeight > 300)  ?  iHeight:300 ;
    _popUpRTE = RTEPopUp(PopUpManager.createPopUp(this, RTEPopUp, 
true));   
    _popUpRTE.x=iX;
    _popUpRTE.y=iY; 
    _popUpRTE.width=iWidth;
    _popUpRTE.height=iHeight;         
    _popUpRTE.htmlText = _xmlattribu...@value;
    _popUpRTE.addEventListener("closeRTE",onCloseRTE);
  }//
  
  private function onCloseRTE(oEvent:Event):void
  {
    if(oEvent.target.closeMode == "ok") {
      _xmlattribu...@value = oEvent.target.htmlText;
    }
    PopUpManager.removePopUp(_popUpRTE);
  }//
  
  private function showTA():void
  {
    _popUpTA = TAPopUp(PopUpManager.createPopUp(this, TAPopUp, true));
    _popUpTA.text = _xmlattribu...@value;
    _popUpTA.addEventListener("closeTA",onCloseTA);
    //PopUpManager.centerPopUp(_popUpTA);
    _popUpTA.x="100";
    _popUpTA.y="100";
  }//
  
  private function onCloseTA(oEvent:Event):void
  {
    if(oEvent.target.closeMode == "ok") {
      _xmlattribu...@value = oEvent.target.text;
    }
    PopUpManager.removePopUp(_popUpTA);
  }//
  
  /**  */
  private function getAttrValue(sName:String):String
  {
    var sReturn:String = "";
    var xmlAttrNode:XML = _xmlComponentDef.*.(@name==sName)[0];
    if (xmlAttrNode) {
      sReturn = xmlAttrNode.attribute("value");
    }
    return sReturn;
  }//getAttrValue
  
  private function setupColorPicker():void
  {
    trace("setupColorPicker: " + _xmlattribu...@value);
    cp.selectedcolor=_xmlattribu...@value
  } //setupColorPicker
  
  private function clearColor():void
  {
    _xmlattribu...@value = "";
  }//
   
]]></mx:Script>

    <mx:states>
        <mx:State name="CheckBox">
            <mx:AddChild >
               <mx:CheckBox id="cbx" label=""   
                  
creationComplete="cbx.selected=_xmlattribu...@value" 
                  change="_xmlattribu...@value = cbx.selected;"
                  /> 
            </mx:AddChild>
        </mx:State> 
        <mx:State name="TA">
            <mx:AddChild>
                <mx:Button id="ta" label="..." height="22" width="22"
                    click="showTA()"></mx:Button>
            </mx:AddChild>
        </mx:State>        
        <mx:State name="RTE">      
            <mx:AddChild>
              <mx:HBox width="100%" verticalAlign="middle" 
horizontalAlign="right" horizontalGap="2">
                <mx:Label text="{XML(_xmlAttribute)....@value}" 
                  color="#999999" 
                  truncateToFit="true" fontSize="8" 
width="{this.width-35}" />
                <mx:Button id="rte" label="..." height="22" width="22"
                    toolTip="Edit htmlText with tich text editor"
                    click="showRTE()" />                
              </mx:HBox>
            </mx:AddChild>
        </mx:State>
        <mx:State name="ComboBox">
            <mx:AddChild>
                <mx:ComboBox id="cbo" dataProvider="{_xlOptions}" 
                    selectedIndex="{_iOptionItemIndex}"
                    labelField="@value"
                    change="_xmlattribu...@value = cbo.selectedLabel"
                    width="100%" />
            </mx:AddChild>
        </mx:State>                   
        <mx:State name="TextInput">
            <mx:AddChild>
                <mx:TextInput id="ti" 
                    creationComplete="ti.text=_xmlattribu...@value"
                    change="_xmlattribu...@value = ti.text"
                    width="100%"/>
            </mx:AddChild>
        </mx:State>
        <mx:State name="NumericStepper">
            <mx:AddChild>
                <mx:NumericStepper id="ns" 
                    creationComplete="ns.value=_xmlattribu...@value"
                    change="_xmlattribu...@value = ns.value"
                    width="100%"
                    maximum="1500" minimum="-500" />
            </mx:AddChild>
        </mx:State>
        <mx:State name="ColorPicker">
          <mx:AddChild>
            <mx:HBox width="100%" verticalAlign="middle" 
horizontalAlign="right" horizontalGap="2">
              <mx:Label text="{XML(_xmlAttribute)....@value}" 
                color="#999999" 
                truncateToFit="true" fontSize="8" width="{this.width-
60}" />
              <mx:Button id="btClearColor" label="C" height="22" 
width="22" color="red"
                  click="clearColor()" toolTip="Clear this value" />
              <mx:ColorPicker id="cp" selectedColor="{XML
(_xmlAttribute)....@value}" 
                  creationComplete="setupColorPicker()"
                  change="_xmlattribu...@value = 
cp.selectedColor" />                    
            </mx:HBox>        
          </mx:AddChild>
        </mx:State>                
    </mx:states>

    <mx:transitions>
        <mx:Transition fromState="*" toState="*">
            <mx:Resize target="{this}" />
        </mx:Transition>
    </mx:transitions>

</mx:VBox>



--- In flexcoders@yahoogroups.com, Sefi Ninio <sefi.ni...@...> wrote:
>
> Okay, how about this:
> When defining a combo box as an itemEditor, and specifying the
> editorDataField - How can I specify the combo box dataProvider?
> I can use the model to bind a dp to the combobox, but I'd like to 
create a
> generic component that does not have dependencies on external 
models...
> 
> 
> 
> On Sun, Feb 22, 2009 at 1:54 PM, Sefi Ninio <sefi.ni...@...> wrote:
> 
> > Hi all.
> >
> > I'm looking for a property editor component (or something similar 
to the
> > description below):
> > What I need is a table (DG) based name-value pairs editor, where 
the value
> > should be displayed as a label.
> > When it gets focus, it should be editable according to the value 
defined
> > type (text, stepper, combo box etc.)
> >
> > Sure, I can implement components (as item editors for the DG) 
with two
> > states for text/combo box, text/stepper, text/text editor etc.
> > I was wondering if there is a component that already has this
> > functionality.
> >
> > Anyone has any ideas?
> >
> > Thanks
> >
>


Reply via email to