Multifield inside multifield - dialog

Below is my dialog.xml file
<?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"
jcr:primaryType="cq:Dialog"
title="CQ Dialog"
xtype="dialog">
<items
jcr:primaryType="cq:Widget"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Panel"
title="Tab 1">
<items jcr:primaryType="cq:WidgetCollection">
<addcolumn
jcr:primaryType="cq:Widget"
fieldDescription="Click + to add column"
fieldLabel="Add column"
name="./addcolumn"
xtype="multicompositefield">
<fieldConfigs jcr:primaryType="cq:WidgetCollection">
<countrydetails
jcr:primaryType="cq:Widget"
fieldDescription="Click + to add country details"
fieldLabel="Add country details"
name="./countrydetails"
xtype="multifield">
<fieldConfig
jcr:primaryType="cq:Widget"
hideLabel="false"
xtype="multifieldpanel">
<items jcr:primaryType="cq:WidgetCollection">
<countryname
jcr:primaryType="cq:Widget"
fieldLabel="Country name"
name="./countryname"
width="200"
xtype="textfield"/>
<countryicon
jcr:primaryType="cq:Widget"
fieldLabel="Country icon"
name="./countryicon"
width="200"
xtype="pathfield"/>
<linkurl
jcr:primaryType="cq:Widget"
fieldLabel="Link url"
name="./linkurl"
width="200"
xtype="pathfield"/>
</items>
</fieldConfig>
</countrydetails>
</fieldConfigs>
</addcolumn>
</items>
</tab1>
</items>
</items>
</jcr:root>
I was just trying to create multifield inside another multifield.
Issue I am facing is, once I filled the dialog field with values and when I reopen the dialog, all fields and filled data is cleared and dialog is empty.
Any suggestions what went wrong in my dialog
Thanks

This is possible but not just with the dialog structure you posted. You have to take care of field value serialisation for nested components.
Your values are blanking out because the value map handling of widgets is not compatible with nested values. A good read is at:
https://helpx.adobe.com/experience-manager/using/nested_multifield.html

Related

appending nodes into xslt array during foreach

I have xml (described below), i want to divide the contetn by the "<eop/>" element
where whenever there is an tag itis a new element.
and save the the content in an global array (for later use)
i have a foreach loop over the xml grouped by eop
but i dont know how to append each group to the global array
this is my xml:
<?xml version="1.0" encoding="UTF-8"?>
<mainBody>
<article_1>
<content>
<p>befre eop
<eop eId="eop_386" />
after oep
</p>
</content>
</article_1>
<article_2>
<content>
<p>point content</p>
</content>
</article_2>
<article_3>
<content>
<p>point content</p>
</content>
</article_3>
<article_4>
<content>
<p>before eop 387<eop eId="eop_387" /> after 387</p>
</content>
</article_4>
<article_5>
<content>
<p> content 5</p>
</content>
</article_5>
<article_6>
<content>
<p> before eop 388<eop eId="eop_388" /> after 388</p>
</content>
</article_6>
<article_7>
<content>
<p>before eop 389<eop eId="eop_389" />
</p>
</content>
</article_7>
</mainBody>
and this part of the xslt:
<xsl:template match="mainBody">
<xsl:for-each-group select="descendant::node()" group-ending-with="eop" >
</xsl:for-each-group>
</xsl:template>
thanks
You can put
<xsl:variable name="groups" as="array(node()*)*">
<xsl:for-each-group select="/mainBody/descendant::node()" group-ending-with="eop">
<xsl:sequence select="array { current-group() }"/>
</xsl:for-each-group>
</xsl:variable>
globally (i.e. as a child of xsl:stylesheet) and that way the variable groups of type sequence of array of nodes should be available in any template.

AEM - Touch UI dialog hide and show tabs on dropdown selection

I am trying to create a tab based touch-ui dialog AEM (AEM-6.2) But I am facing issues to hide the tabs.
I have 3 tabs in a dialog box.
general (Always enabled)
sports (Enable only when the selection is sports)
movies (Enable only when the selection is movies)
Before configuration, 'sports' and 'movies' tabs are hidden. In the 'general' tab I have a select box with options 'choose sports' and 'choose movies'. On selection corresponding tab should display. I tried using the steps provided in the below given path, but it fails to hide the tabs.
Path : /libs/cq/gui/components/authoring/dialog/dropdownshowhide/clientlibs/dropdownshowhide/js/dropdownshowhide.js
Other reference we tried : https://github.com/aman02deep/aem-6.2/blob/master/tabshideshow.js
Content.xml file:
</items>
</selection>
</items>
</columns>
</items>
</generalPanel>
<sports
jcr:primaryType="nt:unstructured"
jcr:title="Sports"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
margin="{Boolean}false"/>
<items jcr:primaryType="nt:unstructured">
<columns
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<sptext jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textarea"
fieldLabel="enter the text :"
name="./sp_text"
required="false"/>
</items>
</columns>
</items>
</sports>
<movies
jcr:primaryType="nt:unstructured"
jcr:title="Movies"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
margin="{Boolean}false"/>
<items jcr:primaryType="nt:unstructured">
<columns
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<mvtext jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textarea"
fieldLabel="enter the text :"
name="./mv_text"
required="false"/>
</items>
</columns>
</items>
</movies>
</items>
</content>
You can use granite:data to create a data-attribute which you can hide and show at you convinicence using jquery.
Add Listener to change of your radio button
Add granite:data to both tabs
On listener being called, Hide and show, based on your selection and jquery.
Ref: https://docs.adobe.com/docs/en/aem/6-1/ref/granite-ui/api/jcr_root/libs/granite/ui/components/foundation/commonattrs.html

How to group properly excel data source with rowspan?

From my understanding, <groupExpression> tag will be the one that decides whether a new group will be created or not, if there's a change to the element inside <groupExpression>, a new group will be created.
I want my report to look similar to my Excel data source (refer below) hence I want to group the ID and Name in the Excel file. In my jasperReport.jrxml (refer below), my <groupExpression> for Group1 is the ID column of my Excel File. But when I preview the report (refer below), the ID and Name column is not grouped, instead, there's a null string.
How to properly group them and eliminate the null string?
Excel datasource:
jasperReport.jrxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2016-01-26T15:33:41 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="FirstJasperReport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8b8832df-588e-4202-826e-a6b3efcbd22b">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="ExcelDataBase"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="ID" class="java.lang.Integer"/>
<field name="Name" class="java.lang.String"/>
<field name="Title" class="java.lang.String"/>
<field name="Balance" class="java.lang.Integer"/>
<variable name="Balance1" class="java.lang.Integer" resetType="Group" resetGroup="Group1" calculation="Count">
<variableExpression><![CDATA[$F{Balance}]]></variableExpression>
</variable>
<variable name="Balance2" class="java.lang.Integer" resetType="Group" resetGroup="Group1" calculation="Sum">
<variableExpression><![CDATA[$F{Balance}]]></variableExpression>
</variable>
<group name="Group1">
<groupExpression><![CDATA[$F{ID}]]></groupExpression>
<groupHeader>
<band height="30">
<rectangle>
<reportElement x="0" y="0" width="400" height="30" backcolor="#DEFCF2" uuid="de6c2f8d-afa6-45b4-b40e-574f2e07057e"/>
</rectangle>
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="c028645d-9b29-42d3-b91e-d47f15a5b44a"/>
<textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="100" y="0" width="100" height="30" uuid="85d2844f-ef91-47a1-9223-c6943a25fe4d"/>
<textFieldExpression><![CDATA[$F{Name}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
......
Preview result:
How to make title1 and title2 appear under the group test1, without the null string (similar to the Excel source file)?
The problem is that the excel datasource is passing $F{ID}==null for second record. This generates the null group (as you can see also the name is null).
The easiest way to fix it is to not use rowspan in excel (include all data in the excel sheet).
If this is not possible you need to save the first $F{ID} value and return this if $F{ID}==null
Example
<variable name="First_ID" class="java.lang.Integer" resetType="Group" resetGroup="Group1" calculation="First">
<variableExpression><![CDATA[$F{ID}]]></variableExpression>
</variable>
In group return variable $V{First_ID} if $F{ID}==null
<group name="Group1">
<groupExpression><![CDATA[$F{ID}==null?$V{First_ID}:$F{ID}]]></groupExpression>
... your groupHeader ....
</group>

how to fill color in sld with the feature's attribute

for example:
here is a grass feature like this:
id,area, level
1,geometry, 24
2,geometry, 56
...
i wount to write a sld file that display color according to the attribute level, like this :
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>grass</Name>
<UserStyle>
<Name>grass</Name>
<Title>grass polygon</Title>
<Abstract>grass fill with level</Abstract>
<FeatureTypeStyle>
<Rule>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">rgb(**level**, 0, 255)</CssParameter>
</Fill>
<Stroke />
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
Have a look at the categorize and interpolate functions:
http://docs.geoserver.org/latest/en/user/styling/sld-tipstricks/transformation-func.html

TFS WorkItem Layout problem

I'm customizing a TFS Work Item Type, adding a 'Business Description' HTML Field, but I cannot get the Layout right:
<Tab Label="Details">
<Group>
<Column PercentWidth="60">
<Control FieldName="Customer.BusinessDescription" Type="HtmlFieldControl" Label="Business Description:" LabelPosition="Top" Dock="Fill" />
</Column>
<Column PercentWidth="40">
<Control FieldName="Microsoft.VSTS.CMMI.Symptom" Type="HtmlFieldControl" Label="Symptom:" LabelPosition="Top" />
<Control FieldName="System.History" Type="WorkItemLogControl" Label="&History:" LabelPosition="Top" />
</Column>
</Group>
</Tab>
This turns out like this:
While I really want this ('Photoshopped' with MSPaint):
I have played around with the Fill properties on all three fields, have already set the MinimumSize property on the BusinessDescription field, added a group inside the left column, but I do not seem to find a solution for this.
Is this at all possible?
You'll want to create a group inside both the left and right columns:
<Tab Label="Details">
<Group>
<Column PercentWidth="60">
<Group>
<Column PercentWidth="100">
<Control FieldName="Customer.BusinessDescription" Type="HtmlFieldControl" Label="Business Description:" LabelPosition="Top" Dock="Fill" />
</Column>
</Group>
</Column>
<Column PercentWidth="40">
<Group>
<Column PercentWidth="100">
<Control FieldName="Microsoft.VSTS.CMMI.Symptom" Type="HtmlFieldControl" Label="Symptom:" LabelPosition="Top" />
<Control FieldName="System.History" Type="WorkItemLogControl" Label="&History:" LabelPosition="Top" />
</Column>
</Group>
</Column>
</Group>
</Tab>
You may also want to check out the Process Editor Power Tool - this provides a GUI interface to editing work item types.

Resources