Search in sources :

Example 51 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class ObjectInfoComposite method initIndexTabItem.

/**
	 * Initial index tab index
	 * 
	 */
private void initIndexTabItem() {
    CubridDatabase database = schemaNode.getDatabase();
    CTabItem indexTabItem = new CTabItem(objInfoFolder, SWT.NONE);
    indexTabItem.setText(Messages.titleIndex);
    indexTabItem.setShowClose(false);
    Composite composite = new Composite(objInfoFolder, SWT.None);
    indexTabItem.setControl(composite);
    composite.setLayout(new FillLayout());
    final SashForm sashForm = new SashForm(composite, SWT.VERTICAL);
    sashForm.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
    /*Index table composite*/
    Composite indexComposite = new Composite(sashForm, SWT.None);
    indexComposite.setLayout(new GridLayout());
    /*FK table composite*/
    Composite fkComposite = new Composite(sashForm, SWT.None);
    fkComposite.setLayout(new GridLayout());
    /*Set the sashform*/
    sashForm.setWeights(new int[] { 1, 1 });
    // create index table view
    final Label indexLabel = new Label(indexComposite, SWT.NONE);
    indexLabel.setText(Messages.lblIndexes);
    indexTableViewer = new TableViewer(indexComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    Table indexTable = indexTableViewer.getTable();
    indexTable.setLinesVisible(true);
    indexTable.setHeaderVisible(true);
    indexTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    TableColumn tblCol = new TableColumn(indexTable, SWT.NONE);
    tblCol.setWidth(150);
    tblCol.setText(Messages.tblColumnIndexName);
    TableColumn indexNameColumn = new TableColumn(indexTable, SWT.NONE);
    indexNameColumn.setWidth(78);
    indexNameColumn.setText(Messages.tblColumnIndexType);
    TableColumn indexTypeColumn = new TableColumn(indexTable, SWT.NONE);
    indexTypeColumn.setWidth(218);
    indexTypeColumn.setText(Messages.tblColumnOnColumns);
    TableColumn ruleColumn = new TableColumn(indexTable, SWT.NONE);
    ruleColumn.setWidth(282);
    ruleColumn.setText(Messages.tblColumnIndexRule);
    IndexTableViewerContentProvider indexContentProvider = new IndexTableViewerContentProvider();
    IndexTableViewerLabelProvider indexLabelProvider = new IndexTableViewerLabelProvider();
    indexTableViewer.setContentProvider(indexContentProvider);
    indexTableViewer.setLabelProvider(indexLabelProvider);
    // create the fk table viewer
    final Label fkLabel = new Label(fkComposite, SWT.NONE);
    fkLabel.setText(Messages.lblFK);
    fkTableViewer = new TableViewer(fkComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    Table fkTable = fkTableViewer.getTable();
    fkTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    fkTable.setLinesVisible(true);
    fkTable.setHeaderVisible(true);
    TableColumn fkNameColumn = new TableColumn(fkTable, SWT.NONE);
    fkNameColumn.setWidth(100);
    fkNameColumn.setText(Messages.tblColumnFK);
    TableColumn fkColumnName = new TableColumn(fkTable, SWT.NONE);
    fkColumnName.setWidth(119);
    fkColumnName.setText(Messages.tblColumnColumnName);
    TableColumn fTableColumn = new TableColumn(fkTable, SWT.NONE);
    fTableColumn.setWidth(93);
    fTableColumn.setText(Messages.tblColumnForeignTable);
    TableColumn fkColumnNameColumn = new TableColumn(fkTable, SWT.NONE);
    fkColumnNameColumn.setWidth(143);
    fkColumnNameColumn.setText(Messages.tblColumnForeignColumnName);
    TableColumn updateRuletblColumn = new TableColumn(fkTable, SWT.NONE);
    updateRuletblColumn.setWidth(84);
    updateRuletblColumn.setText(Messages.tblColumnUpdateRule);
    TableColumn deleteRuleColumn = new TableColumn(fkTable, SWT.NONE);
    deleteRuleColumn.setWidth(86);
    deleteRuleColumn.setText(Messages.tblColumnDeleteRule);
    TableColumn cacheColumn = new TableColumn(fkTable, SWT.NONE);
    cacheColumn.setWidth(100);
    cacheColumn.setText(Messages.tblColumnCacheColumn);
    fkTableViewer.setContentProvider(new FKTableViewerContentProvider());
    fkTableViewer.setLabelProvider(new FKTableViewerLabelProvider(database.getDatabaseInfo()));
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) IndexTableViewerContentProvider(com.cubrid.common.ui.cubrid.table.control.IndexTableViewerContentProvider) FillLayout(org.eclipse.swt.layout.FillLayout) FKTableViewerLabelProvider(com.cubrid.common.ui.cubrid.table.control.FKTableViewerLabelProvider) CTabItem(org.eclipse.swt.custom.CTabItem) TableColumn(org.eclipse.swt.widgets.TableColumn) IndexTableViewerLabelProvider(com.cubrid.common.ui.cubrid.table.control.IndexTableViewerLabelProvider) SashForm(org.eclipse.swt.custom.SashForm) FKTableViewerContentProvider(com.cubrid.common.ui.cubrid.table.control.FKTableViewerContentProvider) GridLayout(org.eclipse.swt.layout.GridLayout) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 52 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class CombinedQueryEditorComposite method createResultFolder.

/**
	 * Create the result folder including query result and query plan result
	 *
	 * @param topSash SashForm
	 * @param sqlEditorParentComp Composite
	 */
private void createResultFolder(final SashForm topSash, final Composite sqlEditorParentComp) {
    final Composite resultComp = new Composite(topSash, SWT.NONE);
    {
        GridLayout gridLayout = new GridLayout();
        gridLayout.horizontalSpacing = 0;
        gridLayout.verticalSpacing = 0;
        gridLayout.marginWidth = 0;
        gridLayout.marginHeight = 0;
        resultComp.setLayout(gridLayout);
        resultComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    }
    // result folder
    final CTabFolder resultTabFolder = new CTabFolder(resultComp, SWT.TOP);
    resultTabFolder.setLayout(new FillLayout());
    resultTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    resultTabFolder.setSimple(false);
    resultTabFolder.setUnselectedImageVisible(true);
    resultTabFolder.setUnselectedCloseVisible(true);
    resultTabFolder.setSelectionBackground(BACK_COLOR);
    resultTabFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
    resultTabFolder.setMinimizeVisible(true);
    resultTabFolder.setMaximizeVisible(true);
    this.resultTabFolder = resultTabFolder;
    resultTabFolder.addCTabFolder2Listener(new CTabFolder2Listener() {

        public void close(CTabFolderEvent event) {
        }

        public void maximize(CTabFolderEvent event) {
            resultTabFolder.setMaximized(true);
            topSash.setMaximizedControl(resultComp);
            editor.getShowResultItem().setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_panel_down.png"));
            topSash.layout(true);
        }

        public void minimize(CTabFolderEvent event) {
            resultTabFolder.setMinimized(true);
            topSash.setMaximizedControl(sqlEditorParentComp);
            editor.getShowResultItem().setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_panel_up.png"));
            topSash.layout(true);
        }

        public void restore(CTabFolderEvent event) {
            resultTabFolder.setMinimized(false);
            resultTabFolder.setMaximized(false);
            topSash.setMaximizedControl(null);
            editor.getShowResultItem().setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_panel_down.png"));
            topSash.layout(true);
        }

        public void showList(CTabFolderEvent event) {
        }
    });
    // query result tab area
    queryResultComp = new QueryResultComposite(resultTabFolder, SWT.NONE, editor);
    // query plan result tab area
    queryPlanResultComp = new QueryPlanCompositeWithHistory(resultTabFolder, SWT.NONE, editor);
    // recently Used SQL tab area
    recentlyUsedSQLComposite = new RecentlyUsedSQLComposite(resultTabFolder, SWT.NONE, editor);
    recentlyUsedSQLComposite.initialize();
    // create multiple query
    multiDBQueryComp = new MultiDBQueryComposite(resultTabFolder, SWT.NONE, editor);
    multiDBQueryComp.initialize();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) CTabFolder2Listener(org.eclipse.swt.custom.CTabFolder2Listener) GridData(org.eclipse.swt.layout.GridData) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 53 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class CombinedQueryEditorComposite method createTopSash.

/**
	 * Create the top sash for SQL editor and query result
	 */
private void createTopSash() {
    Composite topComp = new Composite(this, SWT.NONE);
    topComp.setLayout(new FillLayout());
    topSash = new SashForm(topComp, SWT.VERTICAL);
    topSash.setBackground(SASH_COLOR);
    topSash.setLayout(new FillLayout());
    /* set top sash width to 0, the black line (topSash's background) won't be display
		 * set the normal width when change the editor database(there's no better way to set width)
		 * for TOOLS-2375
		 */
    topSash.setSashWidth(0);
    Composite sqlEditorParentComp = createSQLEditor(topSash);
    createResultFolder(topSash, sqlEditorParentComp);
    topSash.setWeights(new int[] { QUERY_EDITOR_TOP_PCT, QUERY_EDITOR_BOTTOM_PCT });
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) Composite(org.eclipse.swt.widgets.Composite) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 54 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class BLOBCellPopupDialog method createImageCanvas.

/**
	 *
	 * Create the image canvas
	 *
	 */
private void createImageCanvas() {
    imageCanvas = new Composite(dataComposite, SWT.NONE);
    imageCanvas.setLayoutData(new GridData(GridData.FILL_BOTH));
    imageCanvas.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, -1));
    imageCanvas.setLayout(new FillLayout());
    InputStream in = null;
    try {
        if (currValue instanceof File) {
            in = new FileInputStream((File) currValue);
        } else if (currValue instanceof byte[]) {
            in = new ByteArrayInputStream((byte[]) currValue);
        }
        if (in == null) {
            imageCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
            return;
        }
        ImageLoader loader = new ImageLoader();
        ImageData[] imageDatas = loader.load(in);
        if (imageDatas == null || imageDatas.length == 0) {
            imageCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
            return;
        }
        imageViewer = new ImageViewer(imageCanvas);
        if (imageDatas.length == 1) {
            imageViewer.setImage(imageDatas[0]);
        } else {
            imageViewer.setImages(imageDatas, loader.repeatCount);
        }
        imageViewer.pack();
    } catch (Exception ex) {
        imageCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
    } finally {
        Closer.close(in);
    }
    dataComposite.layout();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ByteArrayInputStream(java.io.ByteArrayInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) FillLayout(org.eclipse.swt.layout.FillLayout) FileInputStream(java.io.FileInputStream) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) ByteArrayInputStream(java.io.ByteArrayInputStream) ImageData(org.eclipse.swt.graphics.ImageData) GridData(org.eclipse.swt.layout.GridData) ImageLoader(org.eclipse.swt.graphics.ImageLoader) File(java.io.File)

Example 55 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project azure-tools-for-java by Microsoft.

the class JobViewEditor method createPartControl.

@Override
public void createPartControl(Composite composite) {
    composite.setLayout(new FillLayout());
    final String indexPath = PluginUtil.pluginFolder + "/com.microsoft.azuretools.hdinsight/html" + "/hdinsight/job/html/index.html";
    File indexFile = new File(indexPath);
    if (indexFile.exists()) {
        final String queryString = "?projectid=" + uuid + "&engintype=javafx&sourcetype=eclipse&clustername=" + clusterDetail.getName();
        final String webUrl = "file:///" + indexPath.replace("\\", "/") + queryString;
        FxClassLoader.loadJavaFxForJobView(composite, webUrl);
    } else {
        DefaultLoader.getUIHelper().showError("HDInsight Job view index page not exist!", "job view");
    }
}
Also used : FillLayout(org.eclipse.swt.layout.FillLayout) File(java.io.File)

Aggregations

FillLayout (org.eclipse.swt.layout.FillLayout)298 Composite (org.eclipse.swt.widgets.Composite)180 GridData (org.eclipse.swt.layout.GridData)130 Shell (org.eclipse.swt.widgets.Shell)104 GridLayout (org.eclipse.swt.layout.GridLayout)97 Label (org.eclipse.swt.widgets.Label)69 SelectionEvent (org.eclipse.swt.events.SelectionEvent)67 Display (org.eclipse.swt.widgets.Display)63 Button (org.eclipse.swt.widgets.Button)60 Point (org.eclipse.swt.graphics.Point)55 Table (org.eclipse.swt.widgets.Table)48 Group (org.eclipse.swt.widgets.Group)40 SelectionListener (org.eclipse.swt.events.SelectionListener)38 TableColumn (org.eclipse.swt.widgets.TableColumn)38 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)37 Text (org.eclipse.swt.widgets.Text)36 Test (org.junit.Test)36 TableItem (org.eclipse.swt.widgets.TableItem)35 SashForm (org.eclipse.swt.custom.SashForm)31 Rectangle (org.eclipse.swt.graphics.Rectangle)29