RE: [Essentialdata-discuss] VirtualTable
Brought to you by:
dankib01
|
From: Michael C. <mc...@eq...> - 2005-06-06 19:10:58
|
The code is exactly the same in the MROTable, however they are referring
to the Model object.
=20
If you can able to use it in RCP, I would love to see some examples.
=20
I get a "Widget is disposed" exception, and for almost 2 days I haven't
been able to figure it out. There are no examples of using RCP with
MROTable. This is my code
=20
import java.util.ArrayList;
import java.util.List;
=20
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;
=20
import com.swtworkbench.ed.aware.model.IObjectFactory;
import com.swtworkbench.ed.aware.model.NewObject;
import com.swtworkbench.ed.controls.mrotable.IPartControlFactory;
import com.swtworkbench.ed.controls.mrotable.MROTable;
import com.swtworkbench.ed.controls.mrotable.TableLayout;
=20
public class ProxyView extends ViewPart {
=20
List<Employee> employees;
=20
public List<Employee> getEmployee() {
return employees;
}
=20
public void initData() {
employees =3D new ArrayList<Employee>();
employees.add(new Employee("123-11-1234"));
employees.add(new Employee("123-11-1235"));
}
=20
private int[] getColumnWeights() {
return new int[] {10};
}
=20
private class HeaderFactory implements IPartControlFactory {
public Composite createPartControl(Composite parent) {
Composite part =3D new Composite(parent, SWT.NULL);
part.setLayout(new TableLayout(getColumnWeights(),
SWT.CENTER,
=20
Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY)));
=20
new Label(part, SWT.RIGHT).setText("SSN");
=20
return part;
}
}
=20
private class RowFactory implements IPartControlFactory {
public Composite createPartControl(Composite parent) {
// The row Composite
Composite part =3D new Composite(parent, SWT.NULL);
=20
part.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE))
;
part.setLayout(new TableLayout(getColumnWeights(),
SWT.BORDER));
=20
// The actual SWT editor objects
new Text(part, SWT.RIGHT).setData("boundTo", "SSN");
=20
return part;
}
}
=20
public void createPartControl(Composite parent) {
initData();
=20
MROTable table =3D new MROTable(parent, SWT.BORDER);
table.setHeaderFactory(new HeaderFactory());
=20
try {
table.edit(this, "Employee", new RowFactory());
} catch (Exception e) {
} =20
}
=20
public void setFocus() {
=20
}
=20
}
|