/[svn]/jsampler/trunk/src/org/jsampler/view/EffectTable.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/EffectTable.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2194 by iliev, Fri Jun 24 21:34:51 2011 UTC revision 2195 by iliev, Tue Jun 28 22:44:39 2011 UTC
# Line 31  import org.linuxsampler.lscp.Effect; Line 31  import org.linuxsampler.lscp.Effect;
31   *   *
32   * @author Grigor Iliev   * @author Grigor Iliev
33   */   */
34  public class EffectTable extends JTable {  public class EffectTable extends JSTable<EffectTableModel> {
         private final String tablePrefix;  
35                    
36          public          public
37          EffectTable() { this("EffectTable"); }          EffectTable() { this("EffectTable"); }
38                    
39          EffectTable(String tablePrefix) {          EffectTable(String tablePrefix) {
40                  super(new EffectTableModel());                  super(new EffectTableModel(), tablePrefix);
                 this.tablePrefix = tablePrefix;  
                   
                 loadColumnWidths();  
41                                    
42                  setAutoCreateRowSorter(true);                  setAutoCreateRowSorter(true);
43          }          }
44                    
         @Override  
         public EffectTableModel  
         getModel() { return (EffectTableModel)super.getModel(); }  
           
45          /**          /**
46           * Gets the selected effects.           * Gets the selected effects.
47           * @return The selected effects, or empty array if no effects are selected.           * @return The selected effects, or empty array if no effects are selected.
# Line 66  public class EffectTable extends JTable Line 58  public class EffectTable extends JTable
58                                    
59                  return effects;                  return effects;
60          }          }
                   
         public void  
         loadColumnWidths() { loadColumnWidths(tablePrefix); }  
           
         public void  
         loadColumnWidths(String prefix) {  
                 TableColumnModel tcm = getColumnModel();  
                   
                 for(int i = 0; i < getModel().getColumnCount(); i++) {  
                         String s = prefix + ": column " + i;  
                         int w = preferences().getIntProperty(s);  
                         if(w > 0) tcm.getColumn(i).setPreferredWidth(w);  
                 }  
         }  
           
         public void  
         saveColumnWidths() { saveColumnWidths(tablePrefix); }  
           
         public void  
         saveColumnWidths(String prefix) {  
                 TableColumnModel tcm = getColumnModel();  
                   
                 for(int i = 0; i < getModel().getColumnCount(); i++) {  
                         String s = prefix + ": column " + i;  
                         preferences().setIntProperty(s, tcm.getColumn(i).getWidth());  
                 }  
         }  
           
         private JSPrefs  
         preferences() { return CC.getViewConfig().preferences(); }  
61  }  }

Legend:
Removed from v.2194  
changed lines
  Added in v.2195

  ViewVC Help
Powered by ViewVC