wicket DropDownChoice jump to certain selection - java

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).

Related

Testing responsiveness of HTML page using Java

I am developing an application to test whether a HTML page is responsive or not. Right now, I am assuming that using media queries is the only way to make a HTML page responsive.
But I am using a very crude logic to test it. I am parsing the HTML file and reading it for the presence of a media query statement. If its present I am declaring it as responsive, otherwise non-responsive.
Is there any other way I can go about it?
Is there any other test I can perform before declaring it as responsive or non-responsive?
Check if they are using hard coded px instead of % or em. Maybe see if text is too small or links to close together.
At the end of the day it wont be a great resource for responsive checking since there are so many factors
According to Ethan Marcotte's seminal article that introduced Responsive Web Design (http://alistapart.com/article/responsive-web-design), a responsive page will use media queries, flexible grid layouts and responsive text.
But, even if a page has these elements, it doesn't mean that it is using them correctly. A responsive page is not one that simply uses media queries.
I'm not sure that the ability to programmatically determine if a page is built responsively is even a viable goal. You can check for ingredients, but that won't tell you if the right recipe was followed.
Also, why have you tagged this question with Java?

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.

GWT multiple Paging (Best / easiest way)

So far I've done some tests (e.g RPC)
Next I come to the Part Multiple Paging, in what I've read so far there are so many options for this:
MVP, Layout, UIbind.
Now I really don't know which I should choose, which is easy and good.
I tried clearing my Rootpanel and placing another Widget(composite):
RootPanel.get().clear();
Place:
LoginComp login = new LoginComp();
rootPanel.add(login, 127, 125);
I don't know if this is the most professional approach. What is the best way to include my widgets as composites?
First of all, GWT is a single page application. After you have requested the application, you'll only go to the server to recieve data.
I would use a struts or SpringMVC application for the logon and request the GWT application after a successfull login. Your GWT application should have a shell. This shell has an area where you can change your views. Changing a view is initiated via a place controller.
Take a look at the mobileWebApp example contained in the GWT SDK examples.
Also, you will find a good documentation here:
MVP and Places Documentation
In my oppinion, the best way is when you add a element in your main HTML file which acts like a content wrapper e.g.
<div id="content"></div>
Each of your page can be represented as extended Panel, simultaneously as a singleton. The page that should be display will be set into that wrapper:
RootPanel.get("content").set(pagePanelX);

GWT : Generate THEAD in TABLE

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).

Fast search in java swing applications?

I'm wandering myself what component is the best for displaying fast search results in swing. I want to create something like this, make a text field where user can enter some text, during his entering I'll improve in back end fast search on database, and I want to show data bellow the text box, and he will be able to browse the results and on pres enter result will be displayed in table. So my question is is there any component which already have this logic for displaying?
Or is it's not, what is the best way to implement that.
This search will be something what ajax gives me on web, same logic same look and feel, if it's possible on desktop application.
Are you looking for something like an AutoComplete component for Java Swing?
SwingX has such a component. See here for the JavaDoc. It has a lot of utility methods to do various things, i.e. auto-completing a text box from the contents of a JList.
I strongly, strongly recommend that you take a look at Glazed Lists - this is one of the finer open source Java libraries out there, and it makes the bulk of what you are asking about super easy.
You will have to first attach a listener to the JTextFields Document to be notified whenever the user types in the field (or changes it).
From there, you can fire off any server-side code you need. The results of that can be used to update a listbox.
A few things to keep in mind:
The code to do the search against the backend must be in another thread
The code that updates the list box should update the list box's model
You will need to manage all your backend search results so that you only update the listbox with the most recent result (e.g. user types 'A', backenf searches for that. Meanwhile, user has typed 'C', kicking off a backend search for 'AC'. You need to ensure the results from the 'A' search dont' make it to the listbox if the 'AC' search results are available).
Use Hibernate Search.
The SwingHack (http://oreilly.com/catalog/9780596009076/) book has an example of this.
In the interest of killing two birds with one stone: have a separate indexing thread. This will:
Improve the speed of searches whenever they are executed.
Improve the responsiveness of the UI since indexing is happening in a separate thread.
Of course, exactly how you perform the indexing will vary widely depending on your particular application. Here is a good place to start researching: Search Indexing. And please, ignore the reference to Web 3.0 [sic].
It is possible of course. It is simple too. For drop down list of terms just use popup menu. This is simple. The background processing of entered text is simple too. Enjoy!

Categories

Resources