Creating fixed FCE with fluidcontent - fluid

Width this code i can define content:
<flux:flexform.section name="columns">
<flux:flexform.object name="column" label="column">
<flux:flexform.field.input name="demo" label="Demo field" />
</flux:flexform.object>
</flux:flexform.section>
<flux:flexform.grid>
<flux:flexform.grid.row>
<f:for each="{columns}" as="sectionObject" iteration="iteration">
<flux:flexform.grid.column>
<flux:flexform.content name="column{iteration.cycle}" label="Column {iteration.cycle}" />
</flux:flexform.grid.column>
</f:for>
</flux:flexform.grid.row>
</flux:flexform.grid>
This is flexible. I can Add new "Content Areas" through the section. But this is not what I want. I Want to define a very fixed two-column and a three-column FCE. My editor should not have to decide how many columns to use.
I am missing something like:
<flux:flexform.field.contentArea name="col1" label="Column 1" />
<flux:flexform.field.contentArea name="col2" label="Column 2" />
<flux:flexform.grid>
<flux:flexform.grid.row>
<flux:flexform.grid.column>
<flux:flexform.content name="col1" />
</flux:flexform.grid.column>
<flux:flexform.grid.column>
<flux:flexform.content name="col2" />
</flux:flexform.grid.column>
</flux:flexform.grid>
</flux:flexform.grid.row>
Thank you for your hint to the right direction.

You are very close to the solution with the code you already have. In this example I will use the new ViewHelper names - but you can get the same result using the old names as in your example. Which is which, should be easy to spot (note: you had a typo in your code example which I edited, rgid used instead of grid - such a typo would cause Flux to error out):
<flux:grid>
<flux:grid.row>
<flux:grid.column>
<flux:content name="col1" label="Nice name for column 1" />
</flux:grid.column>
<flux:grid.column>
<flux:content name="col2" label="Column 2" />
</flux:grid.column>
</flux:grid>
</flux:grid.row>
And remove the flux:form.section with object inside it - you don't need this when you make a statically defined grid.
Then to render this grid:
<flux:content.render area="col1" /> and so on.

Related

How can I configure a live template that generates a builder method in IntelliJ IDEA?

I oftentimes need to create builder methods in my code. These methods are similar to getters, but they return this and they use with instead of get.
To be faster with that task I'd like to create a live-template in IDEA.
This how far I got:
(in ~/.IntelliJIdea14/config/templates/user.xml this looks like this:)
<template name="builderMethod" value="public $CLASS_NAME$ with$VAR_GET$(final $TYPE$ $PARAM_NAME$) {
this.$VAR$ = $PARAM_NAME$;
return this;
}" description="create a builder method" toReformat="true" toShortenFQNames="true">
<variable name="CLASS_NAME" expression="className()" defaultValue="" alwaysStopAt="true" />
<variable name="VAR" expression="complete()" defaultValue="" alwaysStopAt="true" />
<variable name="PARAM_NAME" expression="VAR" defaultValue="" alwaysStopAt="true" />
<variable name="TYPE" expression="typeOfVariable("this." + VAR)" defaultValue="" alwaysStopAt="true" />
<variable name="VAR_GET" expression="capitalize(VAR)" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_EXPRESSION" value="false" />
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
This nearly works, except for typeOfVariable("this." + VAR) which does not. I just guessed how to call this method, because I could not find any documentation on the syntax used in the expressions except for this page which does not even mention a script language name or something that would make googling for easier.
How do I fix the call to typeOfVariable?
Bonus question: How can I get complete() for VAR to only show fields?
Similar question but not does not even have a start: Live Template for Fluent-API Builder in IntelliJ
Replace typeOfVariable("this." + VAR) with typeOfVariable(VAR).
Edit:
Another way to generate builder methods is to use an appropriate setter template (instead of live template).
https://www.jetbrains.com/help/idea/2016.1/generate-setter-dialog.html
There is already a built-in setter template named "Builder" which generates setters such as:
public Foo setBar(int bar) {
this.bar = bar;
return this;
}
You can create your own template (e.g by copying it) and change it so that the method prefix is with.
And to make the generated method parameter final go to settings:
Editor | Code Style | Java
Select the Code Generation tab
Tick Make generated parameters final
IntelliJ IDEA add final to auto-generated setters

server side includes: can I compute something inside a variable

I'm trying to calculate the current index of my slides depending on the page that is shown.
So far I got this:
<!--#set var="page" value="0" -->
<!--#set var="slidesPerPage" value="4" -->
<!--#if expr="$QUERY_STRING = /p=1/" -->
<!--#set var="page" value="1" -->
<!--#elif expr="$QUERY_STRING = /p=2/" -->
<!--#set var="page" value="2" -->
<!--#endif -->
Now I want to "calculate" the current index like this:
<!--#set var="currentIndex" value="${$page * $slidesPerPage + 1}" -->
But this doesn't work.
Is this even possible?
after poking around some more and trying things on my own, I found a "solution" that kind of works:
<!--#exec cmd="printf $(($page * $slidesPerPage + 1))" -->
This just prints the output to page and doesn't store it in a variable, but it's enough for me right now.
If someone has a better/nicer solution, please let me know.

selection xtype listener unable to access multifield and multifield unable to fire the dialog.form.findfield

I have been working on disabling the content and ignoring data that is populated in a selection field that forms part of multifield that comes with CQ5 dialog
below is the code that is not working
<medicineType
jcr:primaryType="cq:Widget"
fieldLabel="medicine Type : "
name="./medicinetype"
blankText="medicine Type"
type="radio"
xtype="selection">
<options jcr:primaryType="cq:WidgetCollection">
<inactive
jcr:primaryType="nt:unstructured"
text="medicine Lead"
value="medicinelead" />
<active
jcr:primaryType="nt:unstructured"
text="doctor Lead"
value="doctorlead" />
</options>
<listeners jcr:primaryType="nt:unstructured"
selectionchanged="function(box,value){
if(value == 'medicinelead'){
var ans = box.findParentByType('dialog').form.findField('./medicinedoctorset');
ans.setDisabled(true);
ans.getEl().up('.x-form-item').setDisplayed(false);
}
"/>
</medicineType>
<medicinedoctorset
fieldLabel="doctor cards"
jcr:primaryType="cq:Widget"
name="./medicinedoctorset"
xtype="multifield">
<fieldConfig
jcr:primaryType="cq:Widget"
type="select"
options="/apps/doctor-api/components/medicineview/doctorcards.json"
optionsRoot="doctorcards"
optionsTextField="label"
optionsValueField="id"
xtype="selection" />
</medicinedoctorset>
Not sure what exactly you are trying to do in the code, but it seems to me that you are trying to disable a particular field medicinedoctorset. Try adding id to the field you want to disable, get and disable the field as CQ.Ext.getCmp("idOfTheFieldToBeDisabled").setDisabled(true); Hope this helps.

Exporting More Info Row to PDF using LogiXML not showing up

I am having some trouble trying to export a report to PDF format. I have an action report element to show the more info row, meaning, it is hidden by default (Show Mode : None) until the user clicks a particular element. However, this is creating problems when trying to export since, when I check the option in the Target.PDF element as to "Keep Show Elements", I'm coming up with a blank page. Any help would be appreciated. Thank you.
The best way to troubleshoot these types of export problems is to start simplifying the definition file so that you can easily isolate the issue. For your reports, I might start by remarking the MoreInfoRow so that it's effectively not impacting the export.
-Does the report export to PDF once the MoreInfoRow is gone? If yes, the we can assume the problem has to do with the MoreInfoRow. If no, then there is a different issue. If you've removed the MoreInfoRow and it still doesn't export properly, I might guess that the problem is either : 1) You're passing incorrect showmodes with the export or 2) the report requires parameters to be passed with the Action PDF as well that aren't getting set properly.
For additional details on ShowModes, I'd visit:
http://devnet.logixml.com/rdPage.aspx?rdReport=Article&dnDocID=1043
If the MoreInfoRow is the problem, you might try simplifying the report, in general. Here's a quick example that you can try:
<Report ID="Default" SavedBy="test">
<StyleSheet Theme="SimpleBlue" />
<Body>
<Label Caption="Export PDF" Class="ThemeLinkButton">
<Action Type="PDF">
<Target Type="PDF" KeepShowElements="True" Report="CurrentReport" />
</Action>
</Label>
<LineBreak LineCount="3" />
<DataTable ID="dtExport" Width="450">
<DataLayer Type="Static" ID="myData1">
<StaticDataRow id="001" name="Sample Row 1" />
<StaticDataRow id="002" name="Sample Row 2" />
<StaticDataRow id="003" name="Sample Row 3" />
</DataLayer>
<DataTableColumn ID="colid" Header="id">
<Label ID="lblid" Caption="#Data.id~">
<Action Type="ShowElement" ElementID="mirTest" ID="actShowMir" />
</Label>
</DataTableColumn>
<DataTableColumn ID="colname" Header="name">
<Label ID="lblname" Caption="#Data.name~" />
</DataTableColumn>
<MoreInfoRow ShowModes="None" ID="mirTest">
<Label Caption="This is the More Info Row" />
</MoreInfoRow>
</DataTable>
</Body>
</Report>

What does mx:target do in Flex 3?

There is an example on Adobe livedocs for using states:
<!-- Define one view state, in addition to the base state.-->
<mx:states>
<mx:State name="Register">
<mx:AddChild relativeTo="{loginForm}" position="lastChild">
<mx:target>
<mx:FormItem id="confirm" label="Confirm:">
<mx:TextInput/>
</mx:FormItem>
</mx:target>
</mx:AddChild>
<mx:SetProperty target="{loginPanel}" name="title" value="Register"/>
<mx:SetProperty target="{loginButton}" name="label" value="Register"/>
<mx:SetStyle target="{loginButton}"
name="color" value="blue"/>
<mx:RemoveChild target="{registerLink}"/>
<mx:AddChild relativeTo="{spacer1}" position="before">
<mx:target>
<mx:LinkButton id="loginLink" label="Return to Login" click="currentState=''"/>
</mx:target>
</mx:AddChild>
</mx:State>
</mx:states>
I haven't been able to find the purpose of mx:target in
<mx:AddChild relativeTo="{spacer1}" position="before">
<mx:target>
<mx:LinkButton id="loginLink" label="Return to Login" click="currentState=''"/>
</mx:target>
</mx:AddChild>
Does anyone know what that does and if it is necessary? It seems to be unnecessary.
Looks like I over-thought this one a bit. Turns out target is just the target child you are adding and that is just another way to define it as opposed to defining it as an inline attribute to the AddChild tag.