use of net.heartsome.cat.ts.ui.advanced.TableViewerLabelProvider in project translationstudio8 by heartsome.
the class AddOrEditSrxConfigDialog method createMapGroup.
/**
* 创建映身
* @param tparent
* ;
*/
private void createMapGroup(Composite tparent, GridData groupData, GridLayout groupLayout) {
Group group = new Group(tparent, SWT.BORDER);
group.setLayoutData(groupData);
group.setLayout(groupLayout);
group.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.group"));
mapTableViewer = new TableViewer(group, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
mapTable = mapTableViewer.getTable();
mapTable.setLinesVisible(true);
mapTable.setHeaderVisible(true);
GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).grab(true, true).applyTo(mapTable);
mapTableViewer.setLabelProvider(new TableViewerLabelProvider());
mapTableViewer.setContentProvider(new ArrayContentProvider());
String[] columnNames = new String[] { Messages.getString("srx.AddOrEditSrxConfigDialog.columnNames1"), Messages.getString("srx.AddOrEditSrxConfigDialog.columnNames2") };
int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT };
for (int i = 0; i < columnNames.length; i++) {
TableColumn tableColumn = new TableColumn(mapTable, columnAlignments[i]);
tableColumn.setText(columnNames[i]);
tableColumn.setWidth(50);
}
refreshTableWidth(mapTable);
mapAddBtn = new Button(group, SWT.NONE);
mapAddBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.mapAddBtn"));
setButtonLayoutData(mapAddBtn);
mapEditBtn = new Button(group, SWT.NONE);
mapEditBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.mapEditBtn"));
setButtonLayoutData(mapEditBtn);
mapDeleteBtn = new Button(group, SWT.NONE);
mapDeleteBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.mapDeleteBtn"));
setButtonLayoutData(mapDeleteBtn);
new Label(group, SWT.NONE);
mapTableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editMapRules();
}
});
}
use of net.heartsome.cat.ts.ui.advanced.TableViewerLabelProvider in project translationstudio8 by heartsome.
the class SrxConfigurationDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridDataFactory.fillDefaults().grab(true, true).hint(400, 400).minSize(400, 400).applyTo(tparent);
tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
table = tableViewer.getTable();
table.setLinesVisible(true);
table.setHeaderVisible(true);
GridDataFactory.fillDefaults().grab(true, true).applyTo(table);
tableViewer.setLabelProvider(new TableViewerLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
String[] columnNames = new String[] { Messages.getString("srx.SrxConfigurationDialog.columnNames1"), Messages.getString("srx.SrxConfigurationDialog.columnNames2") };
int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT };
for (int i = 0; i < columnNames.length; i++) {
TableColumn tableColumn = new TableColumn(table, columnAlignments[i]);
tableColumn.setText(columnNames[i]);
tableColumn.setWidth(50);
// 处理排序的问题
switch(i) {
case 0:
tableColumn.addSelectionListener(new SelectionAdapter() {
// 升序
boolean asc = true;
@Override
public void widgetSelected(SelectionEvent e) {
tableViewer.setSorter(asc ? XmlConvertOrder.index_ASC : XmlConvertOrder.index_DESC);
asc = !asc;
}
});
break;
case 1:
tableColumn.addSelectionListener(new SelectionAdapter() {
// 升序
boolean asc = true;
@Override
public void widgetSelected(SelectionEvent e) {
tableViewer.setSorter(asc ? XmlConvertOrder.xmlName_ASC : XmlConvertOrder.xmlName_DESC);
asc = !asc;
}
});
break;
default:
break;
}
}
tableViewer.setInput(getSRXConfigFilesInfo());
// 让列表列宽动态变化
table.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
final Table table = ((Table) event.widget);
final TableColumn[] columns = table.getColumns();
event.widget.getDisplay().syncExec(new Runnable() {
public void run() {
double[] columnWidths = new double[] { 0.1, 0.85 };
for (int i = 0; i < columns.length; i++) columns[i].setWidth((int) (table.getBounds().width * columnWidths[i]));
}
});
}
});
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editSrx();
}
});
refreshTable(null);
return tparent;
}
use of net.heartsome.cat.ts.ui.advanced.TableViewerLabelProvider in project translationstudio8 by heartsome.
the class CatalogManagerDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true);
parentData.widthHint = 700;
parentData.heightHint = 400;
tparent.setLayoutData(parentData);
tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.MULTI);
table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
GridDataFactory.fillDefaults().grab(true, true).applyTo(table);
String[] columnNames = new String[] { Messages.getString("dialogs.CatalogManagerDialog.columnNames1"), Messages.getString("dialogs.CatalogManagerDialog.columnNames2"), Messages.getString("dialogs.CatalogManagerDialog.columnNames3"), Messages.getString("dialogs.CatalogManagerDialog.columnNames4") };
int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT };
for (int i = 0; i < columnNames.length; i++) {
TableColumn tableColumn = new TableColumn(table, columnAlignments[i]);
tableColumn.setText(columnNames[i]);
tableColumn.setWidth(50);
}
tableViewer.setLabelProvider(new TableViewerLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.setInput(getCatalogValue());
// 让列表列宽动态变化
table.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
final Table table = ((Table) event.widget);
final TableColumn[] columns = table.getColumns();
event.widget.getDisplay().syncExec(new Runnable() {
public void run() {
double[] columnWidths = new double[] { 0.08, 0.15, 0.36, 0.36 };
for (int i = 0; i < columns.length; i++) columns[i].setWidth((int) (table.getBounds().width * columnWidths[i]));
}
});
}
});
return tparent;
}
use of net.heartsome.cat.ts.ui.advanced.TableViewerLabelProvider in project translationstudio8 by heartsome.
the class XmlConverterConfigurationDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridDataFactory.fillDefaults().grab(true, true).hint(400, 450).minSize(400, 450).applyTo(tparent);
tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
table = tableViewer.getTable();
table.setLinesVisible(true);
table.setHeaderVisible(true);
GridDataFactory.fillDefaults().grab(true, true).applyTo(table);
tableViewer.setLabelProvider(new TableViewerLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
String[] columnNames = new String[] { Messages.getString("dialogs.XmlConverterConfigurationDialog.columnNames1"), Messages.getString("dialogs.XmlConverterConfigurationDialog.columnNames2") };
int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT };
for (int i = 0; i < columnNames.length; i++) {
TableColumn tableColumn = new TableColumn(table, columnAlignments[i]);
tableColumn.setText(columnNames[i]);
tableColumn.setWidth(50);
// 处理排序的问题
switch(i) {
case 0:
tableColumn.addSelectionListener(new SelectionAdapter() {
// 升序
boolean asc = true;
@Override
public void widgetSelected(SelectionEvent e) {
tableViewer.setSorter(asc ? XmlConvertOrder.index_ASC : XmlConvertOrder.index_DESC);
asc = !asc;
}
});
break;
case 1:
tableColumn.addSelectionListener(new SelectionAdapter() {
// 升序
boolean asc = true;
@Override
public void widgetSelected(SelectionEvent e) {
tableViewer.setSorter(asc ? XmlConvertOrder.xmlName_ASC : XmlConvertOrder.xmlName_DESC);
asc = !asc;
}
});
break;
default:
break;
}
}
tableViewer.setInput(getXmlConfigFilesInfo());
// 让列表列宽动态变化
table.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
final Table table = ((Table) event.widget);
final TableColumn[] columns = table.getColumns();
event.widget.getDisplay().syncExec(new Runnable() {
public void run() {
double[] columnWidths = new double[] { 0.1, 0.85 };
for (int i = 0; i < columns.length; i++) columns[i].setWidth((int) (table.getBounds().width * columnWidths[i]));
}
});
}
});
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editConfigXml();
}
});
return tparent;
}
use of net.heartsome.cat.ts.ui.advanced.TableViewerLabelProvider in project translationstudio8 by heartsome.
the class AddOrEditSrxConfigDialog method createLanguageGroup.
/**
* 创建语言规则配置
* @param tparent
* ;
*/
private void createLanguageGroup(Composite tparent, GridData groupData, GridLayout groupLayout) {
Group group = new Group(tparent, SWT.BORDER);
group.setLayoutData(groupData);
group.setLayout(groupLayout);
group.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.groupLang"));
langTableViewer = new TableViewer(group, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
langTable = langTableViewer.getTable();
langTable.setLinesVisible(true);
langTable.setHeaderVisible(true);
GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).grab(true, true).applyTo(langTable);
langTableViewer.setLabelProvider(new TableViewerLabelProvider());
langTableViewer.setContentProvider(new ArrayContentProvider());
String[] columnNames = new String[] { Messages.getString("srx.AddOrEditSrxConfigDialog.langColumnNames1"), Messages.getString("srx.AddOrEditSrxConfigDialog.langColumnNames2") };
int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT };
for (int i = 0; i < columnNames.length; i++) {
TableColumn tableColumn = new TableColumn(langTable, columnAlignments[i]);
tableColumn.setText(columnNames[i]);
tableColumn.setWidth(50);
}
refreshTableWidth(langTable);
langAddBtn = new Button(group, SWT.NONE);
langAddBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langAddBtn"));
setButtonLayoutData(langAddBtn);
langEditBtn = new Button(group, SWT.NONE);
langEditBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langEditBtn"));
setButtonLayoutData(langEditBtn);
langDeleteBtn = new Button(group, SWT.NONE);
langDeleteBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langDeleteBtn"));
setButtonLayoutData(langDeleteBtn);
new Label(group, SWT.NONE);
langTableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editLangRules();
}
});
}
Aggregations