I'm trying to do multifield component here. When I enter values in fields, they are present on page and everything works fine. When I reopen component to edit existing data, it's empty like there were no values entered (they still appear on site) at all.
Here is code from my dialog.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Multifield TouchUI Component"
sling:resourceType="cq/gui/components/authoring/dialog"
helpPath="en/cq/current/wcm/default_components.html#Text">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<fieldset
jcr:primaryType="nt:unstructured"
jcr:title="Footer"
sling:resourceType="granite/ui/components/foundation/form/fieldset">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<dashboard
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription="Enter Headline"
fieldLabel="Headline"
name="./headline"/>
<groups
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
class="full-width"
fieldDescription="Click '+' to add a new page"
fieldLabel="Groups">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fieldset"
eaem-nested=""
name="./groups">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
method="absolute"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<country
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription="Enter headline of this group"
fieldLabel="Headline"
name="./headline"/>
<states
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
class="full-width"
fieldDescription="Click '+' to add a new page"
fieldLabel="Sites">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fieldset"
name="./sites">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
method="absolute"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<state
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription="Enter name of specific site"
fieldLabel="Site Name"
name="./site"/>
<path
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/pathbrowser"
fieldDescription="Select Path"
fieldLabel="Path"
name="./path"
rootPath="/content"/>
</items>
</column>
</items>
</field>
</states>
</items>
</column>
</items>
</field>
</groups>
</items>
</column>
</items>
</fieldset>
</items>
</column>
</items>
</content>
</jcr:root>
I know that there are some solutions using widgets, xtype and ext.js (ClassicUI), but I want to do it with granite/coral (TouchUI). As I researched the problem is that I should save values from every field as child nodes, but I do not understand how because examples are (as I noticed) same as code provided above.
If there is no help with this example, I would also be grateful if someone share their solution of multifield component that actually saves content author's input.
Also, if someone think that there is no such option in TouchUI, feel free to leave comment although that makes no sense.
I had similar problem with Multifields, and the only fix I found was using the Multifield of components/coral/foundation and adding only fields of the same group inside the multifield.
Try with this:
<sites
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
class="full-width"
composite="{Boolean}true"
fieldDescription="Click '+' to add a new page"
fieldLabel="Sites">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container"
name="./sites">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
method="absolute"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<state
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Site"
fieldDescription="Enter name of specific site"
name="./site"/>
<path
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Path"
fieldDescription="Select Path"
name="./path"/>
</items>
</column>
</items>
</field>
</sociallist>
I ran into the same (or similar) issue just today. For me, it turned out I needed to add the composite="{Boolean}true" property to my multifield. A composite multilfield can handle multiple fields within a field set.
So using your code as an example:
<states
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
class="full-width"
fieldDescription="Click '+' to add a new page"
fieldLabel="Sites"
composite="{Boolean}true">
This post explains it well
Related
In java awt I want to make a CRUD form for master detail data entry in oracle database. Gatepass master and Gatepass detail tables are joined on gatepass number using pk/fk relation.
This is form for gatepass. one gatepass receives multiple items.Format is like
Gatepass# 1 Receiving Person:Mr.Tariq
Gate pass date:21-mar-2019
Detail
item id item name qty
12 wooden chair 4
13 wooden table 1
Can any one give some sample code.
If you have more than 10 entities and using Hibernate then you can try Desktop Java Forms which I hosted at: https://github.com/smart-flex/Djf
For example here is minimalistic definition from demo-application for two master-detail relationships:
<panel constraint="Center">
<layout clazz="net.miginfocom.swing.MigLayout">
<param type="string" value="" />
<param type="string" value="[0:0, grow 70, fill][0:0, grow 30, fill]" />
<param type="string" value="[c, pref, fill] 15 [c, 150px] 10 [c, pref!]" />
</layout>
<items>
<grid bindPref="st">
<cols>
<int bind="idStreet" title="ID" width="50" enabled="no"
noResize="yes" />
<text bind="streetName" title="Street name" />
</cols>
</grid>
<grid constraint="wrap">
<cols>
<text bind="st.buildings.buildingNumber" title="Number" tips="Building number"/>
</cols>
</grid>
<grid noInfoColumn="true" bindPref="ct">
<cols>
<int bind="carId" title="ID" width="50" enabled="no"
noResize="yes" />
<text bind="carName" title="Car name" enabled="no" />
</cols>
</grid>
<grid noInfoColumn="true" constraint="wrap">
<cols>
<text bind="ct.modelList.modelName" title="Model name" enabled="no" />
</cols>
</grid>
<oper constraint="span 2"/>
</items>
</panel>
I want to add a new tab to the OOTB page component touch UI dialog (/libs/foundation/components/page), so that all pages that inherit from that OOTB component will have these fields.
It's unfortunately not an option to just add the tab to each template component, as I'm building a plugin instead of an implementation.
I have been trying to overlay /libs/foundation/components/page/_cq_dialog/content/items/tabs/items/ and add just my tab to that leaf items node, but then it doesn't pull the rest of the OOTB tabs. I think it's because it's not a leaf node, and it wants to be when doing overlay. So I need to somehow merge what I'm defining with the OOTB touch ui dialog.
This is my /apps/foundation/components/page/_cq_dialog node:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Page"
sling:resourceType="cq/gui/components/authoring/dialog"
extraClientlibs="[cq.common.wcm,cq.siteadmin.admin.properties]"
mode="edit">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container"
class="cq-dialog-content-page">
<items jcr:primaryType="nt:unstructured">
<tabs
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container"
rel="cq-siteadmin-admin-properties-tabs">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/tabs"
type="nav"/>
<items jcr:primaryType="nt:unstructured">
<custom
jcr:primaryType="nt:unstructured"
jcr:title="Custom"
sling:resourceType="granite/ui/components/foundation/section">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
margin="{Boolean}false"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<customsection
jcr:primaryType="nt:unstructured"
jcr:title="Custom field"
sling:resourceType="granite/ui/components/foundation/form/fieldset">
<items jcr:primaryType="nt:unstructured">
<customfield
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="custom field"
name="customField"/>
</items>
</customsection>
</items>
</column>
</items>
</custom>
</items>
</tabs>
</items>
</content>
</jcr:root>
Thank you!
The reason you are not seeing the rest of the tabs from the foundation page component is because you are overlaying the root items node of all the tabs. When you overlay you are redefining the functionality of the libs component and giving precedence to the overlayed component. If you'd like to have the rest of the tabs as well, you'll have to copy them all to your overlayed component, which is highly not recommended because you will lose out on upgrades to the component when you upgrade AEM or install service packs down the line.
I would recommend extending the component instead by setting a value of sling:resourceType to foundation/components/page in the base page component of your site. This way you add just that extra custom tab and inherit the rest of them from libs. In all probability (if following aem best practices), your site would already have a base page component having this property and the rest of the templates would be inheriting from this component. Add the below _cq_dialog to that page component and you should see the new tab across all the pages.
.content.xml of your base page component. One of the main templates from /apps/<<prj>>/templates will have a sling:resourceType linking to this page component.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Component"
jcr:title="Base Page Component"
sling:resourceSuperType="foundation/components/page"
componentGroup=".hidden"/>
_cq_dialog - reusing your code except for a new prop - sling:orderBefore="cloudservices", to order your new tab
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured">
<content jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured">
<tabs jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured">
<custom
jcr:primaryType="nt:unstructured"
jcr:title="Custom"
sling:orderBefore="cloudservices"
sling:resourceType="granite/ui/components/foundation/section">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
margin="{Boolean}false"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<customsection
jcr:primaryType="nt:unstructured"
jcr:title="Custom field"
sling:resourceType="granite/ui/components/foundation/form/fieldset">
<items jcr:primaryType="nt:unstructured">
<customfield
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="custom field"
name="customField"/>
</items>
</customsection>
</items>
</column>
</items>
</custom>
</items>
</tabs>
</items>
</content>
</jcr:root>
Screenshot
More about component hierarchy and inheritance here
I have a following xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<Abc version="3" xmlns="urn:Abc-v3">
<Ele1>
<SubElement name ="name" description="DO">
<Node version="C" siteURL="https://example.com" />
<Client>
<ClientId>1</ClientId>
<ClientSecret>Yes</ClientSecret>
</Client>
</SubElement>
<SubElement name ="SharePointOLDev1" description="DEV1">
<Node version="C" siteURL="https://example.com" />
<Local>
<LocalId>id</LocalId>
<Password>password</Password>
</Local>
</SubElement>
<SubElement name="AS" description="wow">
<DB connection="connection" />
</SubElement>
</Ele1>
<Ele2>
<Content ID="A" co="LD">
<Description>Simple Docs</Description>
<Serve
Lib1="TEST"
Lib2="yes"
Lib3="yes"
Lib4="no"
Lib5="no"
Lib6="name">
<Hole enabled="false" count="200" />
<Fol enabled="false" count="100" />
<Role enabled="No" validate="false" />
<FetchFilenameAttribute connection="SAP-AS" delay="3" />
</Serve>
</Content>
<Content ID="B" co="OL">
<Description>Simple Docs </Description>
<Serve
Lib1="TEST"
Lib2="yes"
Lib3="yes"
Lib4="no"
Lib5="no"
Lib6="name"">
<Hole enabled="false" count="200" />
<Fol enabled="false" count="100" />
<Role enabled="No" validate="false" />
</Serve>
</Content>
</Ele2>
<Ele3>
<CNode attr="hai" attr1="bye" />
</Ele3>
</Abc>
I need to parse this XML file and assign values to its corresponding class objects.Which is the best option to parse such an xml file.
JAXB sounds good to me but the POJOs were already written by someone and now i will have to rewrite and deploy them.ALso teh xml file has some errors while running xjc command.
DOM approach seems to be very cumbersome n error prone.
Please suggest.
PS:Kindly excuse my beginner level knowledge.
the JDK project comes with SAX(Simple API for XML) accessible by importing org.xml.sax.*.
You may take a look at this https://www.tutorialspoint.com/java_xml/java_sax_parse_document.htm for an introduction to the subject.
I am building a component which allows the user to add a multi field. When the multifield is added to the dialog, the user is presented with two text boxes. When the user adds information to the text boxes, and clicks 'OK'. When the dialog closes, no information is stored/saved.
Can anyone point out where I've gone wrong?
See the dialog code below:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
xtype="dialog">
<items
jcr:primaryType="nt:unstructured"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<heading
jcr:primaryType="nt:unstructured"
allowBlank="true"
disabled="false"
fieldLabel="Heading (optional)"
grow="false"
hideLabel="false"
name="./headingTitle"
readOnly="false"
selectOnFocus="false"
validateOnBlur="true"
xtype="textfield"/>
<message
jcr:primaryType="nt:unstructured"
fieldLabel="Message (optional)"
name="./message"
validateOnBlur="true"
xtype="textfield"/>
<link-list
jcr:primaryType="cq:Widget"
fieldLabel="Tabs titles and binding"
border="{Boolean}false"
name="./link-list"
width="1000"
xtype="multifield">
<fieldConfig
jcr:primaryType="cq:Widget"
path="/apps/group/components/nab-broker-tabs/dialog/items/items/link-list/fieldConfig/items.infinity.json"
xtype="cq.compositefield">
<items jcr:primaryType="cq:WidgetCollection">
<linkText
jcr:primaryType="cq:Widget"
fieldLabel="Titles"
name="linkText"
width="180"
xtype="textfield"/>
<linkBinding
jcr:primaryType="cq:Widget"
fieldLabel="binding ID"
name="linkBinding"
width="180"
xtype="textfield"/>
</items>
</fieldConfig>
</link-list>
</items>
</items>
</jcr:root>
Since multiple values are to be stored, you should be using a custom xtype to store multifield values.
refer: http://helpx.adobe.com/experience-manager/using/creating-custom-xtype.html
In case of complex multifield components, I would suggest you to use Multi Field Panel from ACS AEM Commons.
It will do the job for you.
a simpliest situation: I have a drools flow.
Very simple,like
"<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
type="RuleFlow" name="ruleflow" id="com.sample.ruleflow" package-name="com.sample" >
<header>
</header>
<nodes>
<start id="1" name="Start" x="16" y="16" width="48" height="48" />
<actionNode id="2" name="Hello" x="96" y="16" width="80" height="48" >
<action type="expression" dialect="mvel" >System.out.println("Hello World");</action>
</actionNode>
<end id="3" name="End" x="208" y="16" width="48" height="48" />
</nodes>
<connections>
<connection from="1" to="2" />
<connection from="2" to="3" />
</connections>
</process>"
How can I change it programmatically , not with loading the flow file to XML Parsers etc, but to add the nodes and connection through the code?
Thanks in advance
I don't think any Drools API will be there for modifying the rules