Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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. /
 
 package org.apache.cayenne.modeler.dialog.db;
 
 import java.util.List;
 
 
 import  org.apache.cayenne.merge.MergeDirection;
 import  org.apache.cayenne.merge.MergerToken;
 
 public class MergerTokenTableModel extends AbstractTableModel {
 
     public static final int COL_SELECT = 0;
     public static final int COL_DIRECTION = 1;
     public static final int COL_NAME = 2;
     public static final int COL_VALUE = 3;
 
 
     private List<MergerToken> tokens;
 
     public MergerTokenTableModel(MergerTokenSelectorController controller) {
         this. = controller;
         this. = controller.getSelectableTokens();
     }
 
         return ;
     }
 
     public Class getColumnClass(int columnIndex) {
         switch (columnIndex) {
             case :
                 return Boolean.class;
             case :
                 // TODO: correct?
                 return String.class;
             case :
             case :
                 return String.class;
         }
 
         return null;
     }
 
     public int getColumnCount() {
         return 4;
     }
 
     public String getColumnName(int columnIndex) {
         switch (columnIndex) {
             case :
                 return "";
             case :
                 return "Operation";
             case :
                 return "Direction";
             case :
                 return "";
         }
 
         return null;
     }
 
     public int getRowCount() {
         return .size();
     }
 
     public MergerToken getToken(int rowIndex) {
         return .get(rowIndex);
     }
 
     public Object getValueAt(int rowIndexint columnIndex) {
         MergerToken token = getToken(rowIndex);
         switch (columnIndex) {
             case :
                 return Boolean.valueOf(getController().isSelected(token));
             case :
                 return token.getTokenName();
             case :
                 return token.getDirection();
             case :
                return token.getTokenValue();
        }
        return null;
    }
    public boolean isCellEditable(int rowIndexint columnIndex) {
        switch (columnIndex) {
            case :
            case :
                return true;
        }
        return false;
    }
    public void setValueAt(Object valueint rowIndexint columnIndex) {
        MergerToken token = getToken(rowIndex);
        switch (columnIndex) {
            case :
                Boolean val = (Booleanvalue;
                getController().select(tokenval.booleanValue());
                break;
            case :
                MergeDirection direction = (MergeDirection) value;
                getController().setDirection(tokendirection);
                break;
        }
    }
New to GrepCode? Check out our FAQ X