Skip to main content



      Home
Home » Eclipse Projects » Nebula » [PATCH] DateTimeCellEditor
[PATCH] DateTimeCellEditor [message #564523] Thu, 31 August 2006 09:38
Eclipse UserFriend
I needed to create a JFace CellEditor that uses the CDatePicker widget.

Here is the code in case someone else needs it. It is only tested on
Windows though I suppose it doesn't matter. It assumes that the values
passed are java.util.Date, under different input it will blow up with
ClassCastException. If this gets added to the CVS I'll clean it up a bit.

Jeremy please let me know if this a stupid way to do stuff.




-------------------------

import java.util.Date;

import org.aspencloud.widgets.ACW;
import org.aspencloud.widgets.cdatepicker.CDatepickerCombo;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Table;

public class DateTimeCellEditor extends CellEditor
{


Date value;
private CDatepickerCombo cdc;
private int acwstyle;
public DateTimeCellEditor(Table table2,int acwstyle)
{
super(table2);
this.acwstyle = acwstyle;
}

@Override
protected Control createControl(Composite parent)
{
Composite comp = new Composite(parent, SWT.NONE);
cdc = new CDatepickerCombo(comp, ACW.DROP_DOWN | acwstyle);
return cdc;
}

@Override
protected Object doGetValue()
{
return cdc.getCDatepicker().getSelection();
}

@Override
protected void doSetFocus()
{
cdc.setSelection(value);
cdc.popUp(true);


}

@Override
protected void doSetValue(Object theValue)
{
this.value = (Date) theValue;

}
}

------------------------------------------------------------ ---
Previous Topic:Re: Blank view when implementing CTableTree
Next Topic:embedding GEF/draw2 viewer/figures in table/tree cell
Goto Forum:
  


Current Time: Sun Jul 06 14:15:08 EDT 2025

Powered by FUDForum. Page generated in 0.05064 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top