Custom widgets containing other HTML/widgets - gwt

I'm trying to create a custom widget that would internally be
represented by a simple DIV and a BUTTON element, but which would accept
other widgets inside it, pretty much like HTMLPanel.
So, I want something like this...
<div class="XXX">
<button class="YYY"></button>
{other widget(s) here}
</div>
...encapsulated inside some widget, say WrapperWidget. Then, I could use
this WrapperWidget inside some other (multiple) ui.xml files:
<ns:WrapperWidget>
<ul>
<li>item 1</li>
<li>item 2</li>
</ul>
</ns:WrapperWidget>
How is that achievable in GWT?
Thanks!

I don't use UI binder, so I can't help you there.
To nest widgets, one would usually use a Composite http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/Composite.html

Related

Ionic sortable list with options on drop place

I was wondering if there's someone who can give me something to start for the following situation:
We have a sortable list (standard ionic) where I need some options on the drop place. I'll try to explain it with an example.
<ul>
<li>list item 1</li>
<li>list item 2</li>
<li>list item 3</li>
<li name="dropplace">
<span name="option1"></span>
<span name="option2"></span>
<span name="option3"></span>
</li>
<li>list item 4</li>
</ul>
depending on which option the user drops the list item, another actions needs to happen.
I don't know how to begin on the following:
- when dragging, create the drop place with the options
- link the dragging list item to one of the options when hovering
- Do an action when dropping on one of the options
Thanks in advance!
Greetings,
Leander
I'm quite sure Ionic does not provide a sortable widget out of the box. You can use this one, for example, which is basically an AngularJS wrapper around jQuery Sortable Widget. You'll be able to capture the drop event easily and to perform whatever other tasks you need.

AEM Sightly - How to loop through component child nodes

I have a 'container' component for housing child components. Essentially, a container for holding tabs of content, where the user can drag in as many 'tabs' as they choose.
The code is as such:
<!--/* Tab Container Component */-->
<div data-sly-test="${wcmmode.edit}"><h2>Drag a 'Tab Panel' below:</h2></div>
<ul data-sly-list.tab="${list of children in the tab-container parsys}">
<li>${tab.tabName}</li> //these will be the tabs using jQuery-UI
</ul>
<div data-sly-resource="${ #path='tab-container',resourceType='wcm/foundation/components/parsys'}" data-sly-unwrap></div>
And the 'tab' component:
<!--/* Tab Panel Component */-->
<div class="tab-panel">
<div data-sly-resource="${ #path='tab- panel',resourceType='wcm/foundation/components/parsys'}" data-sly-unwrap></div>
</div>
What I want to achieve is to use the container component to loop through the items in its parsys and pull out the property 'tabName' of each item. The node structure ends up as shown:
This might work in your case:
<ul data-sly-list.tab="${resource.listChildren}">
<li>${tab.name}</li> //these will be the tabs using jQuery-UI
</ul>
Basically, the tab-container is your parsys and resource.listChildren will list all the child resources/nodes. tab.name is provided by HTL which will give you tab_panel, tab_panel_1134.., etc.. Other properties inside of each tab-panel (tab) too can be accessed.
Another way to get directly to a resource is with data-sly-use:
with this you can reach any resource in AEM. Docs here (look for data-sly-use with resources).
Good Luck...

Autocomplete Styling customization

For some unavoidable reason, I had to wrap autocomplete result in two divs, so my final output is as
<div id="resultDiv">
<div id="scrollerDiv">
<li>...</li>
<li>...</li>
<li>...</li>
</div>
</div>
instead of
<li>...</li>
<li>...</li>
<li>...</li>
But this removes all styling and events from my result (i.e. <li>s). My 'select' event was getting called, results were navigatable using up and down arrows, background of selected record was getting highlighted etc. before adding these divs but all this functionality is gone. Is there any change/s I can do in 'jquery.ui.autocomplete.js' and/or 'query.ui.css' to add this div existance and get everything working back?
I achieved this by applying css class of <ul> to <div> dynamically.

Scala | Lift | How to make across menu

Using
<div class="lift:Menu.builder"/>
menu on website is vertically, any ideas because i cant found anywhere, how to make menu across ?
This is more a CSS question than a Lift question. The HTML produced for the menu looks something like this:
<div class="column span-6 colborder sidebar">
<hr class="space" />
<ul>
<li> <span>Home</span></li>
<li> Login</li>
<li> Sign Up</li>
<li> Lost Password</li>
<li> Search</li>
</ul>
...
</div>
I.e., about as vanilla as possible, so it's very easy to add some CSS to create a horizontal menu out of the list—see for example the "Horizontal lists" examples on Listamatic.
It would be simplest just to add the CSS code to the header in src/main/webapp/templates-hidden/default.html, but you could also use your own separate CSS file without too much fuss.

Bullets and numbering within reports

How do you add a bullet list and stylized numbered list using JasperReports?
Try:
Add static text (or a text field).
Set Markup in the Properties panel to: html
Use the following HTML markup in the text:
<ul>
<li>bulleted item 1</li>
<li>bulleted item 2</li>
</ul>
<ol>
<li>ordered item 1</li>
<li>ordered item 2</li>
</ol>
The problem starts, where we want to do automatic numbering without CSS styles. I solved this by implementing own JRDataSource.