JClass LiveTable

PreviousNextIndex

Appendix  C

Porting JClass 3.6.x Applications

Overview of Changes  Porting Strategies  Highlights of Main Changes

JClass LiveTable for Java2 is significantly different from previous versions. The focus of JClass LiveTable for Java2 is to make any changes necessary to take full advantage of Swing, and to restructure the product for future expansion.

C.1 Overview of Changes

The major changes are listed in the following table. Each change is discussed in more detail later in this appendix.

Change

Rationale

package name change (com.klg.jclass.table)

Old package name pre-dated naming standard.

Swing-like API

JClass 4 is Swing-based.

data subpackage

Makes it easier to find stock data sources. Stock data sources now include the JC prefix.

beans subpackage

Makes it easier to find Beans. Important for users who wish to remove the Beans from deployment JARs.

no more JCString

JCString has been replaced by HTML in cells.

JCTable and Table

In LiveTable 3.*, Table was the core class and JCTable was a backwards-compatibility class for LiveTable 2.* customers.

In LiveTable 4.*, JCTable is the core class, and Table is a backwards-compatibility class for LiveTable 3.* customers.

beans APIs

Various bean properties have been modified. Essentially, the LiveTable 4.* Beans are not backwards compatible. This porting guide does not talk about the Beans.

new events

The events fired by LiveTable have been rationalized based on user feedback. The listener methods have been renamed to be consistent across all methods.

cell changes

LiveTable now supports two different rendering models. Many renderers and editors were updated to make use of Swing and of the new rendering model. All stock editors and renderers use the JC prefix.

C.2 Porting Strategies

LiveTable 4.x comes with two tools designed to help you move from LiveTable 3.x to 4.x:

C.3 Highlights of Main Changes

New Beans Subpackage

All the Beans have been moved to the beans subpackage. There have been many Bean property changes.

No More JCString

JCStrings have been replaced by HTML in cells. This is supported by Swing, and has been added to LiveTable where appropriate.

You can now put raw HTML into headers and footers, as long as the text starts with <html>. HTML is also valid in axis annotations, axis titles, and legend elements.

Style-based Property Setting

Styles are objects that encapsulate all the visual attributes of cells. You set the property for the style object, then apply it to a range of cells.

In LiveTable 3.*, each visual attribute was set individually on a range of cells.

For example, the following code sets the foreground and background color on a range of cells:

  table.setForeground(1, JCTableEnum.ALL, Color.blue);
  table.setBackground(1, JCTableEnum.ALL, Color.black);

Using styles, the attribute is set on the style, and the style is applied to the cells:

  JCCellStyle style;
  style.setForeground(Color.blue);
  style.setBackground(Color.blue);
  table.setCellStyle(1, JCTableEnum.ALL, style);

In general, styles are easier to use for tables that tend to set multiple attributes on ranges of cells (the majority of cases for table users).

Please refer to Building a Table, in Chapter 2, for details on style-based property setting.

JCTable and Table

In LiveTable 4.x, JCTable is the core class. Table is a subclass of JCTable that is to be used if you want to use LiveTable 3.x API calls. Table does not support all the LiveTable 3.x API.

Beans APIs

Many of the Bean properties are the same. The Appearance property has been replaced by Styles.

New events

The new event structure has been rationalized, and is documented in Events and Listeners, in Chapter 7. It is recommended that you rewrite your event handling code based on the new events.

Cell Editors and Renderers

Most classes now begin with JC.

The drawing-based rendering model (formerly called CellRenderer) is now called JCLightCellRenderer. The getPreferredSize() method now takes a Graphics object:

Old

New

jclass.cell.CellRenderer

com.klg.jclass.cell.JCLightCell
      Renderer

getPreferredSize(CellInfo,
      Object)

getPreferredSize(Graphics, JCCellInfo,

      Object)

There is now a new rendering model based on a component called JCComponentCellRenderer. Some of the default renderers now use this component instead of JCLightCellRenderer.

JCComponentCellRenderer and JCLightCellRenderer have a common base class called JCCellRenderer.

Not all of the renderers are still around.

Old

New

ButtonCellRenderer

None

CheckboxCellRenderer

JCCheckBoxCellRenderer

ChoiceCellRenderer

JCComboBoxCellRenderer

EllipsisCellRenderer

None

ImageCellRenderer

JCImageCellRenderer

RawImageCellRenderer

JCRawImageCellRenderer

ScaledImageCellRenderer

JCScaledImageCellRenderer

StringCellRenderer

JCStringCellRenderer

WordWrapCellRenderer

JCWordWrapCellRenderer

None

JCHTMLCellRenderer

None

JCLabelCellRenderer

The advanced cell editors and renderers have been removed. Users are expected to use JClass Field for this purpose.

The editing interface has changed slightly:

Old

New

initialize(InitialEvent,
      CellInfo,Object)

initialize(AWTEvent, JCCellInfo,
      Object)

getPreferredSize(CellInfo,
      Object)

None. Use component preferred size.

KeyModifier[]
      getReservedKeys()

JCKeyModifier[] getReservedKeys()


PreviousNextIndex