Search in sources :

Example 21 with ScrolledComposite

use of org.eclipse.swt.custom.ScrolledComposite in project tdi-studio-se by Talend.

the class JavaJobScriptsExportWSWizardPage method createControl.

@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);
    GridLayout layout = new GridLayout();
    SashForm sash = createExportTree(parent);
    // Added a scrolled composite by Marvin Wang on Feb. 27, 2012 for bug TDI-19198.
    scrolledComposite = new ScrolledComposite(sash, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    pageComposite = new Group(scrolledComposite, SWT.NONE);
    pageComposite.setLayout(layout);
    pageComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    pageComposite.setFont(parent.getFont());
    setControl(sash);
    sash.setWeights(new int[] { 0, 1, 23 });
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.verticalSpacing = 0;
    destinationNameFieldComposite = new Composite(pageComposite, SWT.NONE);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    destinationNameFieldComposite.setLayoutData(gridData);
    destinationNameFieldComposite.setLayout(layout);
    destinationNameFieldInnerComposite = new Composite(destinationNameFieldComposite, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    destinationNameFieldInnerComposite.setLayoutData(gridData);
    destinationNameFieldInnerComposite.setLayout(layout);
    createDestinationGroup(destinationNameFieldInnerComposite);
    // createExportTree(pageComposite);
    if (!isMultiNodes()) {
        IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
        boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
        if (allowVerchange) {
            createJobVersionGroup(pageComposite);
        } else {
            selectedJobVersion = "0.1";
        }
    }
    createExportTypeGroup(pageComposite);
    createOptionsGroupButtons(pageComposite);
    // ie.- local
    restoreResourceSpecificationWidgetValues();
    updateWidgetEnablements();
    setPageComplete(determinePageCompletion());
    giveFocusToDestination();
    pageComposite.setSize(pageComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    scrolledComposite.setMinSize(pageComposite.getSize());
    scrolledComposite.setContent(pageComposite);
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) IBrandingService(org.talend.core.ui.branding.IBrandingService)

Example 22 with ScrolledComposite

use of org.eclipse.swt.custom.ScrolledComposite in project cubrid-manager by CUBRID.

the class SetPhysicalLogicaMapDialog method createTableComposite.

private void createTableComposite(Composite composite, Group group, PhysicalLogicRelation.MapType type) {
    group.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    group.setLayout(layout);
    ScrolledComposite scrolledComposite = new ScrolledComposite(group, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    final TableViewer tableViewer = new TableViewer(scrolledComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    columnDataTableView = tableViewer;
    tableViewer.setColumnProperties(columnProperites);
    final Table widgetTable = tableViewer.getTable();
    scrolledComposite.setContent(widgetTable);
    scrolledComposite.setMinSize(widgetTable.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    final GridData gdFkTable = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1);
    widgetTable.setLayoutData(gdFkTable);
    widgetTable.setLinesVisible(true);
    widgetTable.setHeaderVisible(true);
    //empty column
    final TableColumn emptyColumn = new TableColumn(widgetTable, SWT.NONE);
    emptyColumn.setWidth(0);
    //flag column
    final TableColumn flagColumn = new TableColumn(widgetTable, SWT.LEFT_TO_RIGHT);
    flagColumn.setWidth(20);
    //physical column
    TableColumn tblCol = new TableColumn(widgetTable, SWT.NONE);
    tblCol.setWidth(120);
    tblCol.setText(Messages.tblcolumnPhysical);
    //logical column
    tblCol = new TableColumn(widgetTable, SWT.NONE);
    tblCol.setWidth(120);
    tblCol.setText(Messages.tblcolumnLogical);
    attrContentProvider = new AttributeContentProvider();
    attrLabelProvider = new RelationMapColumnLabelProvider(this);
    tableViewer.setContentProvider(attrContentProvider);
    tableViewer.setLabelProvider(attrLabelProvider);
    CellEditor[] cellEditor = new CellEditor[columnProperites.length];
    {
        int index = 0;
        //Empty
        cellEditor[index++] = null;
        //Flag
        cellEditor[index++] = null;
        //Physical
        cellEditor[index++] = new TextCellEditor(widgetTable);
        //Logical
        cellEditor[index++] = new TextCellEditor(widgetTable);
    }
    tableViewer.setCellEditors(cellEditor);
    tableViewer.setCellModifier(new ModelRelationCellModifier(this, type));
    loadTableInput(type);
    final Button delBtn = new Button(group, SWT.PUSH);
    delBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    delBtn.setText(Messages.btnDelItem);
    delBtn.setData(type);
    delBtn.setEnabled(false);
    delBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            deleteColumn(delBtn);
        }
    });
    widgetTable.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            handleSelectionChangeInTable(widgetTable, delBtn);
        }
    });
}
Also used : Table(org.eclipse.swt.widgets.Table) ERTable(com.cubrid.common.ui.er.model.ERTable) AttributeContentProvider(com.cubrid.common.ui.cubrid.table.editor.AttributeContentProvider) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableColumn(org.eclipse.swt.widgets.TableColumn) GridLayout(org.eclipse.swt.layout.GridLayout) RelationMapColumnLabelProvider(com.cubrid.common.ui.er.editor.RelationMapColumnLabelProvider) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) ModelRelationCellModifier(com.cubrid.common.ui.er.editor.ModelRelationCellModifier) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 23 with ScrolledComposite

use of org.eclipse.swt.custom.ScrolledComposite in project cubrid-manager by CUBRID.

the class BrokerStatusView method createPartControl.

/**
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 * 
	 * @param parent the parent composite
	 */
public void createPartControl(Composite parent) {
    final ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    composite = new Composite(scrolledComp, SWT.NONE);
    composite.setLayout(new GridLayout());
    BrokerTblColumnSetHelp bcsh = BrokerTblColumnSetHelp.getInstance();
    bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerStatusBasicColumn, BrokerStatusBasicColumn.values());
    bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerStatusAsColumn, BrokerStatusAsColumn.values());
    bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerStatusJqColumn, BrokerStatusJqColumn.values());
    if (isSupportNewBrokerParamPropery) {
        createBasicTable(composite);
    }
    createAsTable(composite);
    createJobTable(composite);
    makeActions();
    composite.addControlListener(new ControlAdapter() {

        public void controlResized(ControlEvent event) {
            updateTableLayout();
        }
    });
    scrolledComp.setContent(composite);
    scrolledComp.setExpandHorizontal(true);
    scrolledComp.setExpandVertical(true);
    scrolledComp.setMinHeight(300);
    scrolledComp.setMinWidth(800);
    new StatusUpdate().start();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ControlAdapter(org.eclipse.swt.events.ControlAdapter) BrokerTblColumnSetHelp(com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerTblColumnSetHelp) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ControlEvent(org.eclipse.swt.events.ControlEvent)

Example 24 with ScrolledComposite

use of org.eclipse.swt.custom.ScrolledComposite in project cubrid-manager by CUBRID.

the class LoadDatabaseDialog method createDialogArea.

/**
	 * Create dialog area content
	 * 
	 * @param parent the parent composite
	 * @return the control
	 */
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    //the content may be too high so use ScrolledComposite
    ScrolledComposite scrolledComposite = new ScrolledComposite(parentComp, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite composite = new Composite(scrolledComposite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(gridData);
    scrolledComposite.setContent(composite);
    isLocalServer = database.getServer().getServerInfo().isLocalServer();
    createDatabaseInfoGruop(composite);
    createLoadTargetInfoGroup(composite);
    createLoadOptionGruop(composite);
    // set ScrolledComposite scroll options
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    setTitle(Messages.titleLoadDbDialog);
    setMessage(Messages.msgLoadDbDialog);
    initial();
    return parentComp;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite)

Example 25 with ScrolledComposite

use of org.eclipse.swt.custom.ScrolledComposite in project cubrid-manager by CUBRID.

the class ColumnViewerSorter method createPartControl.

public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));
    ToolBar toolBar = new ToolBar(parent, SWT.LEFT_TO_RIGHT | SWT.FLAT);
    toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
    refreshItem.setText(Messages.tablesDetailInfoPartRefreshBtn);
    refreshItem.setToolTipText(Messages.tablesDetailInfoPartBtnRefreshTip);
    refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
    refreshItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            refresh();
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem countItem = new ToolItem(toolBar, SWT.PUSH);
    countItem.setText(Messages.tablesDetailInfoPartBtnEsitmateRecord);
    countItem.setToolTipText(Messages.tablesDetailInfoPartBtnEsitmateRecordTip);
    countItem.setImage(CommonUIPlugin.getImage("icons/action/count.gif"));
    countItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            List<TableDetailInfo> list = new ArrayList<TableDetailInfo>();
            TableItem[] items = tableListView.getTable().getSelection();
            for (TableItem item : items) {
                list.add((TableDetailInfo) item.getData());
            }
            // Check selected size and confirm
            if (list.size() == 0) {
                CommonUITool.openWarningBox(Messages.tablesDetailInfoPartAlertNotSelected);
                return;
            }
            if (CommonUITool.openConfirmBox(Messages.tablesDetailInfoPartBtnEsitmateRecordAlert)) {
                LoadTableRecordCountsProgress progress = new LoadTableRecordCountsProgress(database, list);
                progress.getTableCounts();
                tableListView.refresh();
            }
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem viewDataItem = new ToolItem(toolBar, SWT.PUSH);
    viewDataItem.setText(Messages.tablesDetailInfoPartBtnViewData);
    viewDataItem.setToolTipText(Messages.tablesDetailInfoPartBtnViewDataTip);
    viewDataItem.setImage(CommonUIPlugin.getImage("icons/action/table_select_all.png"));
    viewDataItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            TableItem[] items = tableListView.getTable().getSelection();
            if (items.length == 1) {
                TableDetailInfo tableDetailInfo = (TableDetailInfo) items[0].getData();
                String query = SQLGenerateUtils.getSelectSQLWithLimit(tableDetailInfo.getTableName(), 1, 100);
                QueryEditorUtil.openQueryEditorAndRunQuery(database, query, true, true);
            } else {
                CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnViewDataSelectOne);
            }
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem copyTableNamesItem = new ToolItem(toolBar, SWT.PUSH);
    copyTableNamesItem.setText(Messages.tablesDetailInfoPartBtnCopyTableNames);
    copyTableNamesItem.setToolTipText(Messages.tablesDetailInfoPartBtnCopyTableNamesTip);
    copyTableNamesItem.setImage(CommonUIPlugin.getImage("icons/action/copy_table_name.gif"));
    copyTableNamesItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            List<String> nameList = new ArrayList<String>();
            for (TableDetailInfo tablesDetailInfoPOJO : tableList) {
                nameList.add(tablesDetailInfoPOJO.getTableName());
            }
            if (nameList.size() == 0) {
                CommonUITool.openWarningBox(Messages.tablesDetailInfoPartBtnCopySuccessFailed);
                return;
            }
            copyNamesToClipboard(nameList);
            CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnCopySuccessTitle, Messages.tablesDetailInfoPartBtnCopySuccessMsg);
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem copyColumnNamesItem = new ToolItem(toolBar, SWT.PUSH);
    copyColumnNamesItem.setText(Messages.tablesDetailInfoPartBtnCopyColumnNames);
    copyColumnNamesItem.setToolTipText(Messages.tablesDetailInfoPartBtnCopyColumnNamesTip);
    copyColumnNamesItem.setImage(CommonUIPlugin.getImage("icons/action/copy_column_name.gif"));
    copyColumnNamesItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            TablesDetailInfoCTabItem tabItem = (TablesDetailInfoCTabItem) tabFolder.getSelection();
            schemaInfo = tabItem.getTableInfoComposite().getData();
            if (schemaInfo == null) {
                CommonUITool.openWarningBox(Messages.tablesDetailInfoPartBtnCopySuccessFailed);
                return;
            }
            List<String> nameList = new ArrayList<String>();
            for (DBAttribute att : schemaInfo.getAttributes()) {
                nameList.add(att.getName());
            }
            copyNamesToClipboard(nameList);
            CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnCopySuccessTitle, Messages.tablesDetailInfoPartBtnCopySuccessMsg);
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    final NewTableAction newTableAction = (NewTableAction) ActionManager.getInstance().getAction(NewTableAction.ID);
    ToolItem newTableItem = new ToolItem(toolBar, SWT.PUSH);
    newTableItem.setText(newTableAction.getText());
    newTableItem.setImage(CommonUITool.getImage(newTableAction.getImageDescriptor()));
    newTableItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            newTableAction.run(database);
        }
    });
    ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComp.setLayout(new FillLayout());
    scrolledComp.setExpandHorizontal(true);
    scrolledComp.setExpandVertical(true);
    scrolledComp.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    topSash = new SashForm(scrolledComp, SWT.VERTICAL);
    topSash.setBackground(ResourceManager.getColor(136, 161, 227));
    GridLayout gridLayout = new GridLayout();
    gridLayout.verticalSpacing = 0;
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    gridLayout.horizontalSpacing = 0;
    topSash.setLayout(gridLayout);
    topSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    topSash.SASH_WIDTH = 1;
    scrolledComp.setContent(topSash);
    createTablesDetailInfoTable(topSash);
    createTabFolder(topSash);
    topSash.setWeights(new int[] { 70, 30 });
    this.setInputs();
}
Also used : TablesDetailInfoCTabItem(com.cubrid.common.ui.cubrid.table.dashboard.control.TableDashboardComposite.TablesDetailInfoCTabItem) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) TableDetailInfo(com.cubrid.common.core.common.model.TableDetailInfo) FillLayout(org.eclipse.swt.layout.FillLayout) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) DBAttribute(com.cubrid.common.core.common.model.DBAttribute) NewTableAction(com.cubrid.common.ui.cubrid.table.action.NewTableAction) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ArrayList(java.util.ArrayList) List(java.util.List) LoadTableRecordCountsProgress(com.cubrid.common.ui.spi.progress.LoadTableRecordCountsProgress) ToolItem(org.eclipse.swt.widgets.ToolItem)

Aggregations

ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)61 GridData (org.eclipse.swt.layout.GridData)45 Composite (org.eclipse.swt.widgets.Composite)44 GridLayout (org.eclipse.swt.layout.GridLayout)40 Label (org.eclipse.swt.widgets.Label)27 FillLayout (org.eclipse.swt.layout.FillLayout)16 SelectionEvent (org.eclipse.swt.events.SelectionEvent)15 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)13 Point (org.eclipse.swt.graphics.Point)12 Button (org.eclipse.swt.widgets.Button)12 Text (org.eclipse.swt.widgets.Text)12 Control (org.eclipse.swt.widgets.Control)10 ControlEvent (org.eclipse.swt.events.ControlEvent)9 Group (org.eclipse.swt.widgets.Group)9 HistoryComposite (com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite)8 Rectangle (org.eclipse.swt.graphics.Rectangle)7 ArrayList (java.util.ArrayList)5 ControlListener (org.eclipse.swt.events.ControlListener)5 FormAttachment (org.eclipse.swt.layout.FormAttachment)5 FormData (org.eclipse.swt.layout.FormData)5