GWT : Generate THEAD in TABLE - java

Is that possible to generate THEAD in a TABLE in GWT ? Do I have to create my own Widget ?
I'm following the Google Tutorial on GWT, https://developers.google.com/web-toolkit/doc/latest/tutorial/gettingstarted... but when see the generated HTML I get sick :o)
So I gess that yes I can use whatever I need to use to be able to generate better HTML.
In fact, I have to report if I can do good HTML/CSS/JS whith this technology. So I try to know what is possible to do with GWT.

Column headers of CellTables will be rendered in a <thead> section.
You can also use HTML with an HTMLPanel (made much easier using UiBinder) if you don't need to manipulate the table's structure dynamically (assuming you're putting widgets in there, otherwise you can very well do whatever you want with it; this is because widgets have a specific lifecycle to avoid memory leaks with event handlers).

Related

Siebel Open UI and Selenium; changing ID's/names

I am working on a project for a client where they are going to upgrade to Siebel Open UI. With that upgrade, they also want to start implementing Selenium. The problem we are currently facing, or going to face once implementing, is that with each build the ID's/Names of HTML elements in Siebel change. Because we are talking about a lot of views and applets it's not a good solution to change the code manually each time.
What is a good solution for this problem? One solution that was offered is a correlation table where we keep track of changes in the ID's.
Xpath in this case is also not a good option because of the complicated structure of the views and applets.
I would suggest that you look into CSS Selectors. They are faster and less brittle than XPath. For ID/names that are dynamic, typically there is at least some portion of the ID that is static.
For instance,
<a id="somestatictext_12345">...
where "12345" is some dynamically generated number. In this case you can use a CSS selector like
driver.findElement(By.cssSelector("[id^='somestatictext']"));
Examples
"[id^='somestatictext']" - ID begins with "somestatictext"
"[id$='somestatictext']" - ID ends with "somestatictext"
"[id*='somestatictext']" - ID contains "somestatictext"
For more info, take a look at this CSS Selector reference.

How to create dynamic drag and drop templates?

I have a requirement of developing a functionality where user can dynamically define a template (labels, textboxes, labels, rows, columns, parent child relationships among above elements etc). These elements(such as combo boxes) may be bound to different database tables.
For example, the user may define a template T1 for a specific use case U1. But this template is not restricted to U1 only. It may be needed to be used in another use case U2, where it is a sub part of a bigger template.
Once the templates are defined, another user may load the templates (HTML form) and enter data into it. At a later stage, I need to reuse this data and template to generate PDF reports. Since PDF reports may sometimes need to have a different layout than the HTML form, I would need parent child relationships between elements as well.
As of now, we are achieving by generating an XML from a user interface where a user can select elements from a dropdown and specify properties. At run time, these XML are transformed to HTML using XSLT. Another XSLT is used for generating PDFs. The limitation of this scheme is that it is very tedious to incorporate any user requests (such as multiple columns, add tables into forms etc).
I was wondering how other people achieve this and is there an API/Library for doing the same ?
I have looked at HTML5 and JQuery drag and drop features, but it would require me to add everything from scratch (such as dynamically add columns,rows etc.)
The best thing to create dynamic form is using angular js.
It is very good framework for front end development
Here is the working link for
angular js form
Sorry, I only gave example form dynamic forms here are some example for drag and drop
Angular drag and drop 1
Angular drag and drop 2
http://angular-js.in/dragular/
I hope this will help.
There are libraries out there for dealing with databases, such as JDAL,jOOQ and many many others.
For creating forms and reports, however, Oracle does have their Oracle Forms and Reports suite. There are also alternatives, such as OpenXava, that can also do these things (and probably better, I've worked with 10g/11 and it can be a pain sometimes). If you're more interested in using XML and other markup languages, you might like FOXopen.
All of these can output to PDF and other types of documents.
Where I work, we use Oracle Forms and internally written programs to craft our reports.

wicket DropDownChoice jump to certain selection

I am using wicket DropDownChoice and my list is very long, is there a way that when i click the drop down list and then click on a character the list will jump to the first select that start with the same character
I know this is not the exact solution to your problem, but it will solve your functional issue. If you have very long select list, I would recommend loading it progressively with a search field via Ajax.
wicket-select2 is such a (wonderful) wicket component, integrating the select2 library into wicket to provide Ajax filtering, custom rendering, etc. Although the current integration doesn't offer a way to simply add the select2 behaviour to a static non ajax DropDownChoice, it's relatively easy to do by using wicket-select2's classes as a base. For the wicket-select2 integration all you'll need is to use Select2Choice (or Select2MultiChoice for multiple selects) to which you pass a simple TextChoiceProvider
After you start using such a component, you don't really want to go back to plain old selects, in particular if you have long lists of choices.
Note : using 1.5.8 (and previously 1.4.x), the old selects in my application display the behaviour you are looking for, e.g. standard html behaviour. However from what I understood you don't use a <select> tag in your markup for your DropDownChoice: what are you using then (it's likely this is the cause of your issue).

Generating HTML report for JTable data

I need to generate report in HTML for my Swing based application.
Is it possible to convert JTable into HTML code (HTML table)?
If yes, how can I convert JTable into HTML table, or is there any alternative way to generate HTML for reporting?
Ok. I've come to three solutions over night (you can combine them if possible):
The basic - the most control and flexibility - you generate HTML by iterating over rows wrapping data with table, td, tr. For better visual effect you must manually include it in the generated output.
Create a model with JAXB or Jackson annotations (or any library that provides you with easy JSON/XML creation) and save your model to/with a "html template" with fancy stuff like CSS and cool visual effects provided by for example jQuery UI (and extensions: Heatbox, etc.) DataTables, KendoUI, Flexigrid, or even Google Charts. To adapt to particular "visual-effects provider" you probably must manipulate a little your generated XML/JSON data but with JAXB you can even produce strict HTML table snippet.
Data generation like in 2. - but you use this data with external tool/application that can read XML/JSON (or any format that you provided). You can try to use Jasper reports (here and here, iReport, Eclipse BIRT) - the report tools should have option to Save as..->HTML Page.
In case of charts (and if you don't want above JavaScript based solutions) you can also generate images (that you will display in HTML page) with some java library that gives you the possibility to save generated images (for example JFreeChart etc. or Swing's paint components trick).

How to implement dynamic GUI in JSP

i have a requirement where i need to display some fields on the JSP. These fields are dynamic in nature, meaning, for ex:, if i changed some value in the dropdown, some fields will be hidden and some other fields might come. I dont want to write Javascripts for show/hide of divs, rather want logic to be coded somewhere at server side.
I have an idea of implementing a custom tag library, but i wnat if i could get an out of the box solution.
any new suggestions or solutions are welcomed.
You had better do it in JavaScript. Having said that, you can send AJAX request to get the new form fields based on the input provided. For example, have a <div> to set the HTML coming from the server.
Use struts framework , there are some tags which can hide and show fields based on values
Logic/logicout tags example
If you want to use a web framework, try Struts 2. It provides tags like <s:if test="some ognl expression" ...> to selectively render html content.
Otherwise you could just go with the JSTL core tags, which provide a <c:if text="some Java EL expression" ...> and a <c:choose ...> tag ( Example ).
Remember to reload the page after changing select box values in order to update the UI.
For this some JavaScript might be needed.
DOM (Document Object Model) in Javascript is very powerful and cross browser.
to remove a node on UI
1.removeChild(nodename)
to add a node on UI
2.elementNode.insertBefore(new_node,existing_node)
I used it. it works well.
more information on DOM.
http://www.w3schools.com/dom/default.asp

Categories

Resources