Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
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. Copyright 2012-2015 the original author or authors.
package org.assertj.swing.jide.grids.driver;
import java.awt.*;
import  com.jidesoft.combobox.ListComboBox;
TODO

Author(s):
Peter Murray
public class JideTableCellReader extends BasicJTableCellReader {
  public String valueAt(JTable tableint rowint column) {
	Component c = getCellRendererIn(tablerowcolumn);
	// TODO may need to support more types of components here
	if (c instanceof ListComboBox) {
	  return valueAt((ListComboBox) c);
	}
	return super.valueAt(tablerowcolumn);
  }
  private String valueAt(ListComboBox comboBox) {
	int selectedIndex = comboBox.getSelectedIndex();
	if (selectedIndex == -1) {
	  return null;
	}
	return .valueAt(comboBoxselectedIndex);
  }

  
Should be able to do this without resorting to reflection - PM
  private Component getCellRendererIn(JTable tableint rowint column) {
	try {
	  Method m = getClass().getSuperclass().getDeclaredMethod("cellRendererIn",
		                                                      JTable.class,
		                                                      int.class,
		                                                      int.class);
	  m.setAccessible(true);
	  return (Componentm.invoke(thistablerowcolumn);
catch (NoSuchMethodException e) {
catch (InvocationTargetException e) {
catch (IllegalAccessException e) {
	}
	throw new IllegalStateException("Failed to call superclass method to resolve contents");
  }
New to GrepCode? Check out our FAQ X