Why does AEM component not drag to the page? - adobe

I am just getting my head around AEM version 6.2 and struggling to create a component that I can drag onto my page. I copied an existing 'working' component and changed the name in the CRXDE page. The result is the new component is visible in the left components panel but when I want to drag it nothing happens? How can I create/copy an component that is draggable?

For a component to be droppable inside a parsys, it needs to be added using design mode...
Go to design mode
Configure that parsys
Select the component which you want to drop inside parsys
Go back to edit mode. It should now be droppable.

I suggest you to add some text in the component jsp. Make sure cache is deleted. Also try to cq:include the component in your page component.If you are unable to do so will mean there is something wrong with the component development.

Related

Adobe CQ Components restricting child components

I am trying to create a component for a simple accordion, where blocks of content are held under headings and only one heading is visible at a time. My preferred implementation uses two components, one to represent the whole accordion and a second component for a single entry.
The idea is that a content author can pull the accordion in from the sidekick, then drop one or more accordion items into the accordion, but not allow any other components to be dropped here. The accordion items should only be able to be dropped into the accordion component and not within any other parsys.
My problem is that currently it is possible to add other content into the accordion and add accordion items outside of the accordion.
The first attempt to solve this was:
foobar/components/accordion
foobar/components/accordion/accordion.jsp
foobar/components/accordion/cq:editConfig
foobar/components/accordion/dialog
foobar/components/accordion/accordionitem
foobar/components/accordion/accordionitem/accordionitem.jsp
foobar/components/accordion/accordionitem/cq:editConfig
foobar/components/accordion/accordionitem/dialog
These are the config files from this are:
accordion/.content.xml
<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"
cq:isContainer="{Boolean}true"
jcr:primaryType="cq:Component"
jcr:title="Accordion"
sling:resourceSuperType="foundation/components/parbase"
allowedChildren="[*/accordion/accordionitem]"
allowedParents="[*/parsys]"
componentGroup="General"/>
accordion/_cq_editConfig.xml
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:actions="[-,edit,-,delete]"
cq:layout="editbar"
jcr:primaryType="cq:EditConfig">
<cq:listeners
jcr:primaryType="cq:EditListenersConfig"
aftercopy="REFRESH_PAGE"
afterdelete="REFRESH_PAGE"
afterinsert="REFRESH_PAGE"/>
</jcr:root>
The dialog is blank and exists only so that the component will appear in the sidekick.
accordion.jsp simply includes the foundation parsys.
accordion/accordionitem/.content.xml
<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="Accordion Item"
sling:resourceSuperType="foundation/components/parbase"
allowedParents="[*/accordion]"
componentGroup="General"/>
The accordion item dialog takes in the title. The editConfig simply adds the toolbar, but no listeners.
accordionitem.jsp outputs the title taken from the dialog and has a parsys.
My problem seems to be that the parsys aren't using the rules for the accordion and accordionitem components. Instead they seem to inherit from the next parsys up instead, unless overwritten.
I can set the components correctly by using edit mode on the page and selecting the appropriate components, but that sets the information against the template, meaning I need to perform the same configuration for every page template. What I want is to have it defined in the component definition instead so that it exists once.
After first writing the components I found this blog, which describes exactly the same scenerio: http://jenikya.com/blog/2012/03/cq5-accordion-component.html
Using that as I reference, I tried adding an extension of parsys to use within accordion.jsp instead. This made no difference to the code, so even my custom parsys allowed components other than accordion item to be added.
Any guidance on either what is wrong or other approaches to take will be greatly appreciated.
The solution here would be to use a parsys and build a composite component to restrict the accordion content to a set of components only (as described in the blog entry).
Have a look at http://localhost:4502/content/geometrixx/en/company/press/asseteditor.html which also uses this technique for the dam/components/asseteditor/thumbnail component.
This is a very generic problem statement in AEM. There are several ways to handle it, depends on your business need and how your design will map this. I can suggest two solution for this:
1. Apply Template level design restriction for your accordion component. Which means, you drop accordion component and then go to design mode of page and in accordion par select accordion item component. This is one time activity only.
Though i would recommend option #2:
2. In accordion component dialog, ask author to add accordion item using multilist.
- To add a new item, simply open accordion dialog and add item in multilist and enter accordion id in it.
- To remove item, open dialog and remove item from multilist
- To change position, rearrange items in multilist.
Based on no of multilist items entered by author in Accordion dialog, statically include accordion item component and give component id entered by author in multilist.
Using this approach, you will
- easily restrict component in accordion.
- Reduce one component (accordion item) in sidekick
- Reduce one parsys on page (so many parsys eat authoring performance)

Missing Dropdown in Component Styles Tab in CQ5

In the TextImage component, the Style tab has lost the css selection dropdown that used to show up when editing the component. It now just shows a blank area. It should have a dropdown for image alignment (left or right are your choices). This doesn't appear anymore.
This tab is xtype componentstyles (String), so I don't know where it references the source for the dropdown values. My local instance of CQ5 works just fine.
I cannot just add an xtype selection and feed it values because the css that gets added to the JSP code is outside the component's .jsp-specific page
It looks like the componentstyles xtype is driven by the CQ design that is associated to the page. Designs are stored underneath /etc/designs and are assigned through a page's Page properties dialog (cq:designPath property)
Let's look at an example in the Geometrixx website. If you navigate to the English homepage # /content/geometrixx/en.html and add an instance of the TextImage component to the page, you will notice that the Styles tab is empty in the component dialog. Now navigate to the 'Discover Geometrixx' page # /geometrixx/en/company/discover_geometrixx.html and examine one of the two pre-existing instances of the TextImage component. The Styles tab has the image dropdown you mentioned!
So what is the difference between the instances on the 'Discover Page' and the 'Home' page? The answer is in the design definition. If you open up CRXDE Lite and navigate to the Geometrixx design page for the Content Page template (which the 'Discover Geometrixx' page adopts), you will see the following nodes:
/etc/designs/geometrixx/jcr:content/contentpage/par/textimage
/etc/designs/geometrixx/jcr:content/contentpage/par/textimage/cq:styles
/etc/designs/geometrixx/jcr:content/contentpage/par/textimage/cq:styles/imagealign
/etc/designs/geometrixx/jcr:content/contentpage/par/textimage/cq:styles/imagealign/image_left
/etc/designs/geometrixx/jcr:content/contentpage/par/textimage/cq:styles/imagealign/image_right
The design for the Homepage template (which the 'Home' page adopts) is missing this definition.
If you want to continue to use the out of box TextImage component, it seems you will need to have this design configuration set up on all the paragraph systems and templates where the component can go. So for example, if you want these styles to be available to the TextImage component when it is added to the par paragraph system of the Homepage template, you would add similar style nodes to:
/etc/designs/geometrixx/jcr:content/homepage/par/textimage/cq:styles
Alternatively you could just overlay the component and/or create your own. Then for this custom component you could create your own Styles dialog that is independent of the design. You can simulate the out of box behavior by examining the saved JCR property and setting the appropriate CSS class name in your render script.
The problem is that a design path variable went missing. We don't know why or how, but the solution is as follows.
Open up Content Repository
Go to /content/-sitefolder-/ and expand
Click on jcr:content and view properties
Check for attribute cq:designPath and its value
/etc/designs/-sitefolder-; add to properties if it doesn't exist

How to completely initialise a component but not add it to the display? Flex

I need to completely initialize a custom component in my Flex app (i.e. I should be able to access it from action script and get its properties and its children etc), But I do not want to add it to the display or make it visible.
I have tried to add it to my visible component, but keep it visible, but often many of its properties are set only when it is drawn, so i don't get what i need.
Is there a way to add a custom component to some sort of 'Virtual' display, that is not visible to the user?
You could add the component to an invisible Sprite - that way the component itself could both be on the stage and have its own visible property set to true.
Did you try using initialize()? After a view is added to the display list, the initialization stage begins. Calling initialize() before addChild() should let you initialize the view without needing to first add it to the stage.
For more info visit:
http://flexscript.wordpress.com/2008/10/24/flex-component-lifecycle-and-flex-component-framework/
http://blog.deadinkvinyl.com/2008/10/05/flex-3-addchild-and-initialize/
Not sure if possible without adding it to the display list, although I'd wish it were to some extent.
I once had to make custom drag proxy, which didn't work with the real component, because of some weird skinning issues. So instead I had PopupMananger add a box as a popup, added my component to the box, called validateNow on the component, drew it in a bitmap data, removed the popup, and used the bitmap data as the proxy.
So what you were trying was missing a call to validateNow most likely.

Flex form inside Pop up window - Tab (order) between forms not working

when user clicks on Add button, then a pop up button will be opened with certain form elements (like textinput, date field, text area).. When i used 'TAB' inside this form,it is not working. I found in couple of Questions / forums that we need to create an instance of FocusManager and then bring/activate focus for the pop up. But still i didn't see the tab working inside the form. In order to tab order working inside a pop up, what steps we need to follow.
I tried using focusmanager and property like tabfocusenabled, tabenabled and also added taborder inside each form element. But no luck.
Iam using Flash Builder 4.5 and using spark components for development.
Is there any workaround for this problem?
Thanks in Advance,
Regards
Srinivasan
Thanks for all your responses.
Finally the issue has been solved by one of my colleague. Problem is , the form has been loaded inside Horizontal accordion (flexlib HACCORDION). So inorder to draw focus inside the accordion to child elements, we need to add 'hasFocusableChildren="true"' for the HAccordion (horizontal accordion component). Adding this property solves the tab order problem.
I have also pasted the code below:

SelecedIndex of tabnavigator is appended to url

In my flex application when I added a tabnavigator control and ran the application, I found that a "#" was appended to the url in the browser and whenever I select one of the tabs the url changes to this "myurl#app=7049&c152-selectedIndex=1" reflecting the index of the selected tab, is this a normal behavior of the tabnavigator, is there a way of removing it?
Thanks
It's a browser navigation integration related feature. You can disable it by going to project properties -> flex Compiler, and uncheck "Enable integration with browser navigation".
Bonus reference here. You might also want to check the link at the end of that article.
Set historyManagementEnabled property of the TabNavigator to "false"

Resources