Customizing AEM dialog - increasing all field's sizes - aem

I have a carousel component for which there is a touch UI dialog naming '''cq:dialog''' .I need to increase size of all the fields of AEM dialog. Can anybody help me with this?

You can extend the aem style sheets by creating a clientLib:
Create a folder on file system. In this folder put a file with name content.xml.
The content of this must be
<?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:ClientLibraryFolder"
categories="[coralui3]" />
The most important thing is categories=[...]. The name of categoriy must be "coralui3".
During deployment your own css styles will be virtuelly added to your enviroment.
Then put two files into the folder. One file must be named with css.txt. The name for your other one can be named by your own. In example 'myown.css'. Open css.txtand put the name of your css file into it. See also this video on youtube.
If you want to apply your style on all dialog widgets, you style classes must be named like the classes from AEM itself.
In case you want to apply partially, you have create your own css class. Then open your dialogs xmls and add the keyword "granitCss=" to you prefered widget. See also here.

Related

How to add the custom components in AEM?

How to do the custom components in AEM?
like i have tried to do it by changing the html code in clientlibb but do not understand how to do it properly
To create a custom component you need to create a component node under /apps/<your_proj>/component. Once created, under the node rename the .jsp file to .html and then add your dialog node.
This link should help.

How to use children editor on a list component's dialog on AEM?

I am trying to enable children editor on a list component's dialog to allow users to add custom component into it, like the carousel component from core.
I use AEM 6.5, and the sling:resourceSuperType is list from core.
My .context.xml of the component is as follow:
<?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"
cq:isContainer="{Boolean}true"
jcr:primaryType="cq:Component"
jcr:title="List"
sling:resourceSuperType="core/wcm/components/list/v2/list"
componentGroup="MyContent"
teaserDelegate="thisPackage/components/content/teaser/v1/teaser" />
The HTML file of the list component, which is named "list.html" is as follow:
<sly data-sly-use.list="com.thisPackage.aem.dna.core.models.v1.List"
data-sly-use.template="core/wcm/components/commons/v1/templates.html">
<sly data-sly-resource="${resource.path # resourceType='wcm/foundation/components/parsys/newpar', appendPath='/*', decorationTagName='div', cssClassName='new section aem-Grid-newComponent'}"
data-sly-test="${wcmmode.edit || wcmmode.preview}">
</sly>
</sly>
I could open the component's dialog on edit mode. however, if I add new components to the new children editor on dialog and try to close the dialog. I can't close the dialog.
The error message is:
org.apache.sling.api.resource.PersistenceException: Unable to commit changes to session
I followed the example in "github.com/adobe/aem-core-wcm-components/issues/696", and move editConfig from carousel to my list component. But, it didn't solve the issue.
What can I do?
This is not working because the servlet which is responsible for updating data is of resourceType = core/wcm/components/carousel/v1/carousel
You can see in the network call that XHR request is sent to the server which has url like :
http://localhost:4202/content/we-retail/language-masters/en/jcr:content/root/responsivegrid/carousel.container.html
As you can see a selector container is sent and underlaying servlet :
https://github.com/adobe/aem-core-wcm-components/blob/master/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/servlets/ContainerServlet.java
is listening to only core component resource-type.
In your case it is custom component, hence resource type does not match and hence you get the error.
Two things are possible:
1: Quick and easy is to just use sling:resourceSuperType = core/wcm/components/carousel/v1/carousel
Create custom clientlibs same as this:
/apps/core/wcm/components/commons/editor/dialog/childreneditor/v1/childreneditor/clientlibs
but change var POST_SUFFIX = ".container.html"; to your own selector
and then create your own servlet (registered to your own defined selector) same as the core component.
Hope it helps!
This is a bug on AEM 6.5, and the team is working on it.
https://github.com/adobe/aem-core-wcm-components/issues/985

Save JavaFX scene into FXML file

Anyone knows how to save a JavaFX scene into FXML file that can be loaded by the JavaFX FXMLLoader?
The SceneBuilder allows to do it, but if I build the scene manually, how I can save it into FXML file?
If you mean build a fxml file from a running screen built in Java, the short answer is that you can't.
The fxmlLoader is designed to work only to load files, it references the class XMLInputFactory but not the XMLOutputFactory.
If you would like to do it by yourself, it is not only rewrite the classes read by the FXMLLoader, because there is a lot of reflection (java.lang.reflect) in that class.
So the long answer could be: you can do it by yourself using a lot of reflection and writing dynamic tags from class names, but there will be no guarantee that your fxml gives the expected results.
There is no such library, AFAIK, and I'm not sure if it's possible to create a generic one. It might be possible for simple cases, but even then it's a lot of work, I guess.
Here is the FXML format explained, if you want to give it a try: http://docs.oracle.com/javase/8/javafx/api/javafx/fxml/doc-files/introduction_to_fxml.html
You could traverse your scene graph/ node and generate an FXML file.
But why do you need the FXML format? It might be easier just to rewrite the layout in FXML instead of writing a library like this.
If you manage to write such a library - let us know! :-)
.fxml is just file extension,you can create it with any text file editor , i recommend you to use SceneBuilder either way, since you can create your UI and CTRL+C on root component , CTRL+V to notepad++ or other editor , and get source straight from there , edit to your liking.
To make it short, FXML is an XML based declaration format for JavaFX. JavaFX provides an FXML loader which will parse FXML files and from that construct a graph of Java object. It may sound complex when stated like that but it is actually quite simple. Here is an example of FXML file, which instantiate a StackPane and puts a Button inside it:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<StackPane prefHeight="150.0" prefWidth="200.0" xmlns:fx="http://javafx.com/fxml">
<children>
<Button mnemonicParsing="false" text="Button" />
</children>
</StackPane>
You want to specify controller as well with fx:controller=""
Or set controller in your code, whatever fits your needs.
if your question is more towards what pdem wrote , i suggest you to take a look at scenic View , you can get a lot of infomation from running application and recreate it based of it.If that aint sufficient , there is not much you can do.

CQ5 preload a parsys with components

I'm curious if anyone knows how to have a parsys load w/ default components already in it.
What I'd like to accomplish is the following:
Form Component
- form-parsys
- input component
- input component
For the most part this was pretty straight forward. I created a "form" component that has a parsys in it. What I would like is for this form component to load with a few default input components already set. These input components would need to be a part of the form-parsys node, so that they can be reorganized amongst user added input components.
Not sure if there is any documentation out on this as I couldn't find any, but I'm sure it's not entirely impossible and wanted to see if anyone has done anything like this before, before I go ahead and start hacking away.
thank you
Brodie
I think what you are looking for are templates.
In CQ5, templates can be used to create pages with a predefined content, this can be a parsys (with components) or any other node you might want in your page when it is created.
In your case, you can define a template that includes a parsys component and whatever you want inside that parsys. You can also set rules for where a page can be created using that template.
After you have created (or edited, since you might already have one) the template, you can use the siteadmin to create a new page using your template. The page will be created and all the content below the jcr:content of the template will be copied into the new page. You can even have several templates for the same kind of page, if you need different types of 'initial contents'
An example of a template that includes a parsys with some content might look like this (I'm writing this mostly from memory, might have errors):
<?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:description="A form"
jcr:primaryType="cq:Template"
jcr:title="A form"
allowedChildren="/apps/app1/templates/home_page"
allowedParents="/apps/app1/templates/form_page"
allowedPaths="[/content(/.*)*]"
ranking="{Long}100">
<jcr:content
jcr:primaryType="cq:PageContent"
sling:resourceType="app1/pages/form_page">
<parsys
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/parsys" >
<component
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/text"
text="here is some text"/>
<!-- more components here-->
</parsys>
</jcr:content>
</jcr:root>

gwtbootstrap always applies to all elements

I want to use GWT bootstrap for my application, so I added the jar to the classpath and inherited it in app.gwt.xml and it is working so far (I am new to Bootstrap).
So far I haven't used UIBinders for the layout and if in any way possible would like to leave it that way as I have a very dynamic UI which is generated programmatically and I have little experience with UIBinders. However for the elements that I want to use from gwtbootstrap I have created UIBinders (such as headings and buttons).
The problem is that not only the elements I create with UIBinders using the gwtbootstrap elements look like gwtbootstrap elements, but all elements on the page.
A simple example: it makes no difference whatsoever if I create a Heading like this using a bootstrap element
<b:Heading size="2">Hello GWT Bootstrap</b:Heading>
or like this using standard HTML
<h1>Hello GWT Bootstrap</h1>
both look like a GWT Bootstrap heading. The same applies for all other elements, so any element on the page is styled by gwtbootstrap, even if I don't want it to and I can't find a way to control this.
That's because gwt-bootstrap injects the bootstrap.css into your GWT app and bootstrap.css defines default styles for standard HTML elements like <h1>, etc.
If you don't want bootstrap to override the default styles there are several solutions:
Modify the bootstrap.css in the gwt-bootstrap library file and remove the styles that you don't want
Create a separate css file that sets the styles for the specific HTML elements back (using !important)
Extends gwt-bootstraps CssResources and pass a custom css file.
Solution 3 is probably the cleanest one.