Movilizer - Dynamic Slideshow in MEL - movilizer

I would like to know if it is possible to have a slideshow based on one dynamic screen. I am trying to use a dynamic Table Screen. When the user clicks on OK, $local:categoryCounter raises and shows other information of my array $local:categoryIndex. When the user clicks back, $local:categoryCounter decreases and shows (already shown) information when its value is greater than zero.
This is what I tried so far. I left out as much unnecessary details as possible to make clear what the exact problem is. What I want to reach is this Epsilon screen to forward again as $local:categoryCounter hasn't reached zero yet. I know this isn't going to work as restrictions are only allowed in forward navigations, so I hope someone has another idea to solve this.
<!-- Pre-Epsilon needed to go back in slideshow -->
<question key="#6" type="41">
<answer key="#6_1" clientKey="CK#6" nextQuestionKey="#7"/>
<restriction position="0" nextQuestionKey="#1">
<condition>$local:navigateBack == true</condition>
</restriction>
<onEnterAssignment>
if($local:categoryCounter ?gt 0)
{
$local:categoryCounter = $local:categoryCounter - 1;
$local:navigateBack = false;
}
</onEnterAssignment>
</question>
<!-- End of Pre-Epsilon needed to go back in slideshow -->
<!-- Skill Categories Overview -->
<question key="#7" type="9" title="%PERSON_NAME%" sortAnswersByClientKey="true" labelFontSize="VERYLARGE" labelAlignment="CENTER" timeout="10">
<answer key="#7_1" clientKey="CK#7" attributeType="-128" nextQuestionKey="#8" position="1" dummyAnswer="true" colIndex="0" colWidth="5" colPriority="80">
<text>%SKILL%</text>
</answer>
<answer key="#7_2" clientKey="CK#7" attributeType="-128" nextQuestionKey="#8" position="2" dummyAnswer="true" colIndex="1" colWidth="5" colPriority="70">
<text>%VALUE%</text>
</answer>
<text>%CATEGORY_VALUE%</text>
<onLeaveOkPersistAssignment>
$local:categoryCounter = $local:categoryCounter + 1;
</onLeaveOkPersistAssignment>
<onLeaveBackAssignment>
$local:navigateBack = true;
</onLeaveBackAssignment>
</question>
<question key="#8" type="41">
<answer key="#8_1" clientKey="CK#8" nextQuestionKey="#7"/>
<restriction position="0" nextQuestionKey="#9">
<condition>$local:categoryCounter == count($local:categoryIndex)</condition>
</restriction>
</question>
<!-- End of Skill Categories Overview -->

you will achieve the expected behaviour by doing the following:
make the table screen part of a complex UI
use an image menu screen in the complex UI with at least 2 options, both navigating forward to an epsilon screen. These options increase / decrease the counter based on logic in the epsilon screen (check against selected client key or something like that).
If you do not want to offer an OK button in the complex UI do not define a default answer in the image menu screen
If you do not want to offer a back button, then use disableBackNavigation for the complex UI questions
There is no restriction that can be triggered on back navigation so all the logic has to be implemented using forward navigations.

Related

Adding a badge to an xpages applayout title bar node item

Is it possible to add a simple badge to a title bar node item? Each tab in my layout represents a separate application. My users would like to see a number next to the name on the tab to indicate whether there are documents in that application needing their attention. If no documents, then no badge, just the application name by itself. If there are documents, then display the application name and a badge for the number. I'm not finding a way to include the span tag in a PageLinkNode or BasicLinkNode.
PageLinkNode (xe:pageTreeNode) label can only be plain text.
You can use the image property though:
<xe:this.titleBarTabs>
<xe:pageTreeNode
page="..."
label="Application A"
image="#{javascript: var nr = 5;
nr > 0 ? ('badge' + Math.min(nr, 10) + '.gif') : ''}">
</xe:pageTreeNode>
Add to Resources/Images ten pictures badge1.gif, badge2.gif, ... badge10.gif with the numbers as pictures. badge10.gif would be a 9+ picture.
As an alternative, you could provide the number of documents as part of the label (e.g. "Your Application Name [23]") and convert it on client side onClientLoad event to HTML label + badge-span.

Change visible property sometimes change the center position of the view (possible bug?)

I've 3 (loader, locker and debug view) hidden views (touchEnabled and visible set to false, and zIndex to 1) above the main view (zIndex = 2).
Each 'over' view has this method:
$.debugView.show = function() {
$.debugView.touchEnabled = $.debugView.visible = true;
$.debugView.zIndex = 3;
};
$.debugView.hide = function() {
$.debugView.touchEnabled = $.debugView.visible = false;
$.debugView.zIndex = 1;
};
This screen has the 3 'over' views hidden:
Now, I'm opening the 'debug view', but, SOMETIMES it seems like it changes the positions (as if the center it's on the top left corner instead of the center of the device).
Instead of the required result:
If I use the opacity instead of the visible property, it works properly.
This might be an SDK bug right?
<Alloy>
<Window>
<View id="content"/>
<View id="locker"/>
<View id="loader"/>
<View id="debugView"/>
</Window>
</Alloy>
All of these 4 views don't have width or height (so it uses the Ti.UI.FILL as default)
I have noticed this too with a completely different implementation. I had just one view that I included in a window.
Apparently the left and top calculations were not done properly if the elements is hidden.
What I did to solve the issue is to hardcode the left/top position by calculating the left position using this:
$.content.left = (Ti.Platform.displayCaps.platformWidth - 75) / 2;
Where in my case 75 is the width the element has, so that'll be bigger in your case. You can do the same for height.
Now, this is an iOS only solution. On Android you will need to take DPI into consideration calculating it.
I do think it is a bug, though this solution works perfectly for me. I recommend looking at JIRA and see if it is a known issue, and if not, raise it with a very specific explanation of the problem, preferably with a reproducible case delivered as an app. Classic would help most. And if it is not reproducible in classic it might be an alloy issue.

Interval Selection Event in Primefaces Chart

I have a dynamic LineChart. I am setting the zoom to false but I want to be able to trigger an Ajax Event when selecting an area in the Chart (like the zoom functionnality when selecting the area you want to zoom), I want to call a server method and getting the max and min x axis values of the selected area.
Can anyone help with this?
Else if I set the zoom to true, is there any way to get the values from the zoomed area ?
PrimeFaces and JSF is in this context nothing more than an html/javascript/css generator. If you look at the source of the generated page in your browser developer tool, you'll see a lot of javascript, including all datapoints.
<script id="j_idt87_s" type="text/javascript">
$(function(){PrimeFaces.cw('Chart','chart'{
id:'j_idt87',
type:'line',
data:[[[1,2],[2,1],[3,3],[4,6],[5,8]],[[1,6],[2,3],[3,2],[4,7],[5,9]]],
title:"Zoom",
legendPosition:"e",
axes:{
xaxis:{
label:"",
renderer:$.jqplot.LinearAxisRenderer,
tickOptions:{angle:0}},
yaxis: {
label:"",
min:0,
max:10,
renderer:$.jqplot.LinearAxisRenderer,
tickOptions:{angle:0}}
},
series:[{label:'Series 1',renderer: $.jqplot.LineRenderer,showLine:true,markerOptions:{show:true, style:'filledCircle'}},{label:'Series 2',renderer: $.jqplot.LineRenderer,showLine:true,markerOptions:{show:true, style:'filledCircle'}}],zoom:true,datatip:true},'charts');});
</script>
So the answer to this question is valid for the PrimeFaces charts as well.
Running the following code (from the link above) in your browser developer tool on the zoom examples will show you the data points that fall in your zoom region
chart = PF('chart').plot;
PF('chart').plot.target.bind('jqplotZoom', function(ev, gridpos, datapos, plot, cursor){
var plotData = plot.series[0].data;
for (var i=0; i< plotData.length; i++) {
if(plotData[i][0] >= chart.axes.xaxis.min && plotData[i][0] <= chart.axes.xaxis.max ) {
//this dataset from the original is within the zoomed region
//You can save these datapoints in a new array
//This new array will contain your zoom dataset
//for ex: zoomDataset.push(plotData[i]);
console.log(plotData[i]);
}
}
});
Replacing PF(çhart') with PF('myLineChartWV') will make it work for your example to
Once you have gathered the data, you can use this in e.g. a PrimeFaces remoteCommand to pass it to the server.
Notice that this only takes the x-axis value of the zoom into account. If you want the y-axis taken into account to (so the real zoom area), add
plotData[i][1] >= chart.axes.yaxis.min && plotData[i][1] <= chart.axes.yaxis.max
to the if-statement in the loop.
Also notice it just takes the first series. If you have multiple, you have some simple homework to do.

Coded UI: Test cases having recording action are failed while executing through custom code

public void RecordedMethod_Sample(int x)
{
#region Variable Declarations
HtmlCell uISALESREVENUECell = this.UIDashboardWindowsInteWindow1.UIDashboardDocument.UITblWrapperOnlineStorTable.UISALESREVENUECell;
HtmlImage uIImagegifbase64R0lGODImage = this.UIDashboardWindowsInteWindow1.UIDashboardDocument.UIImagegifbase64R0lGODImage;
HtmlHyperlink uIPostPurchase4Hyperlink = this.UISalesRevenueandGrossWindow.UISalesRevenueandGrossDocument.UIPostPurchase4ReturnsCustom.UIPostPurchase4Hyperlink;
HtmlDiv uISalesRevenueByDataSoPane = this.UISalesRevenueandGrossWindow.UISalesRevenueandGrossDocument.UISalesRevenueByDataSoPane;
#endregion
// Set flag to allow play back to continue if non-essential actions fail. (For example, if a mouse hover action fails.)
Playback.PlaybackSettings.ContinueOnError = true;
// Mouse hover 'SALES REVENUE' cell at (82, 27)
Mouse.Hover(uISALESREVENUECell, new Point(82, 27));
// Reset flag to ensure that play back stops if there is an error.
Playback.PlaybackSettings.ContinueOnError = true;
// Click 'image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAA...' image
Mouse.Click(uIImagegifbase64R0lGODImage, new Point(139, 64));
// Set flag to allow play back to continue if non-essential actions fail. (For example, if a mouse hover action fails.)
Playback.PlaybackSettings.ContinueOnError = true;
// Mouse hover 'Post Purchase4' link at (144, 19)
Mouse.Hover(uIPostPurchase4Hyperlink, new Point(144, 19));
// Reset flag to ensure that play back stops if there is an error.
Playback.PlaybackSettings.ContinueOnError = true;
// Move 'Sales Revenue By Data Source' pane
Mouse.StartDragging(uISalesRevenueByDataSoPane, new Point(79, 15));
Mouse.StopDragging(uISalesRevenueByDataSoPane, 224, -4);
string title = uISalesRevenueByDataSoPane.InnerText.ToString();
if (title == "Sales Revenue By Data Source")
{
}
while Executing Mouse.Hover(uISALESREVENUECell, new Point(82, 27)); it is giving
following error
Specified method is not supported.
whenever i try to execute it as test case then everything is working as expected
while executing through custom code it is giving above mentioned error
can anybody please help me out...
thanks in advance for all your inputs
What does "custom code" mean? If it means custom controls then the error is likely because the custom control has not been written to support Coded UI. For a custom control to work with Coded UI it must support MSAA or UIA interfaces, or have support from the newer proxy mechanisms.
For more details try web searching for Coded UI, MSAA and UIA. Also have look at this blog http://blogs.msdn.com/b/visualstudioalm/archive/2012/05/24/coded-ui-test-new-extensibility-qfe.aspx
I had this exact problem.
Your best bet is to use the recorder as much as possible ,and then only move stuff away from UI map when you need dynamic execution and only for those bits.
Let the recorder do all the work for you, and you will get much better reliability during playback.

SharePoint 2010 Web controls - LookupField value not being set on postback

I've created a custom edit form as a simple aspx page in VS2010 (inherits from LayoutsPageBase) which uses the SharePoint Web controls LookupField control to display a drop down list of values from a custom type
The form displays correctly with the drop down box containing the expected range of values
The ControlMode is set to the same as the FormContext (though I have tried explicitly setting this to Edit)
But on the postback the value of the dropdown list is not set - the selected item index is set to -1
How can I correctly use the LookupField control to capture a selected value from the user?
Could it be because I'm adding the controls declaritivly in the aspx and then setting the list id etc from the SPContext in the page load event? - see code snippet below (not the prettiest but just trying to get it to work at this point):
from aspx:
<SharePoint:FileField ID="FileNameText" InputFieldLabel="Name" runat="server" ControlMode="Display"/><br />
<SharePoint:LookupField ID="FeedType" runat="server" />
<SharePoint:TextField ID="FeedStatus" runat="server" />
....
in the code behind page load:
if (!IsPostBack)
{
SPItem feedFileItem = SPContext.Current.Item;
FileNameText.ControlMode = SPContext.Current.FormContext.FormMode;
FileNameText.ListId = SPContext.Current.ListId;
FileNameText.ItemId = SPContext.Current.ItemId;
FileNameText.FieldName = "Name";
FeedType.ControlMode = SPControlMode.Edit;
FeedType.ListId = SPContext.Current.ListId;
FeedType.ItemId = SPContext.Current.ItemId;
FeedType.FieldName = "FeedType";
FeedStatus.ItemContext = SPContext.Current;
FeedStatus.RenderContext = SPContext.Current;
FeedStatus.ControlMode = SPControlMode.Edit;
FeedStatus.ListId = SPContext.Current.ListId;
FeedStatus.ItemId = SPContext.Current.ItemId;
FeedStatus.FieldName = "FeedStatus";
}
UPDATE
Ok I managed to get my form working by adding the controls in the code behind in the override of CreateChildControls - this is in line with the majority of the samples I've seen on the net.
But can someone explain why my approach didn't work and whether I can do this all in a declarative way in the aspx?
During postbacks selected values from lists are simply ignored if the list control isn't populated. So if you choose item 2 and the list items are null it will simply ignore the response parameter and not set the Value property. This is because ProcessPostData occurs prior to LoadData. Even if you were to remove the !IsPostBack on the LoadData method it still wouldn't work because ProcessPostData still occurs before LoadData and you didn't load the list prior to processing the postback.
A simple way to fix this is move your initialization code into the EnsureChildControls method of your Application page.
protected override void EnsureChildControls()
{
base.EnsureChildControls();
...
FeedType.ControlMode = SPControlMode.Edit;
FeedType.ListId = SPContext.Current.ListId;
FeedType.ItemId = SPContext.Current.ItemId;
FeedType.FieldName = "FeedType";
...
}

Resources