2
Fork 0

[svn r380] added all kinds of objects

This commit is contained in:
willemc 2009-04-13 19:19:48 +02:00
parent a9520b3804
commit 37fdf22282
140 changed files with 7679 additions and 901 deletions

View file

@ -70,10 +70,14 @@ import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryExporter;
import com.idcanet.vasc.core.ui.VascColumnValueModelListener;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.frontends.swing.ui.SwingLabel;
import com.idcanet.vasc.frontends.swing.ui.SwingList;
import com.idcanet.vasc.frontends.swing.ui.SwingText;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.idcanet.vasc.frontends.swt.ui.SwtBoolean;
import com.idcanet.vasc.frontends.swt.ui.SwtButton;
import com.idcanet.vasc.frontends.swt.ui.SwtLabel;
import com.idcanet.vasc.frontends.swt.ui.SwtText;
import com.idcanet.vasc.frontends.swt.ui.SwtTextArea;
/**
*
@ -97,15 +101,15 @@ public class SwtVascFrontend extends AbstractVascFrontend {
VascFrontendData vfd = getVascEntry().getVascFrontendData();
// required UI components
vfd.putVascUIComponent(VascUIComponent.VASC_LABEL,SwingLabel.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_TEXT, SwingText.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_LIST, SwingList.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_LABEL,SwtLabel.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_TEXT, SwtText.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_BUTTON, SwtButton.class.getName());
// optional UI components
//vfd.putVascUIComponent(VascUIComponent.VASC_BOOLEAN , SwingBoolean.class.getName());
//vfd.putVascUIComponent(VascUIComponent.VASC_DATE , SwingDate.class.getName());
//vfd.putVascUIComponent(VascUIComponent.VASC_TEXTAREA, SwingTextArea.class.getName());
//vfd.putVascUIComponent(VascUIComponent.VASC_COLOR, SwingColorChooser.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_BOOLEAN , SwtBoolean.class.getName());
//vfd.putVascUIComponent(VascUIComponent.VASC_DATE , SwtDate.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_TEXTAREA, SwtTextArea.class.getName());
//vfd.putVascUIComponent(VascUIComponent.VASC_COLOR, SwtColorChooser.class.getName());
}
@ -143,7 +147,8 @@ public class SwtVascFrontend extends AbstractVascFrontend {
public void renderEdit(Object object) throws Exception {
logger.fine("Rending Edit View");
entry.getVascFrontendData().getVascFrontendHelper().initEditObject(entry, object);
object = entry.getVascFrontendData().getVascFrontendHelper().initEditObject(entry, object);
SwtVascEditDialog dialog = new SwtVascEditDialog(Display.getCurrent().getActiveShell(),object,"Vasc Edit","Edit");
Object result = dialog.open();
@ -237,7 +242,12 @@ public class SwtVascFrontend extends AbstractVascFrontend {
footer.setLayoutData(new GridData(SWT.NONE));
//createHeader(header);
createBody(body);
try {
createBody(body);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//createFooter(footer);
// should be last
@ -257,45 +267,35 @@ public class SwtVascFrontend extends AbstractVascFrontend {
return result;
}
public void createBody(Composite body) {
public void createBody(Composite body) throws Exception {
body.setLayout(new GridLayout(2, true));
body.setLayoutData(new GridData(GridData.FILL_BOTH));
for(VascEntryField c:entry.getVascEntryFields()) {
Label l = new Label(body, SWT.WRAP);
l.setText(i18n(c.getName()));
if(c.getDescription()!=null) {
l.setToolTipText(i18n(c.getDescription()));
}
try {
entry.getVascFrontendData().getVascFrontendHelper().initEditObjectColumn(c, bean);
//if(c.getVascColumnEditor()==null) {
Label valueLabel = new Label(body, SWT.WRAP);
valueLabel.setText(""+c.getVascEntryFieldValue().getValue(c, bean));
//c.setColumnEditor(valueLabel);
/*
} else {
c.setColumnEditor(c.getVascColumnEditor().createColumnEditor(c,bean,body));
}
*/
} catch (Exception e) {
logger.log(Level.WARNING,"Error making column editor: '"+c.getVascEntryFieldValue()+"' error: "+e.getMessage(),e);
}
/*
if(c.getColumnEditor() instanceof Control) {
Control editor = (Control)c.getColumnEditor();
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.FILL;
editor.setLayoutData(gridData);
}
*/
for (VascEntryField c:entry.getVascEntryFields()) {
entry.getVascFrontendData().getVascFrontendHelper().initEditObjectColumn(c, bean);
if (c.getEdit()==false) {
continue;
}
//if (c.isEditReadOnly()==true) {
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount(c);i++) {
VascUIComponent label = c.getVascEntryFieldType().provideLabelUIComponent(i,c);
VascValueModel model = new VascValueModel();
model.setValue(i18n(c.getName()));
label.createComponent(entry,c,model,body);
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c));
model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
model.addListener(new VascColumnValueModelListener(c,bean));
Object g = editor.createComponent(entry,c,model,body);
if (i==0) {
entry.getVascFrontendData().addFieldVascUIComponents(c, editor,g);
}
}
}
// create some spaceing , should replace by seperator
@ -591,6 +591,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
logger.fine("Table with columns created: "+table2.getColumnCount());
tableViewer.setInput(entry);
tableViewer.refresh();
}