Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014 the RoboWorkshop Project
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 /*
  * AnimationTable.java
  *
  * Created on Feb 16, 2011, 2:31:52 AM
  */
 
 package org.rwshop.swing.animation.table.animation;
 
 
 import static org.jflux.api.common.rk.localization.Localizer.$;

Author(s):
Matthew Stevenson <www.roboworkshop.org>
 
 public class AnimationTable extends javax.swing.JPanel {
     private AnimationTableModel myTableModel;
     private AnimationEditor myController;

    
Creates new form AnimationTable
 
     public AnimationTable() {
         initComponents();
          = new AnimationTableModel();
         .setModel();
 
 
 
          = new AnimationTableListener();
         .setTable();
 
          = new AnimationTableLayoutListener();
         //setTableHeader($("animation.channels"));
         .setBorder(new EmptyBorder(0, 0, 0, 0));
     }

    

Parameters:
controller
 
     public void setController(AnimationEditor controller){
         if( == controller){
             return;
         }
          = controller;
         .cleanConsumer();
 
 
         if( != null){
             .addConsumer();
             for(ChannelEditor cc : .getChildren()){
                 cc.addConsumer();
             }
        }
        
        setTableLayout();
    }
    private void setTableLayout(){
        Icon[] i = SettingsRepository.getAnimationTableIcons();
        TableColumn colEnabled = .getColumn("Enabled");
        TableHelper.setColumnCheckBoxIcons(colEnablednullnull$("enable.channel"));
        TableColumn colLocked = .getColumn("Locked");
        TableHelper.setColumnCheckBoxIcons(colLockedi[0], i[1], $("lock.channel"));
        TableColumn colVis = .getColumn("Visible");
        TableHelper.setColumnCheckBoxIcons(colVisi[2], i[3], $("show.channel"));
        TableColumn colColor = .getColumn("Color");
        colColor.setCellRenderer(new ColorRenderer());
        colColor.setCellEditor(new ColorEditor());
    }
    
    
    public void hideHeader(){
        .setTableHeader(null);
    }

    

Parameters:
name
    public void setTableHeader(String name) {
        JTableHeader th = .getTableHeader();
        TableColumnModel tcm = new DefaultTableColumnModel();
        TableColumn tc = new TableColumn();
        tcm.addColumn(tc);
        th.setColumnModel(tcm);
        tc.setHeaderValue(name);
        tc.setWidth(.getWidth());
    }

    
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
         = new javax.swing.JScrollPane();
         = new javax.swing.JTable();
            new Object [][] {
                {null},
                {null}
            },
            new String [] {
                "nulldf"
            }
        ));
        .setShowVerticalLines(false);
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
        );
        layout.setVerticalGroup(
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTable myTable;
    // End of variables declaration//GEN-END:variables
New to GrepCode? Check out our FAQ X