UI Events in Orbeon Forms - event-handling

I see that Orbeon supports a number of extension events, but what about standard UI Events like mousemove and select? How would I get an example like this XForms demo, which calls mousemove directly from <xf:action ev:event="mousemove">, to work in Orbeon?
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>Mouse Events in XForms</title>
<model xmlns="http://www.w3.org/2002/xforms">
<instance id="style">
<data xmlns="">
<mouse>
<x>0</x>
<y>0</y>
<state>up</state>
</mouse>
</data>
</instance>
</model>
</head>
<body>
<group class="crop" xmlns="http://www.w3.org/2002/xforms">
<label>Move mouse here</label>
<action ev:event="mousemove">
<setvalue ref="mouse/x" value="event('clientX')"></setvalue>
<setvalue ref="mouse/y" value="event('clientY')"></setvalue>
</action>
<action ev:event="mousedown">
<setvalue ref="mouse/state">down</setvalue>
</action>
<action ev:event="mouseup">
<setvalue ref="mouse/state">up</setvalue>
</action> x: <output ref="mouse/x"></output> y: <output
ref="mouse/y"></output> state: <output ref="mouse/state"></output>
</group>
</body>
</html>

Orbeon Forms doesn't support mousemove or select. One reason is that the brains of Orbeon Forms currently reside on the server. Mouse events are expected to be very interactive and wouldn't work well with server roundtrips in the middle.
At some point in the future, this might change as more of the Orbeon Forms code is brought to the client. In the meanwhile, highly-interactive code must be written in JavaScript (or other client languages). Several of the XBL components included in Orbeon Forms use JavaScript for that purpose.

Related

Qlikview REST connector pagination namespaced XML

We have a XML file that is on somewebsite and looks in a way like this (confidential parts stripped)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="https://somewebsite.com/crm/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">Accounts</title>
<id></id>
<updated>2016-02-04T08:36:56Z</updated>
<link rel="self" title="Accounts" href="Accounts" />
<entry>
<title type="text"></title>
<updated>2016-02-04T08:36:56Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:Type>A</d:Type>
<d:UniqueTaxpayerReference m:null="true" />
<d:VATLiability m:null="true" />
<d:VATNumber m:null="true" />
<d:Website m:null="true" />
</m:properties>
</content>
</entry>
<link rel="next" href="https://somewebsite.com/Accounts?$skiptoken=guid'ee6bc390-a8ac-4bbd-8a4d-0a1f04ab9bd3'" />
</feed>
We use the new Rest connector to get the data out of this XML file.
The XML has pagination and every 60 entries you can load the next 60 with the link at the bottom of this xml file.
The problem i have is when, in the REST connector, we want to enable pagination with these setting:
Pagination Type: Next URL
Next URL field path:
/*[name()="feed"]/*[name()="link"][contains(#rel,"next")]/#href
It doesn't seem to work...
side note: the XML file has namespaces so i need to target the elements this way instead of /feed/link/...
I'm using Xpath syntax to target the link href, but maybe this is not the way to go? Or maybe the REST connector isn't using Xpath syntax?
Really hope someone can help me!
Actually it turns out that this seems to be due to a "bug" in the "Qlik REST Connector 1.0" so the pagination doesn't work.
But there is a fix for it:
1) Make sure that the Qlik REST Connector 1.0 connect dialog box has the NextUrl set to:
feed/link/attr:href
2) When the SQL has been generated after using the SELECT-button and going through the wizard you have to modify the sub-SELECT that reads like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href" AS href,
"__FK_link"
FROM "link" FK "__FK_link"),
.....
On line 05 you will have to remove the text AS href.
So it should look like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href",
"__FK_link"
FROM "link" FK "__FK_link"),
....
3) Find the LOAD statement that loads from this sub-select with a RESIDENT [MasterREST further down in the load script and make sure that the reference to href is changed to [attr:href] - or else you will get an error message while loading.
Should look like this after the change:
[link]:
LOAD [rel],
[title],
[attr:href],
[__FK_link] AS [__KEY_feed]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_link]);
This worked for me:
/*[name()='feed']/*[name()='link'][#rel='next']/#href
Yours should also work actually, maybe whatever you are using does not agree with double quotes instead of single quotes.

action-state not accept evaluate tags Spring Web Flow 2.3

Eclipse marks this error
cvc-complex-type.2.4.a: Invalid content was found starting with element 'action-state'. One of '{"http://www.springframework.org/schema/webflow":on-end, "http://www.springframework.org/schema/webflow":output, "http://www.springframework.org/schema/webflow":exception-handler, "http://www.springframework.org/schema/webflow":bean-import}' is expected.
on this flow code
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
abstract="true">
<global-transitions>
<transition on="logIn" to ="login" />
<transition on="signup" to="signup"/>
<transition on="logOut" to="logout"/>
</global-transitions>
<action-state id="logout">
<evaluate expression="login.logout(currentUser)" />
<transition on="successLogout" to="main" />
<transition on="failLogout" to="error" />
</action-state>
I only find action-state samples and everyone are writting like my code and people use the same XSD. Either, I have read XSD file and on action-state section tag evaluate is missing. Why eclipse marks this error?
Thanks in advance!
I think there has to be an order in which the elements are defined. Try defining the action-state before the global-transitions. If you hover your mouse pointer over the "flow" xml definition in your xml file this info appears (among others):
Content Model : (attribute*, secured?, persistence-context?, var*, input*, on-start?, (action-state | view-state | decision-state | subflow-state | end-state)*, global-transitions?, on-end?, output*, exception-handler*, bean-import*)
So, there is a strict sequence.

How to define a trigger keyword in OpenSearchDescription xml file?

I am trying to get an open search definition to work on subdomains.
I have added the correct line in the <head> of the html.
Example:
<link rel="search" type="application/opensearchdescription+xml" title="Example" href="http://www.example.org/opensearch.xml" />
In opensearch.xml:
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Example</ShortName>
<LongName>Example Search</LongName>
<Description>Example Description</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">http://www.example.org/favicon.ico</Image>
<Url type="text/html" method="get" template="http://www.example.org/search/{searchTerms}" />
</OpenSearchDescription>
The search is correctly added to the omnibox settings in Google Chrome, when I visit http://www.example.org. The trigger keyword becomes "example.org".
However, when I visit http://subdomain.example.org, which has the same line in the <head>, the search is added with trigger keyword "subdomain.example.org" instead of "example.org".
Is there a way around this?
I have not found any information on how to set the trigger keyword in the documentation at http://www.opensearch.org/Specifications/OpenSearch/1.1 .

How to implement i18n in GWT application?

I have a problem with internationalization. I'm trying to implement support two languages ​​in my GWT application. Unfortunately I never found a complete example how to do it with the help of UiBinder. That is what I did:
My module I18nexample.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='i18nexample'>
<inherits name="com.google.gwt.user.User" />
<inherits name='com.google.gwt.user.theme.clean.Clean' />
<inherits name="com.google.gwt.i18n.I18N" />
<inherits name="com.google.gwt.i18n.CldrLocales" />
<entry-point class='com.myexample.i18nexample.client.ExampleI18N' />
<servlet path="/start" class="com.myexample.i18nexample.server.StartServiceImpl" />
<extend-property name="locale" values="en, fr" />
<set-property-fallback name="locale" value="en" />
</module>
My interface Message.java:
package com.myexample.i18nexample.client;
import com.google.gwt.i18n.client.Constants;
public interface Message extends Constants {
String greeting();
}
The same package com.myexample.i18nexample.client has three properties file:
Message.properties:
greeting = hello
Message_en.properties:
greeting = hello
Message_fr.properties:
greeting = bonjour
My UiBinder file Greeting.ui.xml:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder
xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
ui:generateFormat="com.google.gwt.i18n.rebind.format.PropertiesFormat"
ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator"
ui:generateLocales="default" >
<ui:with type="com.myexample.i18nexample.client.Message" field="string" />
<g:HTMLPanel>
<ui:msg key="greeting" description="greeting">Default greeting</ui:msg>
</g:HTMLPanel>
</ui:UiBinder>
When the application starts, I always get the output in the browser:
Default greeting
Why? What am I doing wrong?
I tried to run the application from different URL:
http://127.0.0.1:8888/i18nexample.html?gwt.codesvr=127.0.0.1:9997
http://127.0.0.1:8888/i18nexample.html?locale=en&gwt.codesvr=127.0.0.1:9997
http://127.0.0.1:8888/i18nexample.html?locale=fr&gwt.codesvr=127.0.0.1:9997
The result does not change. Although I expected in last case a message bonjour.
If for example I use a g:Buttton instead of the message ui:msg:
<g:HTMLPanel>
<g:Button text="{string.greeting}" />
</g:HTMLPanel>
Then I get as a result of the button with text "hello"
And if I enter the URL:
http://127.0.0.1:8888/i18nexample.html?locale=fr&gwt.codesvr=127.0.0.1:9997
The text on the button changes to "bonjour". Here everything works as expected. But why internationalization is not working in my first case?
And whether there is a difference between the following:
<ui:msg description="greeting">Default greeting</ui:msg>
<ui:msg description="greeting">hello</ui:msg>
<ui:msg description="greeting"></ui:msg>
Should there be different results in these cases? How to write properly?
Please explain to me the principles of internationalization in GWT and why my example does not work.
Any suggestions would be greatly appreciated.
First, the files should be named Message_fr.properties (resp. Message_en.properties), not Message.properties_fr (resp. Message.properties_en).
Then ui:msg et al. in UiBinder will generate an interface (extending com.google.gwt.i18n.client.Messages)), not use one that you defined. For that, you have to use {string.greeting} (where string is the ui:field you gave to your ui:with). The UiBinder generator will do a GWT.create() on the type class of your ui:with, which is what you'd have done in Java code:
Message string = GWT.create(Message.class);
String localizedGreeting = string.greeting();
In the implicit Messages interface (generated by UiBinder), the various ui:generateXxx attributes on the ui:UiBinder will be transformed into annotations on the interface (properties of the #Generate annotation, or the value of the #GenerateKeys annotation).
Then, one method will be generated for each ui:msg, where the attributes generate equivalent annotations (#Key, #Description) and the content of the ui:msg element is the value of the #DefaultMessage annotation. When you have or widgets inside the content, they'll be turned into arguments to the method and placeholders in the #DefaultMessage text (the values will be filled by UiBinder).
I'd suggest you make something working without UiBinder first, and understand how it works; then try the ui:msg in UiBinder, using -gen in DevMode or the compiler so you can see exactly what code does UiBinder generate (yes, it really only generates code that you could have written yourself by hand).
Also, you should add a <set-property name="locale" value="en, fr" /> or you'll still have the default locale around, despite the set-property-fallback (it'd just never be used)).

How to add a colorized HTML code snippet in Sandcastle documentation?

I am using the Sandcastle Help File Builder and would like to include colorized HTML code snippets in the "Conceptual Content". Is this possible and if so, how?
I have tried <code>, <codeExample>, and <sampleCode language="HTML" />.
The best result so far is to HTML-encode the sample HTML and place it in a .snippets file like so.
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="HTML">
<span>My Html</span>
</sampleCode>
</item>
</examples>
Then reference it in the .aml file.
<codeReference>htmlSnippet</codeReference>
I would prefer to have it colorized, but I can't figure out a way to add the formatting.
According to the MAML Guide, the proper way of doing this is to use a <code> tag with a CDATA section:
<code language="xml" title="Example Configuration">
<![CDATA[
<span>My Html</span>]]>
</code>
The contents of the CDATA section will be treated as a literal string, and indentation will be preserved.
I know this is old, but Sandcastle supports html as xml. I figured I should comment in case anyone else comes across this post as I did.
This should work:
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="xml"><!CDATA[[
<span>My Html</span>
]]>
</sampleCode>
</item>
</examples>
If you're using Sandcastle Help File Builder, you may create your own syntax parser as described here and here, although xml is available by default... using the XAML filter's generator, which is defined here if you want to look at the config:
<generator type="Microsoft.Ddue.Tools.XamlUsageSyntaxGenerator"
assembly="{#SandcastlePath}ProductionTools\SyntaxComponents.dll">
<filter files="{#SandcastlePath}Presentation\Shared\configuration\xamlSyntax.config" />
</generator>
According to the SHFB documentation for the Code Block Component, you should be able to just use the <code>.
I got it to work without a problem; here's what I did:
test.html
<html>
<head>Something!</head>
<body>
<h1>Heading</h1>
<!-- #region myhtml -->
<p>Paragraph</p>
<div>Div for <strong>Good</strong> <em>measure</em>.</div>
<!-- #endregion -->
</body>
</html>
SomethingorOther.aml
<code language="html" source="../Examples/test.html" region="myhtml" />
Result:
Please note that in the preview, your sample will appear as unhighlighted XML, but when you build the documentation, everything should like just fine.