Diamond Edge, Inc.

VB to Java Conversion




Diamond Grid

Diamond Grid (DsGrid):Add grid and spreadsheet functionality to your Java applications. Diamond Grid is a data-aware drop-in replacement for JTable which provides full and easy formatting and styles for each cell, column, or row. For binding to databases, the ResultSetModel provides a scalable and high performance virtual view of up to 2 billion records from a JDBC ResultSet. This model is optimized to support large sets of data by only caching small amounts of the data to provide fast display of the data. Any other type of data source can be displayed by creating a model that implements the TableModel interface. The grid can also be used in unbound mode using the default data model. The data in the grid can be formatted, sorted, printed and edited using any of the models supplied or any user defined TableModel. The grid is very easy to use.

Since Diamond Grid (DsGrid) extends the builtin JTable, you can easily convert an existing application using JTable to one that can use all of the advanced features of Diamond Grid by changing one line of code. For example, if you had the following:

JTable table = new JTable();
change it to
DsGrid table = new DsGrid();
Your existing code will continue to work and now you can begin to use add in some of the new features such as:
  • Cell, Column and Row level formatting - You have full control over the formatting of individual cells or setting the default formatting for all cells in a column or row. This includes control of fonts, background color, foreground color, text formats (such as Dates, percent, currency), word wrapping, alignment, borders, 3D text style, and icons. The flexibility, customizability and ease of use is unsurpassed.
  • Cell Types/Formats: percent, currency, date, number, icon, text and icon, list of values, boolean, mask, owner-draw (any JComponent such as JButton)
  • Customizable - Swing components are used to display/edit the data such as CheckBox for Boolean, TextField for strings and numbers, drop-down DatePicker for Date/Calendar, ComboBox for lists, JFormattedTextField for any Formatter such as MaskFormatter, etc. Any component can be added to give a custom look such as a JButton. Any renderers or editors written for JTable will also work.
  • Row Headers can be shown and are ideal to represent data that needs to be in fixed columns that do not scroll. The header can have multiple columns and its cells can be formatted as any other cell can.
  • Database Binding - DsResultSetModel provides a scalable and high performance virtual view of up to 2 billion records from a JDBC ResultSet. This model is optimized to support large sets of data by only caching small amounts of the data to provide fast display of the data. User-entry changes are automatically saved back to the database.
  • Data from any source - Methods are provided to load data from text files (tab delimited or CSV) or from a stream of text data such as from a URL. Other data sources can be created by implementing the TableModel interface. This allows even real-time data to flow into the Grid.
  • Printing - There are many options available to print the table on multiple pages. A print preview dialog is also provided.
  • Extensive features - Many properties and methods are supported in addition to those supported by JTable. Such features include:
    • Cell spanning
    • Sorting
    • Click on column to change sort
    • Copy and Paste to/from clipboard or excel
    • Saving to text and CSV files
    • Find and Replace text in any cell
    • Customizable Tab Order useful for data entry forms
    • Cell ToolTipText
    • Background Picture and alpha blending
    • Rotate cell or header text 90 degrees or 270 degrees
    • Automatically display negative numbers as red
    • Set user defined data on a cell
    • Prevent editing of data in an individual cell, row, column and/or the whole grid
    • Use a formula to calculate the value of the cell (over 115 spreadsheet functions available)
  • New to Version 3.5

Bonus components included:

DsDatePicker: displays a drop down DsDateView to select a date visually using a calendar style component. The date can also be edited directly by typing into the date field.

DsDateView: allows the user to select a date visually using a calendar style display. The size of the component is based on the Font used and it should be allowed to size automatically to its preferred size. A panel at the bottom is optionally displayable to edit the time.

DsComboBox: is a multi-column ComboBox which displays a collection of objects. The drop-down list can be formatted similar to a grid with the ability to set style properties on each cell independently or make each cell in a column share the same properties. New to Version 3.5

DsLabel: Displays multiple lines of text and/or icon that a user can't change directly. It is a replacement to and uses the same API as JLabel. It breaks the text up into multiple lines when WordWrap is turned on. Many other additional features are available such as rotation, margins, text styles (3D and highlighting), built-in borders, and font underlining and strikethrough.

Peruse the Diamond Grid Tutorial to get a feel for how powerful and easy to use this grid component is. Take a look at all of the spreadsheet functions in the documentation.

You might also want to look a the documentation on-line.

 © Diamond Edge, Inc. All rights reserved.