RE: [Essentialdata-discuss] VirtualTable
Brought to you by:
dankib01
|
From: Kibler, D. (HQP) <Dan...@rh...> - 2005-06-06 20:26:55
|
Not being an RCP user, I'm not familiar with the pattern you're using. =
Are your factory classes reachable from outside the ProxyView object?
=20
In my non-RCP app, the row and header factory classes are inner classes =
of the "application" class. Also, I maintain a reference to the MROTable =
in the "application" class, so the application can manipulate it.=20
=20
Things have been pretty quiet on this list since Dave left the project, =
so don't expect a "flood" of help.
-----Original Message-----
From: ess...@li... =
[mailto:ess...@li...]On Behalf Of =
Michael Cheung
Sent: Monday, June 06, 2005 12:11 PM
To: ess...@li...
Subject: RE: [Essentialdata-discuss] VirtualTable
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,
=
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);
=
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
}
|