本文整理匯總了Java中org.eclipse.swt.custom.TableEditor類的典型用法代碼示例。如果您正苦於以下問題:Java TableEditor類的具體用法?Java TableEditor怎麽用?Java TableEditor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TableEditor類屬於org.eclipse.swt.custom包,在下文中一共展示了TableEditor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addSelectionListeneronToFontButton
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
private void addSelectionListeneronToFontButton(Button fontButton, TableEditor fontEditor) {
fontButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String fontdata = "";
dialog = new FontDialog(Display.getCurrent().getActiveShell(), SWT.NONE);
dialog.setText("Select Font");
String string = formatMap.get(excelFormats[4]);
fontdata = checkDefaultValue(fontEditor, fontdata, string);
RGB checkDefaultColor = checkDefaultColor(fontdata, string);
dialog.setRGB(checkDefaultColor);
FontData defaultFont = new FontData(fontdata);
dialog.setFontData(defaultFont);
FontData newFont = dialog.open();
RGB rgb = dialog.getRGB();
String convertRGBToHEX = convertRGBToHEX(rgb);
if (newFont != null) {
fontEditor.getItem().setText(1, newFont.toString() + "|" + convertRGBToHEX);
}
}
});
}
示例2: addSelectionListeneronButton
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
private void addSelectionListeneronButton(Button button, TableEditor editor) {
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ColorDialog dlg = new ColorDialog(Display.getCurrent().getActiveShell());
dlg.setRGB(new RGB(0, 0, 0));
RGB rgb = dlg.open();
if (rgb != null) {
Color color = new Color(shell.getDisplay(), rgb);
String colorValue = convertRGBToHEX(rgb);
editor.getItem().setText(1, colorValue);
color.dispose();
}
}
});
}
示例3: addTextBoxInTable
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
private Text addTextBoxInTable(TableViewer tableViewer, TableItem tableItem, String textBoxName,
String valueTextPane, String editorName, int columnIndex, Listener listener) {
final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
buttonPane.setLayout(new FillLayout());
final Text text = new Text(buttonPane, SWT.NONE);
text.addListener(SWT.Modify, listener);
text.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
tableItem.setData(textBoxName, text);
tableItem.setData(valueTextPane, buttonPane);
//text.addModifyListener(FilterHelper.INSTANCE.getTextModifyListener());
final TableEditor editor = new TableEditor(tableViewer.getTable());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.setEditor(buttonPane, tableItem, columnIndex);
editor.layout();
text.setData(editorName, editor);
return text;
}
示例4: addComboInTable
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
private CCombo addComboInTable(TableViewer tableViewer, TableItem tableItem, String comboName, String comboPaneName,
String editorName, int columnIndex, String[] relationalOperators, SelectionListener dropDownSelectionListener,
ModifyListener modifyListener,FocusListener focusListener) {
final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
buttonPane.setLayout(new FillLayout());
final CCombo combo = new CCombo(buttonPane, SWT.NONE);
combo.setItems(relationalOperators);
combo.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
tableItem.setData(comboName, combo);
tableItem.setData(comboPaneName, buttonPane);
combo.addSelectionListener(dropDownSelectionListener);
combo.addModifyListener(modifyListener);
combo.addFocusListener(focusListener);
new AutoCompleteField(combo, new CComboContentAdapter(), combo.getItems());
final TableEditor editor = new TableEditor(tableViewer.getTable());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.setEditor(buttonPane, tableItem, columnIndex);
editor.layout();
combo.setData(editorName, editor);
return combo;
}
示例5: addButtonInTable
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
private void addButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName,
String buttonPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener,
ImagePathConstant imagePath) {
final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
buttonPane.setLayout(new FillLayout());
final Button button = new Button(buttonPane, SWT.NONE);
//button.setText(columnName);
button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
tableItem.setData(columnName, button);
tableItem.setData(buttonPaneName, buttonPane);
button.addSelectionListener(buttonSelectionListener);
button.setImage(imagePath.getImageFromRegistry());
final TableEditor editor = new TableEditor(tableViewer.getTable());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.setEditor(buttonPane, tableItem, columnIndex);
editor.layout();
button.setData(editorName, editor);
}
示例6: addCheckButtonInTable
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
private void addCheckButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName,
String groupPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener) {
final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
buttonPane.setLayout(new FillLayout());
final Button button = new Button(buttonPane, SWT.CHECK);
button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
if(null != buttonSelectionListener){
button.addSelectionListener(buttonSelectionListener);
}
tableItem.setData(columnName, button);
tableItem.setData(groupPaneName, buttonPane);
final TableEditor editor = new TableEditor(tableViewer.getTable());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.setEditor(buttonPane, tableItem, columnIndex);
editor.layout();
button.setData(editorName, editor);
}
示例7: perfomeOK
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
protected void perfomeOK() {
final int index = columnCombo.getSelectionIndex();
if (index < columnComboInfo.complexUniqueKeyStartIndex) {
referenceForPK = true;
} else if (index < columnComboInfo.columnStartIndex) {
final ComplexUniqueKey complexUniqueKey = source.getComplexUniqueKeyList().get(index - columnComboInfo.complexUniqueKeyStartIndex);
referencedComplexUniqueKey = complexUniqueKey;
} else {
referencedColumn = columnComboInfo.candidateColumns.get(index - columnComboInfo.columnStartIndex);
}
for (final TableEditor tableEditor : tableEditorList) {
final NormalColumn foreignKeyColumn = getSelectedColumn(tableEditor);
foreignKeyColumnList.add(foreignKeyColumn);
}
}
示例8: getSelectedColumn
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
private NormalColumn getSelectedColumn(final TableEditor tableEditor) {
final Combo foreignKeyCombo = (Combo) tableEditor.getEditor();
final int foreignKeyComboIndex = foreignKeyCombo.getSelectionIndex();
int startIndex = 1;
NormalColumn foreignKeyColumn = null;
final List<NormalColumn> foreignKeyList = editorReferencedMap.get(tableEditor);
if (foreignKeyList != null) {
if (foreignKeyComboIndex <= foreignKeyList.size()) {
foreignKeyColumn = foreignKeyList.get(foreignKeyComboIndex - startIndex);
} else {
startIndex += foreignKeyList.size();
}
}
if (foreignKeyColumn == null) {
foreignKeyColumn = candidateForeignKeyColumns.get(foreignKeyComboIndex - startIndex);
}
return foreignKeyColumn;
}
示例9: getErrorMessage
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
@Override
protected String getErrorMessage() {
final Set<NormalColumn> selectedColumns = new HashSet<NormalColumn>();
for (final TableEditor tableEditor : tableEditorList) {
final Combo foreignKeyCombo = (Combo) tableEditor.getEditor();
final int index = foreignKeyCombo.getSelectionIndex();
if (index == 0) {
return "error.foreign.key.not.selected";
}
final NormalColumn selectedColumn = getSelectedColumn(tableEditor);
if (selectedColumns.contains(selectedColumn)) {
return "error.foreign.key.must.be.different";
}
selectedColumns.add(selectedColumn);
}
if (existForeignKeySet(selectedColumns)) {
return "error.foreign.key.already.exist";
}
return null;
}
示例10: edit
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
private void edit(final TableItem item, final TableEditor tableEditor) {
final Text text = new Text(table, SWT.NONE);
text.setText(item.getText(targetColumn));
text.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(final FocusEvent e) {
item.setText(targetColumn, text.getText());
text.dispose();
}
});
tableEditor.setEditor(text, item, targetColumn);
text.setFocus();
text.selectAll();
}
示例11: restruct
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
@Override
public void restruct() {
columnTable.removeAll();
disposeTableEditor();
for (final NormalColumn normalColumn : copyData.getNormalColumns()) {
final TableItem tableItem = new TableItem(columnTable, SWT.NONE);
final TableEditor tableEditor = CompositeFactory.createCheckBoxTableEditor(tableItem, false, 0);
tableEditorList.add(tableEditor);
editorColumnMap.put(tableEditor, normalColumn);
tableItem.setText(1, Format.null2blank(normalColumn.getName()));
}
setComboData();
setButtonStatus(false);
nameText.setText("");
columnTable.getColumns()[1].pack();
}
示例12: setTableEditor
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
private void setTableEditor(final NormalColumn normalColumn, final TableItem tableItem, final Boolean desc) {
final Button descCheckButton = new Button(indexColumnList, SWT.CHECK);
descCheckButton.pack();
if (DBManagerFactory.getDBManager(table.getDiagram()).isSupported(DBManager.SUPPORT_DESC_INDEX)) {
final TableEditor editor = new TableEditor(indexColumnList);
editor.minimumWidth = descCheckButton.getSize().x;
editor.horizontalAlignment = SWT.CENTER;
editor.setEditor(descCheckButton, tableItem, 1);
columnCheckMap.put(normalColumn, editor);
}
descCheckBoxMap.put(normalColumn, descCheckButton);
descCheckButton.setSelection(desc.booleanValue());
}
示例13: initNodeTable
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
private void initNodeTable() {
nodeTable.removeAll();
nodeCheckMap = new HashMap<NodeElement, TableEditor>();
for (final NodeElement nodeElement : diagram.getDiagramContents().getContents()) {
final TableItem tableItem = new TableItem(nodeTable, SWT.NONE);
final Button selectCheckButton = new Button(nodeTable, SWT.CHECK);
selectCheckButton.pack();
final TableEditor editor = new TableEditor(nodeTable);
editor.minimumWidth = selectCheckButton.getSize().x;
editor.horizontalAlignment = SWT.CENTER;
editor.setEditor(selectCheckButton, tableItem, 0);
tableItem.setText(1, ResourceString.getResourceString("label.object.type." + nodeElement.getObjectType()));
tableItem.setText(2, Format.null2blank(nodeElement.getName()));
nodeCheckMap.put(nodeElement, editor);
}
}
示例14: createCheckBoxTableEditor
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
public static TableEditor createCheckBoxTableEditor(TableItem tableItem,
boolean selection, int column) {
Table table = tableItem.getParent();
final Button checkBox = new Button(table, SWT.CHECK);
checkBox.pack();
TableEditor editor = new TableEditor(table);
editor.minimumWidth = checkBox.getSize().x;
editor.horizontalAlignment = SWT.CENTER;
editor.setEditor(checkBox, tableItem, column);
checkBox.setSelection(selection);
return editor;
}
示例15: RelationByExistingColumnsDialog
import org.eclipse.swt.custom.TableEditor; //導入依賴的package包/類
public RelationByExistingColumnsDialog(Shell parentShell, ERTable source,
List<NormalColumn> candidateForeignKeyColumns,
Map<NormalColumn, List<NormalColumn>> referencedMap,
Map<Relation, Set<NormalColumn>> foreignKeySetMap) {
super(parentShell);
this.source = source;
this.referencedColumnList = new ArrayList<NormalColumn>();
this.foreignKeyColumnList = new ArrayList<NormalColumn>();
this.candidateForeignKeyColumns = candidateForeignKeyColumns;
this.referencedMap = referencedMap;
this.foreignKeySetMap = foreignKeySetMap;
this.tableEditorList = new ArrayList<TableEditor>();
this.editorReferencedMap = new HashMap<TableEditor, List<NormalColumn>>();
}