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.editor;
 
 import java.util.List;
 
 import  org.apache.cayenne.map.CallbackDescriptor;
 import  org.apache.cayenne.map.ObjEntity;
 import  org.apache.cayenne.map.event.MapEvent;
Table model for displaying methods list for a particular CallbackDescriptor

Version:
1.0 Oct 23, 2007
 
     private static final int COLUMN_COUNT = 1;
     public static final int METHOD_NAME = 0;
     protected ObjEntity entity;
     protected CallbackDescriptor callbackDescriptor;

    
constructor

Parameters:
mediator mediator instance
eventSource event source
objectList default objects list
callbackDescriptor callback descriptor instance
 
             ProjectController mediator,
             Object eventSource,
             List objectList,
             CallbackDescriptor callbackDescriptor) {
         super(mediatoreventSourceobjectList);
         this. = callbackDescriptor;
     }

    
does nothing

Parameters:
newVal newVal
row row
col col
 
     public void setUpdatedValueAt(Object newValint rowint col) {
         //do nothing
     }

    
Returns Java class of the internal list elements.
 
     public Class getElementsClass() {
         return String.class;
     }

    

Parameters:
rowIndex method index
Returns:
callback method for the specified index
 
     public String getCallbackMethod(int rowIndex) {
         return (String.get(rowIndex);
     }

    
Returns the number of columns in the model. A JTable uses this method to determine how many columns it should create and display by default.

Returns:
the number of columns in the model
See also:
getRowCount
 
     public int getColumnCount() {
         return ;
     }


    
Returns the value for the cell at columnIndex and rowIndex.

Parameters:
rowIndex the row whose value is to be queried
columnIndex the column whose value is to be queried
Returns:
the value Object at the specified cell
    public Object getValueAt(int rowIndexint columnIndex) {
        switch (columnIndex) {
            case :
                return getCallbackMethod(rowIndex);
        }
        return null;
    }

    
sorting disabled
    protected void orderList() {
        // NOOP
    }

    

Parameters:
column column index
Returns:
column name
    public String getColumnName(int column) {
        switch (column) {
            case :
                return "Method";
        }
        return null;
    }

    
all cells are editable

Parameters:
rowIndex row index
columnIndex column index
Returns:
true
    public boolean isCellEditable(int rowIndexint columnIndex) {
        return true;
    }

    
stores edited value

Parameters:
newVal new value
row row
col column
    public void setValueAt(Object newValint rowint col) {
        String method = (StringnewVal;
        if (method != null) {
            method = method.trim();
        }
        String prevMethod = (StringgetObjectList().get(row);
        if (method != null && method.length() > 0) {
            //check that method changed and name is not duplicate
            if (!method.equals(prevMethod) &&
                !getCallbackDescriptor().getCallbackMethods().contains(method)) {
                //update model
                getObjectList().set(rowmethod);
                //update entity
                getCallbackDescriptor().setCallbackMethodAt(rowmethod);
                fireTableRowsUpdated(rowrow);
                .fireCallbackMethodEvent(new CallbackMethodEvent(
                        ,
                        prevMethod,
                        method,
                        MapEvent.CHANGE
                ));
            }
        }
    }

    

Returns:
CallbackDescriptor of the model
    public CallbackDescriptor getCallbackDescriptor() {
        return ;
    }
New to GrepCode? Check out our FAQ X