No more SwingWorker

New update version JComponentPack v3.5.6 includes two new annotation named “PlainAction” and “TaskAction”, these annotation could be used in JBean subclass or JBeanActionHandler subclass, use these annotation on the specified method, click the command on the toolbar or menubar, it’s action will invoke these method automatically.

The “PlainAction” is a plain action, it’s invoked on the Event Dispatch Thread directly when invoke, it’s name property is the action name, if the name property is not specified, use the “doXXX” method name to keep compatibility,just like set and get mark a property, the “do” prefix mark this method is a action, the “XXX” is the action name.

 

The “TaskAction” is a task action, it’s invoked on the background thread if it’s invoker property is false(by default), it’s result will be notified on the Event Dispatch Thread on the method “JBean.processTask(TaskResult)”, if the invoker property set to true, it will give you a chance to do something on the Event Dispatch Thread before start the task, you could popup a dialog, get the user input, then set the input to task by use “Task.setParams” method, then start the task by invoke “Task.execute” method, the task must start manually on the invoker method on the latter case.

The following is an example use the above annotation, the lambda expression come in Java 8 also work with the TaskManager, in the Java version prior to Java 8, use the TaskAction or “doXXX”  work well:

The JavaDoc API of new class include “TaskAction” and “TaskManager”  will update on the website soon.

How add data to JListView component?

Use the ModelFactory to wrap your list or array, then add it into JListView component:

 

Axis1.x with jax-ws Read timed out problem

Axis send the web service request by use HTTP 1.0 by default, change to HTTP 1.1 solve this problem:

call.setProperty(MessageContext.HTTP_TRANSPORT_VERSION,
HTTPConstants.HEADER_PROTOCOL_V11);

If call Web Service get “cannot found dispatch method” error,Axis is RPC style Web Service,so you should add RPC annotation(@SOAPBinding(style = Style.RPC)) when write your Web Service by JDK:

@WebService
@SOAPBinding(style = Style.RPC)
public class HelloService {

}

Recent FAQ for Java Spreadsheet

JDataGrid is a pure Java Spreadsheet component, it has many features, it looks like Excel, the following is the questions that the developers often ask, it will help you understand and use the JDataGrid quickly.

Q:How to enable multiple in cell?
A:Sets the cell to String.class:
dataGridModel.setCellClass(String.class, 3, 5); then enable multiple line:
((StringCellEditor)dataGrid.getCellManager().getCellEditor(String.class)).setMultiLine(true);
((StringCellRenderer)dataGrid.getCellManager().getCellRenderer(String.class)).setMultiLine(true);

Q:How to click once, then enter edit mode?
A:dataGrid.putClientProperty(“JDataGrid.clickCountToStartsEdit”, 1);

Q:How to set the JDataGrid window size?
A:

bean.getFrame(true).setPreferredSize(new Dimension(480,320));

bean.setExtendedState(Frame.NORMAL);

Q:How to disable the save/cancel dialog after close the JDataGrid window?
A:Override the JDataGridBean.doClose method,add your logic, then getFrame().dispose() method.

Q:How to set the freeze window on code?
A:JDataGrid.setFreezeCell

Q:How to get the menu on the top?
A:

JMenu menuwindow =(JMenu) menubar.getMenu(6);

dataGridBean.getUIFactory().loadMenu(menuwindow);

Q:How to add license data?
A: LicenseManager.getInstance().addLicenseData(registercode);

Q:How to get selected cells of JDataGrid?
A:Cell[]  cells = getDataGrid().getSelectedCells();
Cell   c =  getDataGrid().getSelectedCell();

Q:How to hide the default menu bar of JDataGrid?
A:JMenuBar menubar = dataGrid.getMenuBar(JDataGridBean.MAIN_MENUBAR);
menubar.setVisible(false);

Q:Have the JDataGrid auto increment the row or column count when click the scrollbar?

A:Set the following property to enable this feature:
JDataGridBean.setAutoAdjustRowColumCount(true);

Q:Is the maximum row and column count of JDataGrid?
A:In theory, the JDataGrid support maximum 2^32 row or column count, on the bank or securities project, they always use the LargeDataGridModel, it have better performance for large data.

 

 

How to disable JDataGridBean splash screen?

Before initialize the JDataGridBean component, set the following system property at first:

System.setProperty(“application.hideSplash”, “true”);

JDataGrid is a Java Excel swing component in JComponentPack product suite, it’s a flexible Java spreadsheet, it’s widely used in banking, securities, taxation, e-government system.

JDataGridBean is a component based on JDataGrid and provide menu bar, tool bar, status bar, etc.

JDataGrid and JDataGridBean could both used in your swing application.