Visual Java/SWING Components Library: ELTable search panel(Read 8435 times)
Thanks for answering my last question.  Here notice another behaviour from the ELTable.

Syndrome:

When clicked, the Search criteria combobox of the ELTable drops down and disappears immediately.
If the ELGroupModel is set MODE_NORMAL afterward, the combbobox will reappears and floats on top of the table.


Here is the code for your reference:
[div class=\'codetop\']CODE[/div][div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']=======================================================================
=============================

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;

import com.eltima.components.ui.table.ELGroupModel;

public class ViewActionDelegate1 implements IViewActionDelegate {

   private View view;

   public void init(IViewPart view) {
      this.view = (View) view;
   }

   public void run(IAction action) {
      ELGroupModel model = (ELGroupModel) view.panel.getJTable().getModel();
      if (model.getMode()==ELGroupModel.MODE_NORMAL)
         model.setMode(ELGroupModel.MODE_SEARCH);
      else
         model.setMode(ELGroupModel.MODE_NORMAL);
      view.panel.getJTable().repaint();
      System.out.println(Thread.currentThread().getName());
   }

   public void selectionChanged(IAction action, ISelection selection) {
      // TODO Auto-generated method stub

   }

}




================================================================================
====================



import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.Enumeration;

import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.event.TableColumnModelListener;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;

import com.eltima.components.ui.ELTable;
import com.eltima.components.ui.table.ELGroupModel;
import com.eltima.components.ui.table.ELTableColumnModel;

public class SwingPanel extends JPanel {

   private static final long serialVersionUID = 1L;
   private JTextField jTextField = null;
   private ELTable jTable = null;
   /**
    * This is the default constructor
    */
   public SwingPanel() {
      super();
      initialize();
   }

   /**
    * This method initializes this
    *
    * @return void
    */
   private void initialize() {
      GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
      gridBagConstraints1.fill = GridBagConstraints.BOTH;
      gridBagConstraints1.gridy = 1;
      gridBagConstraints1.weightx = 1.0;
      gridBagConstraints1.weighty = 1.0;
      gridBagConstraints1.gridx = 0;
      GridBagConstraints gridBagConstraints = new GridBagConstraints();
      gridBagConstraints.fill = GridBagConstraints.BOTH;
      gridBagConstraints.gridy = 0;
      gridBagConstraints.weightx = 1.0;
      gridBagConstraints.gridx = 0;
      this.setSize(300, 200);
      this.setLayout(new GridBagLayout());
      this.add(getJTextField(), gridBagConstraints);
      this.add(getJTable(), gridBagConstraints1);
   }

   /**
    * This method initializes jTextField   
    *    
    * @return javax.swing.JTextField   
    */
   public JTextField getJTextField() {
      if (jTextField == null) {
         jTextField = new JTextField();
      }
      return jTextField;
   }

   /**
    * This method initializes jTable   
    *    
    * @return javax.swing.JTable   
    */
   public ELTable getJTable() {
      if (jTable == null) {
         jTable = new ELTable();
         ELTableColumnModel colmod = new ELTableColumnModel();
         TableColumn column = new TableColumn();
         column.setHeaderValue("A");
         colmod.addColumn(column);
         column = new TableColumn();
         column.setHeaderValue("A");
         colmod.addColumn(column);
         column = new TableColumn();
         column.setHeaderValue("A");
         colmod.addColumn(column);
         column = new TableColumn();
         column.setHeaderValue("A");
         colmod.addColumn(column);
         column = new TableColumn();
         column.setHeaderValue("A");
         colmod.addColumn(column);
         ELGroupModel model = new ELGroupModel(new Object[][] {{1,2,3}, {4,5,6}, {7,8,9}}, new Object[]{"a","b","c"});
         jTable.setModel(model);
      }
      return jTable;
   }

}
[/div]
« Last Edit: November 21, 2007, 04:32:23 PM by Maria »



ELTable search panel Reply #1 on: April 11, 2007, 02:49:07 PM
I am afraid we cannot suggest much according to application code you provided.
I suggest you define when your code works in IViewActionDelegate.



 

Sitemap 1 2 3 4 5