Package org.dyno.visual.swing.types.editor

Source Code of org.dyno.visual.swing.types.editor.BooleanEditor

/************************************************************************************
* Copyright (c) 2008 William Chen.                                                 *
*                                                                                  *
* All rights reserved. This program and the accompanying materials are made        *
* available under the terms of the Eclipse Public License v1.0 which accompanies   *
* this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html *
*                                                                                  *
* Use is subject to the terms of Eclipse Public License v1.0.                      *
*                                                                                  *
* Contributors:                                                                    *
*     William Chen - initial API and implementation.                               *
************************************************************************************/

package org.dyno.visual.swing.types.editor;

import org.dyno.visual.swing.plugin.spi.ICellEditorFactory;
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
import org.eclipse.swt.widgets.Composite;

public class BooleanEditor implements ICellEditorFactory {
  private static final long serialVersionUID = -4403435758517308113L;

  public BooleanEditor() {
  }

 
  public CellEditor createPropertyEditor(Object bean, Composite parent) {
    return new CheckboxCellEditor(parent);
  }

 
  public Object decodeValue(Object value) {
    return value;
  }

 
  public Object encodeValue(Object value) {
    return value;
  }

 
  public String getInitJavaCode(Object value, ImportRewrite imports) {
    return null;
  }

 
  public String getJavaCode(Object value, ImportRewrite imports) {
    if(value==null)
      return "false";
    return value.toString();
  }
}

TOP

Related Classes of org.dyno.visual.swing.types.editor.BooleanEditor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.