2
Fork 0

[svn r262] made i18n work, added some images, made preperments for the user options

This commit is contained in:
willemc 2007-08-03 04:09:01 +02:00
parent cb8d6bc334
commit 0d5312462c
27 changed files with 468 additions and 163 deletions

View file

@ -90,6 +90,20 @@ public class SwtVascViewRenderer implements VascViewRenderer {
this.parent=parent;
}
public void initTable(VascTable table) throws Exception {
if (table.getVascViewRenderer()==null) {
table.setVascViewRenderer(this);
} else {
if (table.getVascViewRenderer()!=this) {
throw new IllegalArgumentException("VascTable has already a differtent VascViewRenderer attected");
}
}
table.getVascTableController().finalizeVascColumns(table);
table.getVascTableController().finalizeVascTable(table);
table.getVascTableController().refreshData(table);
this.table=table;
}
private static final String[] FILTER_NAMES = {
"All Files (*.*)",
"Comma Separated Values Files (*.csv)",
@ -98,7 +112,7 @@ public class SwtVascViewRenderer implements VascViewRenderer {
/** These filter extensions are used to filter which files are displayed. */
private static final String[] FILTER_EXTS = { "*.*","*.csv","*.xls" };
public void renderExport(VascTable table,VascDataExporter exporter) throws Exception {
public void renderExport(VascDataExporter exporter) throws Exception {
FileDialog dlg = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE);
dlg.setFilterNames(FILTER_NAMES);
dlg.setFilterExtensions(FILTER_EXTS);
@ -121,7 +135,7 @@ public class SwtVascViewRenderer implements VascViewRenderer {
}
}
public void renderEdit(VascTable table,Object object) throws Exception {
public void renderEdit(Object object) throws Exception {
logger.info("Rending Edit View");
table.getVascTableController().initEditObject(table, object);
@ -142,6 +156,9 @@ public class SwtVascViewRenderer implements VascViewRenderer {
public ImageDescriptor getImageDescriptor(String path) {
try {
path = table.getVascTextValue().getTextValue(path);
logger.info("Loading image: "+path);
//System.out.println("==== 1");
ImageDescriptor result = ImageDescriptor.createFromFile(path.getClass(), path);
@ -172,7 +189,7 @@ public class SwtVascViewRenderer implements VascViewRenderer {
}
}
public void renderDelete(VascTable table,Object rowBean) throws Exception {
public void renderDelete(Object rowBean) throws Exception {
}
@ -282,8 +299,9 @@ public class SwtVascViewRenderer implements VascViewRenderer {
new Label(body, SWT.WRAP);
Button saveButton = new Button(body, SWT.NONE);
saveButton.setImage(getImageDescriptor("/META-INF/images/silk/png/tick.png").createImage());
saveButton.setText("generic.save");
saveButton.setImage(getImageDescriptor("vasc.dialog.save.image").createImage());
saveButton.setText(table.getVascTextValue().getTextValue("vasc.dialog.save.name"));
saveButton.setToolTipText(table.getVascTextValue().getTextValue("vasc.dialog.save.tooltip"));
saveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//if(hasRecordError()) {
@ -294,8 +312,9 @@ public class SwtVascViewRenderer implements VascViewRenderer {
}
});
Button cancelButton = new Button(body, SWT.NONE);
cancelButton.setImage(getImageDescriptor("/META-INF/images/silk/png/cancel.png").createImage());
cancelButton.setText("generic.cancel");
cancelButton.setImage(getImageDescriptor("vasc.dialog.cancel.image").createImage());
cancelButton.setText(table.getVascTextValue().getTextValue("vasc.dialog.cancel.name"));
cancelButton.setToolTipText(table.getVascTextValue().getTextValue("vasc.dialog.cancel.tooltip"));
cancelButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
result = null;
@ -345,21 +364,7 @@ public class SwtVascViewRenderer implements VascViewRenderer {
}
public void renderView(VascTable table) throws Exception {
if (table.getVascViewRenderer()==null) {
table.setVascViewRenderer(this);
} else {
if (table.getVascViewRenderer()!=this) {
throw new IllegalArgumentException("VascTable has already a differtent VascViewRenderer attected");
}
}
table.getVascTableController().finalizeVascColumns(table);
table.getVascTableController().finalizeVascTable(table);
table.getVascTableController().refreshData(table);
this.table=table;
public void renderView() throws Exception {
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
@ -424,8 +429,8 @@ public class SwtVascViewRenderer implements VascViewRenderer {
ToolBar toolBar = new ToolBar(headerBar, SWT.NONE);
for (GlobalVascAction action:table.getGlobalActions()) {
ToolItem item = new ToolItem(toolBar, SWT.PUSH);
item.setText(action.getName());
item.setToolTipText(action.getToolTip());
item.setText(table.getVascTextValue().getTextValue(action.getName()));
item.setToolTipText(table.getVascTextValue().getTextValue(action.getToolTip()));
if (action.getImage()!=null) {
item.setImage(getImageDescriptor(action.getImage()).createImage());
}
@ -438,6 +443,7 @@ public class SwtVascViewRenderer implements VascViewRenderer {
if(table.getHeaderName()!=null) {
Font headerFont = new Font(header.getDisplay(), "verdana", 16, SWT.BOLD);
Label l = new Label(headerName, SWT.CENTER);
l.setImage(getImageDescriptor(table.getHeaderImage()).createImage());
l.setFont(headerFont);
l.setText(table.getVascTextValue().getTextValue(table.getHeaderName()));
l.setBackground(c);
@ -596,8 +602,8 @@ public class SwtVascViewRenderer implements VascViewRenderer {
logger.finest("Creating footer");
for(RowVascAction action:table.getRowActions()) {
Button actionButton = new Button(footer, SWT.NONE);
actionButton.setText(action.getName());
actionButton.setToolTipText(action.getToolTip());
actionButton.setText(table.getVascTextValue().getTextValue(action.getName()));
actionButton.setToolTipText(table.getVascTextValue().getTextValue(action.getToolTip()));
if (action.getImage()!=null) {
actionButton.setImage(getImageDescriptor(action.getImage()).createImage());
}