List of usage examples for org.eclipse.jface.viewers TableViewerColumn TableViewerColumn
public TableViewerColumn(TableViewer viewer, TableColumn column)
From source file:com.hangum.tadpole.rdb.core.dialog.dml.TableInformationDialog.java
License:Open Source License
/** * Create contents of the dialog./*from ww w .j a v a2 s .c o m*/ * * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); GridLayout gridLayout = (GridLayout) container.getLayout(); gridLayout.verticalSpacing = 2; gridLayout.horizontalSpacing = 2; gridLayout.marginHeight = 2; gridLayout.marginWidth = 2; Composite compositeBody = new Composite(container, SWT.NONE); GridLayout gl_compositeBody = new GridLayout(1, false); gl_compositeBody.verticalSpacing = 2; gl_compositeBody.horizontalSpacing = 2; gl_compositeBody.marginHeight = 2; gl_compositeBody.marginWidth = 2; compositeBody.setLayout(gl_compositeBody); compositeBody.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Composite compositeTable = new Composite(compositeBody, SWT.NONE); compositeTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); compositeTable.setLayout(new GridLayout(2, false)); lblTableName = new Label(compositeTable, SWT.NONE); lblTableName.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1)); lblTableName.setText(SQLUtil.getTableName(userDB, tableDAO)); textTBNameCmt = new Text(compositeTable, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI); GridData gd_textTBNameCmt = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_textTBNameCmt.heightHint = 33; textTBNameCmt.setLayoutData(gd_textTBNameCmt); textTBNameCmt.setText(tableDAO.getComment()); SashForm sashFormData = new SashForm(compositeBody, SWT.VERTICAL); sashFormData.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tableViewer = new TableViewer(sashFormData, SWT.BORDER | SWT.FULL_SELECTION); tableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { IStructuredSelection is = (IStructuredSelection) event.getSelection(); if (!is.isEmpty()) { ExtendTableColumnDAO tableDAO = (ExtendTableColumnDAO) is.getFirstElement(); FindEditorAndWriteQueryUtil.runAtPosition(String.format("%s, ", tableDAO.getName())); } } }); Table table = tableViewer.getTable(); table.setLinesVisible(true); table.setHeaderVisible(true); TableViewerColumn tvColumnName = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn tcColumnName = tvColumnName.getColumn(); tcColumnName.setWidth(150); tcColumnName.setText(Messages.get().ColumnName); // tvColumnName.setEditingSupport(new // DMLColumnEditingSupport(tableViewer, 0, this)); TableViewerColumn tvColumnDataType = new TableViewerColumn(tableViewer, SWT.LEFT); TableColumn tcDataType = tvColumnDataType.getColumn(); tcDataType.setWidth(100); tcDataType.setText(Messages.get().DataType); TableViewerColumn tvColumnKey = new TableViewerColumn(tableViewer, SWT.CENTER); TableColumn tcKey = tvColumnKey.getColumn(); tcKey.setWidth(50); tcKey.setText(Messages.get().Key); TableViewerColumn tvColumnCmt = new TableViewerColumn(tableViewer, SWT.LEFT); TableColumn tcCmt = tvColumnCmt.getColumn(); tcCmt.setWidth(300); tcCmt.setText(CommonMessages.get().Description); tableViewer_ext = new TableViewer(sashFormData, SWT.BORDER | SWT.FULL_SELECTION); Table table_ext = tableViewer_ext.getTable(); table_ext.setLinesVisible(true); table_ext.setHeaderVisible(true); TableViewerColumn tvPropertyName = new TableViewerColumn(tableViewer_ext, SWT.NONE); TableColumn tcPropertyName = tvPropertyName.getColumn(); tcPropertyName.setWidth(180); tcPropertyName.setText("Property"); TableViewerColumn tvPropertyValue = new TableViewerColumn(tableViewer_ext, SWT.NONE); TableColumn tcPropertyValue = tvPropertyValue.getColumn(); tcPropertyValue.setWidth(300); tcPropertyValue.setText("Value"); //DefaultViewerSorter sorterMessage = new DefaultViewerSorter(); tableViewer_ext.setContentProvider(new ArrayContentProvider()); tableViewer_ext.setLabelProvider(new TableStatisticsLabelProvider()); tableViewer.setContentProvider(new ArrayContentProvider()); tableViewer.setLabelProvider(new TableInformationLabelProvider()); sashFormData.setWeights(new int[] { 6, 4 }); initData(); //tableViewer_ext.setComparator(new BasicViewerSorter()); initExtendedData(); // google analytic AnalyticCaller.track(this.getClass().getName()); return container; }
From source file:com.hangum.tadpole.rdb.core.dialog.editor.RDBShortcutHelpDialog.java
License:Open Source License
/** * Create contents of the dialog./*from w w w .j av a 2s. c o m*/ */ public void createContents() { shlEditorShortcutDialog = new Shell(getParent(), SWT.CLOSE | SWT.APPLICATION_MODAL); shlEditorShortcutDialog.setSize(240, 300); // shlEditorShortcutDialog.setText("Editor Shortcut Dialog"); shlEditorShortcutDialog.setLayout(new GridLayout(1, false)); // shell? ? ? ?? . Shell mainShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); int x = mainShell.getSize().x; int y = mainShell.getSize().y; // shell location shlEditorShortcutDialog.setLocation(x - 240, y - 300); tableViewer = new TableViewer(shlEditorShortcutDialog, SWT.BORDER | SWT.FULL_SELECTION); Table table = tableViewer.getTable(); table.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent event) { // // orionhub editor ? ? ? . ?... // //System.out.println("====== focus out ========================="); } }); table.setHeaderVisible(true); table.setLinesVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn tblclmnDescription = tableViewerColumn.getColumn(); tblclmnDescription.setWidth(100); tblclmnDescription.setText("Description"); TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn tblclmnKey = tableViewerColumn_1.getColumn(); tblclmnKey.setWidth(120); tblclmnKey.setText("Key"); tableViewer.setContentProvider(new ArrayContentProvider()); tableViewer.setLabelProvider(new ShortcutLabelProvider()); tableViewer.setInput(listShortcut); initData(); // tableViewer.getTable().setSelection(0);//setSelection(new StructuredSelection(listShortcut.get(0)), true); tableViewer.getTable().setFocus(); }
From source file:com.hangum.tadpole.rdb.core.dialog.editor.ShortcutHelpDialog.java
License:Open Source License
/** * Create contents of the dialog./*from ww w .ja va 2s. com*/ */ private void createContents() { shlEditorShortcutDialog = new Shell(getParent(), SWT.CLOSE | SWT.APPLICATION_MODAL); shlEditorShortcutDialog.setSize(240, 300); // shlEditorShortcutDialog.setText("Editor Shortcut Dialog"); shlEditorShortcutDialog.setLayout(new GridLayout(1, false)); // shell? ? ? ?? . Shell mainShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); int x = mainShell.getSize().x; int y = mainShell.getSize().y; // shell location shlEditorShortcutDialog.setLocation(x - 240, y - 300); tableViewer = new TableViewer(shlEditorShortcutDialog, SWT.BORDER | SWT.FULL_SELECTION); Table table = tableViewer.getTable(); table.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent event) { // // orionhub editor ? ? ? . ?... // //System.out.println("====== focus out ========================="); } }); table.setHeaderVisible(true); table.setLinesVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn tblclmnDescription = tableViewerColumn.getColumn(); tblclmnDescription.setWidth(100); tblclmnDescription.setText("Description"); TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn tblclmnKey = tableViewerColumn_1.getColumn(); tblclmnKey.setWidth(120); tblclmnKey.setText("Key"); tableViewer.setContentProvider(new ArrayContentProvider()); tableViewer.setLabelProvider(new ShortcutLabelProvider()); tableViewer.setInput(listShortcut); initData(); // tableViewer.getTable().setSelection(0);//setSelection(new StructuredSelection(listShortcut.get(0)), true); tableViewer.getTable().setFocus(); }
From source file:com.hangum.tadpole.rdb.core.dialog.export.sqltoapplication.composites.axisj.AxisjComposite.java
License:Open Source License
private void createTaleColumn() { for (int i = 0; i < AxisjConsts.sizes.length; i++) { TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn tblclmnColumnName = tableViewerColumn.getColumn(); tblclmnColumnName.setWidth(AxisjConsts.sizes[i]); tblclmnColumnName.setText(AxisjConsts.names[i]); //tableViewerColumn.setLabelProvider(labelProvider); tableViewerColumn.setEditingSupport(new AxisjEditingSupport(tableViewer, i)); }/* w w w .j a v a 2s . c om*/ }
From source file:com.hangum.tadpole.rdb.core.dialog.resource.ResourceDetailDialog.java
License:Open Source License
/** * Create contents of the dialog.// ww w .ja va 2s .com * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); GridLayout gridLayout = (GridLayout) container.getLayout(); gridLayout.verticalSpacing = 5; gridLayout.horizontalSpacing = 5; gridLayout.marginHeight = 5; gridLayout.marginWidth = 5; Composite compositeHead = new Composite(container, SWT.NONE); compositeHead.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); compositeHead.setLayout(new GridLayout(3, false)); Label lblTitle = new Label(compositeHead, SWT.NONE); lblTitle.setText(Messages.get().Title); textTitle = new Text(compositeHead, SWT.BORDER | SWT.READ_ONLY); textTitle.setEditable(true); textTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textTitle.setText(resourceManagerDao.getName()); new Label(compositeHead, SWT.NONE); Label lblDescription = new Label(compositeHead, SWT.NONE); lblDescription.setText(Messages.get().Description); textDescription = new Text(compositeHead, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI); textDescription.setEditable(true); GridData gd_textDescription = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_textDescription.heightHint = 40; textDescription.setLayoutData(gd_textDescription); textDescription.setText(resourceManagerDao.getDescription()); Button btnModify = new Button(compositeHead, SWT.NONE); btnModify.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if ("".equals(textTitle.getText().trim())) { MessageDialog.openWarning(getShell(), Messages.get().Warning, Messages.get().ResourceDetailDialog_name_empty); textTitle.setFocus(); return; } if (MessageDialog.openConfirm(getShell(), Messages.get().Confirm, Messages.get().ResourceDetailDialog_delete)) { resourceManagerDao.setName(textTitle.getText()); resourceManagerDao.setDescription(textDescription.getText()); try { TadpoleSystem_UserDBResource.userDbResourceHeadUpdate(resourceManagerDao); // tree refresh if (originalResourceDB != null) { originalResourceDB.setName(textTitle.getText()); originalResourceDB.setDescription(textDescription.getText()); ManagerViewer mv = (ManagerViewer) PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().showView(ManagerViewer.ID); mv.refreshResource(originalResourceDB); } } catch (Exception ee) { logger.error("Resource title, desc saveing", ee); MessageDialog.openError(getShell(), Messages.get().Confirm, "Save exception." + ee.getMessage()); } } } }); btnModify.setText(Messages.get().Modified); Composite compositeHeaderUser = new Composite(compositeHead, SWT.NONE); compositeHeaderUser.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); compositeHeaderUser.setLayout(new GridLayout(4, false)); Label lblUser = new Label(compositeHeaderUser, SWT.NONE); lblUser.setText(Messages.get().User); textUser = new Text(compositeHeaderUser, SWT.BORDER | SWT.READ_ONLY); textUser.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textUser.setText(resourceManagerDao.getUser_name()); Label lblCreateTime = new Label(compositeHeaderUser, SWT.NONE); lblCreateTime.setText(Messages.get().CreatTime); textCreateTime = new Text(compositeHeaderUser, SWT.BORDER | SWT.READ_ONLY); textCreateTime.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textCreateTime.setText(resourceManagerDao.getCreate_time()); SashForm sashForm = new SashForm(container, SWT.BORDER | SWT.VERTICAL); sashForm.setLayout(new GridLayout(1, false)); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tvHistory = new TableViewer(sashForm, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); tvHistory.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { StructuredSelection sss = (StructuredSelection) tvHistory.getSelection(); if (sss.isEmpty()) return; UserDBResourceDataDAO userDBResource = (UserDBResourceDataDAO) sss.getFirstElement(); compareWidget.changeDiff(userDBResource.getDatas(), ""); } }); Table table = tvHistory.getTable(); table.setLinesVisible(true); table.setHeaderVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableViewerColumn tvcDate = new TableViewerColumn(tvHistory, SWT.NONE); TableColumn tblclmnDate = tvcDate.getColumn(); tblclmnDate.setWidth(100); tblclmnDate.setText(Messages.get().Date); TableViewerColumn tvcUser = new TableViewerColumn(tvHistory, SWT.NONE); TableColumn tblclmnUser = tvcUser.getColumn(); tblclmnUser.setWidth(100); tblclmnUser.setText(Messages.get().User); TableViewerColumn tvcSQL = new TableViewerColumn(tvHistory, SWT.NONE); TableColumn tblclmnSql = tvcSQL.getColumn(); tblclmnSql.setWidth(500); tblclmnSql.setText(Messages.get().SQL); tvHistory.setContentProvider(new ArrayContentProvider()); tvHistory.setLabelProvider(new ResourceHistoryLabelProvider()); // SashForm compositeCompare = new SashForm(sashForm, SWT.NONE); // compositeCompare.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); // compositeCompare.setLayout(new GridLayout(2, false)); compareWidget = new TadpoleCompareWidget(sashForm, SWT.BORDER); compareWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); // textLeft = new TadpoleEditorWidget(compositeCompare, SWT.BORDER, EditorDefine.EXT_DEFAULT, "", ""); // textLeft.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); // // textRight = new TadpoleEditorWidget(compositeCompare, SWT.BORDER, EditorDefine.EXT_DEFAULT, "", ""); // textRight.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); sashForm.setWeights(new int[] { 6, 4 }); initUIData(); return container; }
From source file:com.hangum.tadpole.rdb.core.editors.dbinfos.composites.PropertyComposite.java
License:Open Source License
/** * Build real columns with attributes. * //from w w w .java2 s . c o m * @param name * @param size */ private void createColumn(String[] name, int[] size, int[] align) { for (int i = 0; i < name.length; i++) { TableViewerColumn tableColumn = new TableViewerColumn(propertyViewer, align[i]); tableColumn.getColumn().setText(name[i]); tableColumn.getColumn().setWidth(size[i]); } }
From source file:com.hangum.tadpole.rdb.core.editors.dbinfos.composites.RDBInformationComposite.java
License:Open Source License
/** * Create the composite.//from w ww. ja va 2s. c om * @param parent * @param style */ public RDBInformationComposite(Composite parent, int style, final UserDBDAO userDb) { super(parent, style); setLayout(new GridLayout(1, false)); this.userDB = userDb; tvInformation = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION); Table table = tvInformation.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableViewerColumn tableViewerColumn = new TableViewerColumn(tvInformation, SWT.NONE); TableColumn tblclmnName = tableViewerColumn.getColumn(); tblclmnName.setWidth(130); tblclmnName.setText("Name"); //$NON-NLS-1$ TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tvInformation, SWT.NONE); TableColumn tblclmnValue = tableViewerColumn_1.getColumn(); tblclmnValue.setWidth(300); tblclmnValue.setText("Value"); //$NON-NLS-1$ tvInformation.setContentProvider(new ArrayContentProvider()); tvInformation.setLabelProvider(new RDBInformationLabelProvider()); initUI(); tvInformation.setInput(listInfo); }
From source file:com.hangum.tadpole.rdb.core.editors.dbinfos.composites.TablesComposite.java
License:Open Source License
/** * ? ? ?./*from ww w . j a v a2 s . c o m*/ * * @param name * @param size */ private void createColumn(String[] name, int[] size, int[] align) { for (int i = 0; i < name.length; i++) { TableViewerColumn tableColumn = new TableViewerColumn(tvTableInform, align[i]); tableColumn.getColumn().setText(name[i]); tableColumn.getColumn().setWidth(size[i]); } }
From source file:com.hangum.tadpole.rdb.core.editors.main.composite.direct.SQLResultLabelProvider.java
License:Open Source License
/** * table? Column? ?.// w w w . j a v a 2s . c o m */ public static void createTableColumn(final RequestQuery reqQuery, final TableViewer tableViewer, final ResultSetUtilDTO rsDAO, final SQLResultSorter tableSorter, final boolean isEditable) { // column? . Table table = tableViewer.getTable(); int columnCount = table.getColumnCount(); for (int i = 0; i < columnCount; i++) { table.getColumn(0).dispose(); } if (rsDAO.getColumnName() == null) return; try { for (int i = 0; i < rsDAO.getColumnName().size(); i++) { final int index = i; final int columnAlign = RDBTypeToJavaTypeUtils.isNumberType(rsDAO.getColumnType().get(i)) ? SWT.RIGHT : SWT.LEFT; String strColumnName = rsDAO.getColumnName().get(i); /** ? ? ? */ if (StringUtils.startsWithIgnoreCase(strColumnName, PublicTadpoleDefine.SPECIAL_USER_DEFINE_HIDE_COLUMN)) continue; final TableViewerColumn tv = new TableViewerColumn(tableViewer, columnAlign); final TableColumn tc = tv.getColumn(); tc.setText(strColumnName); tc.setResizable(true); tc.setMoveable(true); tc.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { tableSorter.setColumn(index); int dir = tableViewer.getTable().getSortDirection(); if (tableViewer.getTable().getSortColumn() == tc) { dir = dir == SWT.UP ? SWT.DOWN : SWT.UP; } else { dir = SWT.DOWN; } tableViewer.getTable().setSortDirection(dir); tableViewer.getTable().setSortColumn(tc); tableViewer.refresh(); } }); // if select statement update if (PublicTadpoleDefine.QUERY_DML_TYPE.SELECT == reqQuery.getSqlDMLType() && isEditable) { if (i != 0) tv.setEditingSupport(new SQLResultEditingSupport(tableViewer, rsDAO, i)); } } // end for } catch (Exception e) { logger.error("SQLResult TableViewer", e); } }
From source file:com.hangum.tadpole.rdb.core.editors.main.composite.MessageComposite.java
License:Open Source License
/** * error message tableviewer/*from w w w. j a v a2 s . c o m*/ * * @param tableViewerMessage * @param sorterMessage * @param layoutColumnLayoutMsg */ public void createTableMessageColumn(TableViewer tableViewerMessage, SQLMessageSorter sorterMessage, AutoResizeTableLayout layoutColumnLayoutMsg) { TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewerMessage, SWT.NONE); TableColumn tblclmnDate = tableViewerColumn.getColumn(); tblclmnDate.setWidth(140); tblclmnDate.setText(Messages.MainEditor_14); tblclmnDate.addSelectionListener(getSelectionAdapter(tableViewerMessage, sorterMessage, tblclmnDate, 0)); layoutColumnLayoutMsg.addColumnData(new ColumnPixelData(160)); TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewerMessage, SWT.NONE); TableColumn tblclmnSql = tableViewerColumn_1.getColumn(); tblclmnSql.setWidth(500); tblclmnSql.setText("Message"); //$NON-NLS-1$ tblclmnSql.addSelectionListener(getSelectionAdapter(tableViewerMessage, sorterMessage, tblclmnSql, 1)); layoutColumnLayoutMsg.addColumnData(new ColumnWeightData(500)); }