If I set my HLED Widget's FCDataURL to some a valid XML the LED shows up fine but now I want to change the HLED's value programatically. For this purpose, I have made a string named xmlData, containing data from an XML file as shown below:
String for XML:
private var xmlData:String="<?xml version='1.0' encoding='UTF-8'?>" +
"<chart chartBottomMargin='5' lowerLimit='0' upperLimit='100' lowerLimitDisplay='Low' " +
"upperLimitDisplay='High' numberSuffix='' showTickMarks='1' tickValueDistance='0' " +
"majorTMNumber='5' majorTMHeight='4' minorTMNumber='0' showTickValues='1' decimalPrecision='0'" +
" ledGap='1' ledSize='1' ledBoxBgColor='FFFFFF' ledBorderColor='666666' borderThickness='0' " +
"chartRightMargin='20' background='0' bgColor='FFFFFF' showBorder='0'>" +
"<colorRange>" +
" <color minValue='0' maxValue='30' code='00FF00'/>" +
" <color minValue='30' maxValue='50' code='FFFF00'/>" +
" <color minValue='50' maxValue='100' code='FF0000'/>" +
"</colorRange>" +
"<value>66/value>" +
"</chart>";
Then, I tried to set the widget's FCDataXML to my string and rendered the widget.
Setting Widget's data and rendering
threatLevelWidget.FCDataXML=xmlData;
threatLevelWidget.FCRender();
Widget...
<components:FusionWidgets id="threatLevelWidget" FCChartType="HLED" x="10" y="-20" width="510" height="100"/>
I was hoping to see the chart load up with value = 66 but all I get is "Error in loading data". :-/
Any idea what's going wrong!
Please use :
threatLevelWidget.FCSetDataXML(xmlData);
Do NOT use : threatLevelWidget.FCRender(); if using FCSetDataXML() function.
Related
How to pass tag type as a string variable in selenium?
suppose I am having given example:
By.cssSelector: li[__idx='0']
for given example I tried below part
webElement.findElement( By.cssSelector( "'" + tag + "'['" + property + "'='" + indexNumber + "']" ) )
where tag is li and __idx is property.
I am getting error as " Could not locate element with locator ". but if I tried as below then its working correctly.
webElement.getElement().findElement( By.cssSelector( "li[__idx='" + indexNumber + "']" ) )
Is there any syntactical mistake am doing ?
webElement.find( "" + tag + "[" + property + "='" + indexNumber + "']" );
This is the correct way to solve the issue.
I am currently working on a graphic design program for the iPad and have ran into a little problem using the textField with touch events.
I have to use the textField object to display text on the screen since it is the ONLY text object which I can disable anti-aliasing. (If you know of a way to do it with Spark, it would seriously change my life.)
The scope of my problem is the following:
I have a spark group which contains all the objects the end user adds to the screen (text, images).
Images added are spark:Image
Text added is flash.text.textField
I wrap the textField in a UIComponent then containingGroup.addElement(UIComponent)
Everything works really well until I get to movement.
I am using a view to hold the objects.
I created a spark label called touchPlatform, to which I have added my Begin, Move, End, and Touch_Out events to. I did this so I would not have to add an event listener to each object I add to the screen (performance hit). Below is the basic MXML setup:
<View>
<ContainerGroup/>
<TouchPlatform/>
</View>
Whenever I do something to the TouchPlatform, I mirror those changes to the selected object (Users have a list of objects which are on the screen they can select).
Down to the problem:
It seems the textFields are not reacting to the touch events correctly (not surprising since they are older components). When I drag my finger on the screen, everything works file until I hit a textField. When I enter or exit a text field, it throws a touch_out event.
Reasons why this should not happen:
I am touching the touchPlatform (its higher, it takes up the entire
screen)
Handlers are only on the touchPlatform, not on the textFields themselves
The fired event never tells me the e.target or e.currentTarget is anything other than the touchPlatform. I am doing specific tests asking for the exact object or if the object "is" a textField/label/image/other.
That is my major point of concern. If I could receive a touch_out event where I would receive a textField object as my target, I could simply ignore it. In this case, the return is as valid as possible; it says the event was triggered by the touchPlatform.
I have set the textField.selectable = false.
I have been noticing a problem which I think is a clue to this issue. When a GUI component is added to the screen (lets say a Spark:TextInput), unless I set the skinClass to a mobile version, it will still be selectable and editable even if it has been set enabled=false, its container has been disabled, groups and labels have overlayed it, etc. If you can see it, you can interact with it. The moment I set it to a mobile skin, everything starts working. I'm wondering if this flash component is disrupting the touch event in a similar way.
If anyone knows a solutions to this situation I would greatly appreciate it.
If someone has another simple solution to accomplishing this task, please let me know as well. I need to have this done on Monday, which is in 2.5 days.
Thank you in advance for the help
CODE:
Where Touch Platform gets created and how it is over Workbench Container (the thing that holds all the objects on the screen):
<s:Group height="600" width="100%" creationComplete="touchPlatform_creationCompleteHandler(event)">
<Components:WorkbenchContainer id="wrkBenchContainer">
</Components:WorkbenchContainer>
<s:VGroup>
<s:HGroup id="grpLoading" visible="{properties.loading}">
<s:BusyIndicator id="bsyLoading" symbolColor="#FFFFFF"/>
<s:Label id="lblLoading" text="Loading..." color="#FFFFFF"/>
</s:HGroup>
</s:VGroup>
<s:Label id="touchPlatform" width="100%" height="100%" creationComplete="touchPlatform_creationCompleteHandler(event)"/>
</s:Group>
EVENT HANDLER RESULT FOR TOUCH_OUT ATTACHED TO touchPlatform
public function handleTouchEnd(e:TouchEvent):void{
if(m_layersPanel.lstLayers.selectedIndex == -1)
return;
/*
var stopTouch:Boolean = false;
var reason:String = "";
if(e.stageX > (m_workbenchContainer.width + m_workbenchContainer.x) || e.stageX < 0 || e.stageY < 0 || e.stageY > (m_workbenchContainer.height + m_workbenchContainer.y)){
reason+= "OUT OF BOUNDS X:" + e.stageX + " Y:" + e.stageY + " WX:" + m_workbenchContainer.x + " WY:" + m_workbenchContainer.y + " MaxX:" + m_workbenchContainer.x + m_workbenchContainer.width + " MaxY:" + m_workbenchContainer.y + m_workbenchContainer.height;
stopTouch = true;
}
for(var z:int = 0; z < m_workbench.grpLayers.numElements; z++){
if(e.target == m_workbench.grpLayers.getElementAt(z)){
stopTouch = true;
reason += "TOUCHING OBJECT: " + e.target.toString();
}
}
*/
properties.bounds = "BOUNDS: ID: " + e.touchPointID + " X:" + e.stageX + " Y:" + e.stageY + " WX:" + m_workbenchContainer.x + " WY:" + m_workbenchContainer.y + " MaxX:" + m_workbenchContainer.x + m_workbenchContainer.width + " MaxY:" + m_workbenchContainer.y + m_workbenchContainer.height;
var stopTouch:Boolean = false;
if(e.currentTarget is Label){
reason += "Touched Label";
stopTouch = true;
}else if(e.currentTarget is TextField){
reason += "Touched TextField";
}else{
reason += "Unknown: " + e.currentTarget.toString();
}
if(!(e.currentTarget is Label))
{
properties.status = "TRIP OBJECT: " + e.touchPointID + "- " + reason;
//e.preventDefault();
//e.stopImmediatePropagation();
return;
}else if(e.stageX > (.95 * (m_workbenchContainer.width + m_workbenchContainer.x)) || e.stageX < 10 || e.stageY < 10 || e.stageY > (.95 * (m_workbenchContainer.height + m_workbenchContainer.y))){
properties.status = "OUTSIDE BOUNDS" + reason + e.currentTarget.toString();
}else{
properties.status = "VALID? " + reason + e.currentTarget.toString();
}
/* if(e.target is DoodleText || e.target is DoodleImage)
properties.status = "TOUCHED IMAGE OR TEXT";
else if(e.target is UIComponent){
properties.status = "Touched UI Component";
}else
properties.status = "Out Of Bounds";
else
properties.status = "END TOUCH";
*/
//Primary finger removed
if(primTouchID == e.touchPointID){
primTouchID = -1;
secTouchID = -1;
properties.primaryStatus = "RESET";
properties.secondaryStatus = "RESET";
var obj:DoodleInterface = DoodleInterface(m_layersPanel.lstLayers.selectedItem);
m_undoHandler.addUndo(m_layersPanel.lstLayers.selectedItem,"TRANSFORM",(originalX + "," + originalY + "," + originalWidth + "," + originalHeight), (obj.getActualX() + "," + obj.getActualY() + "," + obj.getActualWidth() + "," + obj.getActualHeight()));
}
//Secondary finger removed
if(secTouchID == e.touchPointID){
secTouchID = -1;
properties.secondaryStatus = "RESET";
}
//Stop Stretching if both primary and secondary fingers have been removed
if(primTouchID == -1 && secTouchID == -1){
stretching = false;
//Ensure Object is Snapped to Grid
var endobj:DoodleInterface = DoodleInterface(m_layersPanel.lstLayers.selectedItem)
endobj.setX(int(endobj.getActualX()));
endobj.setY(int(endobj.getActualY()));
endobj.setWidth(int(endobj.getActualWidth()));
endobj.setHeight(int(endobj.getActualHeight()));
}
m_workbench.refreshSelection();
}
I found the solution. For anyone encountering the same issue, please note that older flash components don't exactly like to play nice with spark components.
As you can see in my above code, I was using a spark label as my touch area. The textFields within the group below the touch area were pushing through the spark label and causing the touch_out event to fire.
I have resolved this by having everyone play by the same rules. Instead of mixing a spark label and a flash textField, I have created changed the touch area from a Spark Label to a Text Field.
I create the textfield in actionscript, set its x,y,width,height, and selectable=false. Then add the textField to a UIComponent, and then add the UIComponent to the same group as before.
From what I can tell, everything is working well.
Below is my code. If anyone has any questions, please let me know.
Touch Platform Creation:
if(grpContainer.containsElement(touchPlatformContainer))
grpContainer.removeElement(touchPlatformContainer);
touchPlatform = new TextField();
touchPlatform.selectable = false;
touchPlatform.width = 1152;
touchPlatform.height = 600;
touchPlatform.x = 0;
touchPlatform.y - 0;
touchPlatformContainer = new UIComponent;
touchPlatformContainer.addChild(touchPlatform);
grpContainer.addElement(touchPlatformContainer);
Same Assignments of Touch Events as before:
touchPlatform.removeEventListener(TouchEvent.TOUCH_BEGIN, m_controlPanel.handleTouchBegin);
touchPlatform.removeEventListener(TouchEvent.TOUCH_MOVE, m_controlPanel.handleTouchMove);
touchPlatform.removeEventListener(TouchEvent.TOUCH_END, m_controlPanel.handleTouchEnd);
touchPlatform.removeEventListener(TouchEvent.TOUCH_OUT, m_controlPanel.handleTouchEnd);
touchPlatform.addEventListener(TouchEvent.TOUCH_BEGIN, m_controlPanel.handleTouchBegin);
touchPlatform.addEventListener(TouchEvent.TOUCH_MOVE, m_controlPanel.handleTouchMove);
touchPlatform.addEventListener(TouchEvent.TOUCH_END, m_controlPanel.handleTouchEnd);
touchPlatform.addEventListener(TouchEvent.TOUCH_OUT, m_controlPanel.handleTouchEnd);
I'm working with CRM Dynamics. There is a JavaScript that uses ActiveXObject to resolve a request but I need to convert that to a Fetch Request.
The old code is this:
function fnSetStateActiveQuoteRequest() {
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
GenerateAuthenticationHeader() +
" <soap:Body>" +
" <Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <Request xsi:type=\"SetStateQuoteRequest\">" +
" <EntityId>" + Xrm.Page.data.entity.getId() + "</EntityId>" +
" <QuoteState>Active</QuoteState>" +
" <QuoteStatus>2</QuoteStatus>" +
" </Request>" +
" </Execute>" +
" </soap:Body>" +
"</soap:Envelope>" +
"";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Execute");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
and I'm trying to convert that with:
var _oService;
var _sOrgName = "myOrg";
var _sServerUrl = Xrm.Page.context.getServerUrl();
function fnSetStateActiveQuoteRequest(){
var sFetch = '<fetch mapping="logical">';
sFetch+= '<entity name='+Xrm.Page.data.entity.getId()'>';
sFetch+= '</filter>';
sFetch+= '</entity>';
sFetch+= '</fetch>';
_oService = new FetchUtil(_sOrgName, _sServerUrl);
var oEntity = _oService.Fetch(sFetch, myCallBack);
}
But I have no idea how to declare the Request> and the QuoteState>
The problem you're having is the first XML you are looking at is the serialized version of an execute request. Fetch is more of a Query Language so you write it slightly differently.
The easiest way to figure out what the fetch xml needs to look like is open up an advanced find and perform the search manually. The Advanced Find gives you a "Download Fetch XML" button to save you the hassle of writing all the fetch!
So, the old query looked like it was trying to return all records of entity "X" where it was Active and had a status reason of 2. If I write something similar in advanced find (let's say I'm looking for opportunities) my query might look like this:
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='opportunity'>
<attribute name='name' />
<attribute name='customerid' />
<attribute name='estimatedvalue' />
<attribute name='opportunityid' />
<order attribute='name' descending='false' />
<filter type='and'>
<condition attribute='statecode' operator='eq' value='0' />
<condition attribute='statuscode' operator='eq' value='2' />
</filter>
</entity>
</fetch>
That was pretty much a copy and paste from the Download Fetch XML of an advanced find.
I use this resultHandler and instead of using my data with four(4) separate field I would like to use the following code in one field. and as a one line read out?
E.g (title + "." +firstName + " " + middleName + " " + last Name) = (Mr. Harald E. W. Buttweiser).
I get it with static Xml e.g. models but cant find the right way to get it with my Http!
<mx:Script>
<![CDATA[
/* import mx.rpc.events.ResultEvent; */
private function resultHandler(evt:ResultEvent):void {
title.text = evt.result.message.title;
firstName.text = evt.result.message.firstName;
middleName.text = evt.result.message.middleName;
lastName.text = evt.result.message.lastName;
}
]]>
</mx:Script>
Thanks in advance aktell
You can do it in one line if you want. Define an object for these fields, like:
[Bindable]
private var contact:Object;
Than adopt your fields' source attribute:
<mx:TextInput text="{contact.title}"/>
<mx:TextInput text="{contact.firstName}"/>
...
And in the callback you can call:
contact = evt.result.message;
I'm trying to output a sentence containing 4 variables, with their values emboldened using the following code:
<mx:Text width="100%" y="307">
<mx:htmlText>
<![CDATA[Showing data from <b>{labelStartTime.text} {labelStartDate.text}</b> to <b>{labelEndTime.text} {labelEndDate.text}</b>]]>
</mx:htmlText>
</mx:Text>
However, this just outputs the variable names, rather than their values. I'm sure I'm missing something simple, but I'd appreciate any pointers.
Cheers.
I know of a workaround:
Actionscript:
private var variable:String = "Variable String";
private var str:String = "<i><b>" + Variable + "</b></i>";
Mxml:
<Text htmlText="{str}" />
I don't think it's possible to add bindings directly in a CDATA section like that, you do have a couple of options though :
Use a function, taking advantage of BindingUtils.bindSetter :
import mx.binding.utils.BindingUtils;
//called on creationComplete
private function init():void
{
BindingUtils.bindSetter(setHtmlText, labelStartTime, "text");
BindingUtils.bindSetter(setHtmlText, labelStartDate, "text");
BindingUtils.bindSetter(setHtmlText, labelEndTime, "text");
BindingUtils.bindSetter(setHtmlText, labelEndDate, "text");
}
private function setHtmlText(val:String):void
{
myText.htmlText = "Showing data from <b>" +
labelStartTime.text + " " +
labelStartDate.text + "</b> to <b>" +
labelEndTime.text + " " +
labelEndDate.text + "</b>";
}
Or simply encode the tags and insert them directly into the attribute :
<mx:Text id="myText" width="100%" y="307"
htmlText="Showing data from <b>{labelStartTime.text} {labelStartDate.text}</b> to <b>{labelEndTime.text} {labelEndDate.text}</b>"/>
This isn't really recommended as it makes the markup incredibly difficult to read, but you might get away with it for something small like this.