Hello,
I am currently trying to implement the CheckRowRenderer and get it to
actually work.
I took the code from the tutorial and modified it to be able to show the
open/close icon and the check box. I also added some code to destroy the
check box in setValue if the item is undefined so you would not get the
"extra" boxes on the screen before you rolled over them.
Generally it seemed to work until I tried to modify the data being
displayed in the Tree.
Once the data is changed some of the old data still displays until it get
scrolled off the screen.
I am guessing I need to destroy the check box at another time, but I can't
figure out when.
I have attached the mxml and as that I am using.
Any ideas would be appreciated.
Thanks!
-- Carolyn
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/2jUsvC/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
import mx.controls.treeclasses.TreeRow
import mx.controls.CheckBox
class CheckRowRenderer extends TreeRow
{
var _check : MovieClip;
var initValue = 0;
function createChildren() : Void
{
super.createChildren();
if (_check != undefined)
{
destroyObject("_check");
delete _check;
}
_check = createClassObject(CheckBox, "_check", 100);
_check.addEventListener("click", this);
this.addEventListener("unload",this);
}
function size() : Void
{
super.size();
super._x = super._x+10;
_check.setSize(height-2, height-2);
_check._y = (height - _check._height) / 2
_check._x = disclosure._x;
disclosure._x = _check._x + _check._width + 2;
nodeIcon._x = disclosure._x + disclosure._width + 2;
cell._x = nodeIcon._x + nodeIcon._width + 2;
}
// Doing this so that the first time this drawn the size will be set
correctly
function draw():Void
{
super.draw();
size();
}
// Doing this so that when a user scrolls over the check box the data
will be sized correctly
function setState(newState: String, transition: Boolean):Void
{
super.setState(newState, transition);
size();
}
// Doing this so that we can control how the check box is shown when
the value is changed
function setValue(item, state)
{
if (item != undefined)
{
super.setValue(item, state);
if (_check== undefined) _check =
createClassObject(CheckBox, "_check", 100);
var mustRedraw:Boolean = (_check.selected !=
(item.attributes.checked=="true"));
if (mustRedraw)
_check.redraw();
size();
// This little loop reads in the preset values and then
jumps out once
// they are set.
for(initValue; initValue<=0; initValue++){
_check.selected = (item.attributes.checked=="true");
}
_root.initValue = 1;
} else {
destroyObject("_check");
delete _check;
}
}
function click()
{
listOwner.editField(rowIndex, "checked", (_check.selected) ?
"true" : "false");
}
function unload()
{
destroyObject("_check");
delete _check;
}
}<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*"
xmlns:uaimMap="edu.psu.uaim.map.*" >
<mx:Script>
<![CDATA[
var msgTime:Array =["Message Time","Collection Time"];
var confidences:Array =["High","Medium", "Low",
"Unknown"];
var testArray:Array = ["abc","123","zxy"];
function login():Void
{
uaimWS.AuthenticateUser.send();
}
function loginRet( event:Object):Void
{
var resp:String;
resp = event.result.response;
loginLabel.text = resp;
if (resp==null) {
loginLabel.text = "validLogin";
main.selectedIndex=1;
}
}
function getEventAlias():Void
{
uaimWS.getEventAlias.send();
aliasTest.text = "got here!";
}
function eventAliasRet(event:Object):Void
{
var tmpXML: XML = new XML( event.result);
mxmlTree.dataProvider = tmpXML.firstChild;
}
]]>
</mx:Script>
<mx:WebService id="uaimWS"
wsdl="https://arl3469.arl.psu.edu:8443/uaim-webService/UAIMService.wsdl"
showBusyCursor="true">
<mx:operation name="AuthenticateUser" result="loginRet(event)">
<mx:request>
<AuthenticateUserRequest><userID>{userID.text}</userID><password>{loginPassword.text}</password></AuthenticateUserRequest>
</mx:request>
</mx:operation>
<mx:operation name="getEventAlias" result="eventAliasRet(event)"
resultFormat="xml">
<mx:request>
<GetEventAliasRequest><eventTerm>No-Dong</eventTerm></GetEventAliasRequest>
</mx:request>
</mx:operation>
</mx:WebService>
<uaimMap:ROIMap id="roiMap" map="{map}" mapCanvas="{fullMapCanvas}"
minLat="{minLat}" maxLat="{maxLat}" minLon="{minLon}" maxLon="{maxLon}"
testLabel="{test}"/>
<mx:Model id="testArray2">
<mx:String>Macromedia Flex</mx:String>
<mx:String>Macromedia Dreamweaver</mx:String>
<mx:String>Macromedia ColdFusion</mx:String>
<mx:String>Macromedia Flash</mx:String>
</mx:Model>
<mx:Model id="specificFilters">
<filters>
<filter>
<name>COMMINT</name>
<messageTime>Collection Time</messageTime>
<maxMessageAge>15</maxMessageAge>
<minumunConfidence>Unknown</minumunConfidence>
<relativeWeight>10</relativeWeight>
<highConfidenceWeight>10</highConfidenceWeight>
<mediumConfidenceWeight>7</mediumConfidenceWeight>
<lowConfidenceWeight>5</lowConfidenceWeight>
<unknownConfidenceWeight>1</unknownConfidenceWeight>
</filter>
<filter>
<name>ELINT</name>
<messageTime>Collection Time</messageTime>
<maxMessageAge>15</maxMessageAge>
<minumunConfidence>Unknown</minumunConfidence>
<relativeWeight>10</relativeWeight>
<highConfidenceWeight>10</highConfidenceWeight>
<mediumConfidenceWeight>7</mediumConfidenceWeight>
<lowConfidenceWeight>5</lowConfidenceWeight>
<unknownConfidenceWeight>1</unknownConfidenceWeight>
</filter>
<filter>
<name>HUMINT</name>
<messageTime>Collection Time</messageTime>
<maxMessageAge>15</maxMessageAge>
<minumunConfidence>Unknown</minumunConfidence>
<relativeWeight>10</relativeWeight>
<highConfidenceWeight>10</highConfidenceWeight>
<mediumConfidenceWeight>7</mediumConfidenceWeight>
<lowConfidenceWeight>5</lowConfidenceWeight>
<unknownConfidenceWeight>1</unknownConfidenceWeight>
</filter>
<filter>
<name>MASINT</name>
<messageTime>Collection Time</messageTime>
<maxMessageAge>15</maxMessageAge>
<minumunConfidence>Unknown</minumunConfidence>
<relativeWeight>10</relativeWeight>
<highConfidenceWeight>10</highConfidenceWeight>
<mediumConfidenceWeight>7</mediumConfidenceWeight>
<lowConfidenceWeight>5</lowConfidenceWeight>
<unknownConfidenceWeight>1</unknownConfidenceWeight>
</filter>
<filter>
<name>IMINT</name>
<messageTime>Collection Time</messageTime>
<maxMessageAge>15</maxMessageAge>
<minumunConfidence>Unknown</minumunConfidence>
<relativeWeight>10</relativeWeight>
<highConfidenceWeight>10</highConfidenceWeight>
<mediumConfidenceWeight>7</mediumConfidenceWeight>
<lowConfidenceWeight>5</lowConfidenceWeight>
<unknownConfidenceWeight>1</unknownConfidenceWeight>
</filter>
<filter>
<name>OSINT</name>
<messageTime>Collection Time</messageTime>
<maxMessageAge>15</maxMessageAge>
<minumunConfidence>Unknown</minumunConfidence>
<relativeWeight>10</relativeWeight>
<highConfidenceWeight>10</highConfidenceWeight>
<mediumConfidenceWeight>7</mediumConfidenceWeight>
<lowConfidenceWeight>5</lowConfidenceWeight>
<unknownConfidenceWeight>1</unknownConfidenceWeight>
</filter>
</filters>
</mx:Model>
<mx:XML id="AliasTerms" >
<node name="First" checked="true">
<node name="First-1" checked="false">
<node name="First-1-1" checked="false"/>
<node name="First-1-2" checked="true"/>
<node name="First-1-3" checked="false"/>
</node>
<node name="First-2" checked="true"/>
<node name="First-3" checked="false"/>
</node>
<node name="Second" checked="false">
<node name="Second-1" checked="false"/>
<node name="Second-2" checked="true"/>
<node name="Second-3" checked="false"/>
</node>
</mx:XML>
<mx:Model id="empModel" source="employees.xml"/>
<mx:Panel title="UAIM Web Application" width="800" height="800">
<mx:ViewStack id="main" width="100%" height="100%">
<mx:Panel id="loginPanel" title="Login Window">
<mx:Form id="loginForm" label="Login Form">
<mx:FormItem label="User ID">
<mx:TextInput id="userID"/>
</mx:FormItem>
<mx:FormItem label="Password">
<mx:TextInput id="loginPassword"
password="true"/>
</mx:FormItem>
</mx:Form>
<mx:Label id="loginLabel" />
<mx:ControlBar>
<mx:Button label="Login" click="login()"/>
</mx:ControlBar>
</mx:Panel>
<mx:Panel width="100%" height="100%">
<mx:TabNavigator width="100%" height="100%" >
<mx:Panel label="Summary" width="100%">
<mx:Grid>
<mx:GridRow>
<mx:GridItem>
<mx:Label text="User" />
</mx:GridItem>
<mx:GridItem>
<mx:Label text="{userID.text}"
/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow>
<mx:GridItem>
<mx:Label text="Configuration
Name" />
</mx:GridItem>
<mx:GridItem>
<mx:TextInput id="configName"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow>
<mx:GridItem>
<mx:Label text="Unit Name" />
</mx:GridItem>
<mx:GridItem>
<mx:TextInput id="unitName"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow>
<mx:GridItem>
<mx:Label text="Mission
Category" />
</mx:GridItem>
<mx:GridItem>
<mx:TextInput
id="missionCategory" />
</mx:GridItem>
</mx:GridRow>
</mx:Grid>
</mx:Panel>
<mx:Panel label="Region Of Interest"
width="100%" height="80%">
<mx:Form width="100%" >
<mx:Label id="test" />
<mx:HBox width="100%">
<mx:VBox width="50%">
<mx:FormItem label="Minimum
Latitude"><mx:NumericStepper width="80" stepSize=".001" id="minLat"
minimum="-90" maximum="{maxLat.value}"
change="roiMap.drawSelectedBox(minLat.value, maxLat.value, minLon.value,
maxLon.value)"/></mx:FormItem>
<mx:FormItem label="Maximum
Latitude"><mx:NumericStepper width="80" stepSize=".001" id="maxLat"
minimum="{minLat.value}" maximum="90"
change="roiMap.drawSelectedBox(minLat.value, maxLat.value, minLon.value,
maxLon.value)"/></mx:FormItem>
</mx:VBox>
<mx:VBox width="50%">
<mx:FormItem label="Minimum
Longitude"><mx:NumericStepper width="90" stepSize=".001" id="minLon"
minimum="-180" maximum="{maxLon.value}"
change="roiMap.drawSelectedBox(minLat.value, maxLat.value, minLon.value,
maxLon.value)"/></mx:FormItem>
<mx:FormItem label="Maximum
Longitude"><mx:NumericStepper width="90" stepSize=".001" id="maxLon"
minimum="{minLon.value}" maximum="180"
change="roiMap.drawSelectedBox(minLat.value, maxLat.value, minLon.value,
maxLon.value)"/></mx:FormItem>
</mx:VBox>
</mx:HBox>
<mx:RadioButtonGroup id="mapControl" />
<mx:HBox horizontalAlign="center"
width="80%" >
<mx:RadioButton label="Select"
groupName="mapControl" selected="true" click="roiMap.doControlChange(event)"/>
<mx:RadioButton label="Zoom"
groupName="mapControl" click="roiMap.doControlChange(event)"/>
<mx:Button label="Zoom Out"
click="roiMap.doZoomOut(event)" />
</mx:HBox>
</mx:Form>
<mx:Canvas id="fullMapCanvas"
width="600"
height="300"
backgroundAlpha="100"
backgroundColor="#DEE0FE" creationComplete="roiMap.loadImage(-90,90,-180,180)"
borderColor="#000000" borderThickness="2"
mouseDown="roiMap.doMouseDown(event)" mouseUp="roiMap.doMouseUp(event)"
mouseMove="roiMap.doMouseMove(event)">
<mx:Image id="map"
width="600" height="300" trackColor="#FF0000"
mouseDown="roiMap.doMouseDown(event)" mouseUp="roiMap.doMouseUp(event)"
mouseMove="roiMap.doMouseMove(event)" />
</mx:Canvas>
</mx:Panel>
<mx:Panel label="Event Alias Terms">
<CheckRowRenderer id="rendererInit"
visible="false"/>
<mx:Label id="aliasTest" />
<mx:CheckBox visible="false" height="0"/>
<mx:Button label="Search"
click="getEventAlias()"/>
<mx:Tree id="mxmlTree"
rowRenderer="CheckRowRenderer" dataProvider="{AliasTerms}" labelField="name"/>
<!--mx:Tree id="mxmlTree"
dataProvider="{AliasTerms}" labelField="name"/-->
</mx:Panel>
<mx:Panel label="Specific Filters"
height="100%">
<mx:Grid>
<mx:GridRow>
<mx:GridItem><mx:Label text="Intel
Discipline" /></mx:GridItem>
<mx:GridItem><mx:Label
text="Message Time" /></mx:GridItem>
<mx:GridItem><mx:Label
text="Maximum Message Age (min)" /></mx:GridItem>
<mx:GridItem><mx:Label
text="Minimum Confidence" /></mx:GridItem>
<mx:GridItem><mx:Label
text="Relative Weight" /></mx:GridItem>
<mx:GridItem><mx:Label text="High
Confidence Weight" /></mx:GridItem>
<mx:GridItem><mx:Label text="Medium
Confidence Weight" /></mx:GridItem>
<mx:GridItem><mx:Label text="Low
Confidence Weight" /></mx:GridItem>
<mx:GridItem><mx:Label
text="Unknown Confidence Weight" /></mx:GridItem>
</mx:GridRow>
<mx:Repeater id="specFiltRP"
dataProvider="{specificFilters.filters.filter}">
<mx:GridRow>
<mx:GridItem><mx:Label
text="{specFiltRP.currentItem.name}"/></mx:GridItem>
<mx:GridItem><mx:ComboBox
dataProvider="{msgTime}" selectedItem="{specFiltRP.currentItem.messageTime}"
></mx:ComboBox></mx:GridItem>
<mx:GridItem><mx:TextInput
text="{specFiltRP.currentItem.maxMessageAge}"/></mx:GridItem>
<mx:GridItem><mx:ComboBox
dataProvider="{confidences}"
selectedItem="{specFiltRP.currentItem.minumunConfidence}"/></mx:GridItem>
<mx:GridItem><mx:NumericStepper
minimum="0" maximum="10"
value="{specFiltRP.currentItem.relativeWeight}"/></mx:GridItem>
<mx:GridItem><mx:NumericStepper
minimum="0" maximum="10"
value="{specFiltRP.currentItem.highConfidenceWeight}"/></mx:GridItem>
<mx:GridItem><mx:NumericStepper
minimum="0" maximum="10"
value="{specFiltRP.currentItem.mediumConfidenceWeight}"/></mx:GridItem>
<mx:GridItem><mx:NumericStepper
minimum="0" maximum="10"
value="{specFiltRP.currentItem.lowConfidenceWeight}"/></mx:GridItem>
<mx:GridItem><mx:NumericStepper
minimum="0" maximum="10"
value="{specFiltRP.currentItem.unknownConfidenceWeight}"/></mx:GridItem>
</mx:GridRow>
</mx:Repeater>
</mx:Grid>
</mx:Panel>
<mx:Panel label="Alert Methods">
</mx:Panel>
</mx:TabNavigator>
<mx:HBox>
<mx:Button label="Save" />
<mx:Button label="Reset" />
<mx:Button label="Home" />
<mx:Button label="Cancel" />
</mx:HBox>
</mx:Panel>
</mx:ViewStack>
</mx:Panel>
</mx:Application>