Mailing list - Entries of 2005

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qftestJUI] How to change the name of a column of a JTable

  • Subject: [qftestJUI] How to change the name of a column of a JTable
  • From: "Philippe Gaudin" <Philippe.Gaudin@?.com>
  • Date: Tue, 11 Oct 2005 11:04:33 +0200

Title: Message
Hi !
I have some problems writing an ItemNameResolver to change the name of cells of JTables.
By default, the ids of cells are something like .table@label&1 where label is the label in the header of the column.
What I would like is to provide another name for the columns (i.e. a name which is not dependant of the language, position of the column in the table).
I tried to create an ItemNameResolver in Java ( a GridDwcTable extends JTable ) :
  public static void install() {
    ResolverRegistry.instance().registerItemNameResolver("javax.swing.JTable", instance);

   public String getItemName(Object object, Object object1, Object object2) {
     if (GridDwcTable.class.isAssignableFrom(object.getClass())) {
        GridDwcTable dw = (GridDwcTable) object;
        int colNbr = ((Integer) object1).intValue();
        String colName = dw.getDwColName(colNbr);
        String result = colName + "&" + object2;
        return result;
      else {
        return null;
Using this resolver, the Component Id of the cell is still like table@label&1...
BUT the TEXT of the cell is my returned result for example COLUMN_NAME&1
My questions :
  • what am I doing wrong ?
  • how can I customize the column name of a cell of a JTable in an ItemNameResolver (or in any other resolver) ?
I'm using qfTestJUI 1.08.4 (build 1582)
Thanks in advance for your help !!