Search in sources :

Example 51 with CTabFolder

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

the class MultiQueryThread method displayResults.

/**
	 * Display Multiple DBs/Queries Results
	 */
public void displayResults() {
    final Map<String, QueryExecuter> baseExecuterList = queryExecuterMap.get(baseDatabase);
    Set<CubridDatabase> databaseSet = compositeMap.keySet();
    for (final CubridDatabase database : databaseSet) {
        final QueryResultComposite queryResultComp = compositeMap.get(database);
        final Map<String, QueryExecuter> queryExecuterList = queryExecuterMap.get(database);
        final Map<String, StringBuilder> logs = logsMap.get(database);
        Display.getDefault().syncExec(new Runnable() {

            public void run() {
                CTabFolder queryResultTabFolder = queryResultComp.getQueryResultTabFolder();
                if (queryResultTabFolder != null && !queryResultTabFolder.isDisposed()) {
                    queryResultComp.disposeAllResult();
                    queryResultComp.disposeTabResult();
                    for (String sql : queryExecuterList.keySet()) {
                        queryResultComp.setMultiResultsCompare(true);
                        if (database != baseDatabase) {
                            queryResultComp.setBaseQueryExecuter(baseExecuterList.get(sql));
                        } else {
                            queryResultComp.setBaseQueryExecuter(null);
                        }
                        QueryExecuter executer = (QueryExecuter) queryExecuterList.get(sql);
                        StringBuilder log = logs.get(sql);
                        if (log != null) {
                            String logsBak = log.toString();
                            if (logsBak.trim().length() > 0) {
                                queryResultComp.makeLogResult("", logsBak);
                            } else {
                                queryResultComp.makeMultiQueryResult(executer);
                            }
                        } else {
                            queryResultComp.makeMultiQueryResult(executer);
                        }
                    }
                    if (queryResultTabFolder.getItemCount() > 0) {
                        queryResultTabFolder.setSelection(queryResultTabFolder.getItemCount() - 1);
                    }
                }
            }
        });
    }
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 52 with CTabFolder

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

the class MultiSQLQueryResultComposite method createResultQueryResultComposite.

public void createResultQueryResultComposite(SashForm parentForm, String sql) {
    if (sql == null) {
        createBlankResultComposite(parentForm);
        return;
    }
    CTabFolder folder1 = new CTabFolder(parentForm, SWT.TOP);
    folder1.setSimple(false);
    folder1.setUnselectedImageVisible(true);
    folder1.setUnselectedCloseVisible(true);
    folder1.setSelectionBackground(CombinedQueryEditorComposite.BACK_COLOR);
    folder1.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
    folder1.setLayout(new GridLayout(1, true));
    folder1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    QueryResultComposite comp = new QueryResultComposite(folder1, true, this.editor);
    int titleLength = 30;
    String title = sql.length() > titleLength ? sql.substring(0, titleLength) + "..." : sql;
    comp.setQueryResultTabItemName(title);
    comp.setCanDispose(true);
    sqlResultMap.put(sql, comp);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) GridData(org.eclipse.swt.layout.GridData)

Example 53 with CTabFolder

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

the class LockInfoDialog method createDialogArea.

/**
	 * Create dialog area content
	 * 
	 * @param parent the parent composite
	 * @return the control
	 */
protected Control createDialogArea(Composite parent) {
    parentComp = (Composite) super.createDialogArea(parent);
    tabFolder = new CTabFolder(parentComp, SWT.NONE);
    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    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);
    tabFolder.setLayout(layout);
    CTabItem item = new CTabItem(tabFolder, SWT.NONE);
    item.setText(Messages.tabItemClientInfo);
    Composite lockComposite = createLockSettingComposite();
    item.setControl(lockComposite);
    item = new CTabItem(tabFolder, SWT.NONE);
    item.setText(Messages.tabItemObjectLock);
    Composite composite = createHistoryComposite();
    item.setControl(composite);
    initial();
    return parentComp;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 54 with CTabFolder

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

the class AddMonitorInstanceDlg method createDialogArea.

/**
	 * Creates and returns the contents of the upper part of this dialog (above
	 * the button bar).
	 * 
	 * @param parent The parent composite to contain the dialog area
	 * @return the dialog area control
	 */
protected Control createDialogArea(Composite parent) {
    initial();
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite comp = new Composite(parentComp, SWT.NO_FOCUS);
    GridLayout layout = new GridLayout();
    comp.setLayout(layout);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    Composite typeComp = new Composite(comp, SWT.NONE);
    typeComp.setLayout(new GridLayout(4, false));
    typeComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Label typeLbl = new Label(typeComp, SWT.NONE);
    typeLbl.setText(Messages.addMonInsDlgTypeLbl);
    typeCombo = new Combo(typeComp, SWT.READ_ONLY);
    final GridData gdContentTxt = new GridData(SWT.FILL, SWT.CENTER, true, false);
    typeCombo.setLayoutData(gdContentTxt);
    typeCombo.setItems(monitorTypes);
    Label nodeLbl = new Label(typeComp, SWT.NONE);
    nodeLbl.setText(Messages.addMonInsDlgNodeName);
    nodeTxt = new Text(typeComp, SWT.BORDER);
    nodeTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (monData == null) {
        typeCombo.select(0);
    } else {
        MonitorType monitorType = monData.getMonitorType();
        typeCombo.setText(monitorType.toString());
        nodeTxt.setEnabled(false);
        String noteLabel = selection.getLabel();
        nodeTxt.setText(noteLabel);
    }
    nodeTxt.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent ex) {
            if (ValidateUtil.isValidDBName(nodeTxt.getText())) {
                //using db name rule
                isOkenable[0] = true;
            } else {
                isOkenable[0] = false;
            }
            enableOk();
        }
    });
    typeCombo.addSelectionListener(new TypeSelectionAdapter());
    final CTabFolder folder = new CTabFolder(comp, SWT.BORDER);
    folder.setLayout(new GridLayout());
    GridData gdTabFolder = new GridData(SWT.FILL, SWT.FILL, true, true);
    folder.setLayoutData(gdTabFolder);
    folder.setSimple(false);
    TreeMap<String, ShowSetting> settingMap = new TreeMap<String, ShowSetting>();
    chartSettingDlg = new ChartSettingDlg(null);
    chartSettingDlg.setFolder(folder);
    chartSettingDlg.setShowTitlteContent(true);
    String historyFileName = hostAddress + "_" + monPort + HistoryComposite.HISTORY_SUFFIX;
    if (typeCombo.getSelectionIndex() == 0) {
        historyFileName = HistoryComposite.BROKER_HISTORY_FILE_PREFIX + historyFileName;
    } else if (typeCombo.getSelectionIndex() == 1) {
        historyFileName = HistoryComposite.DB_HISTORY_FILE_PREFIX + historyFileName;
    }
    chartSettingDlg.setHistoryFileName(historyFileName);
    if (monData == null) {
        BrokerDiagData brokerDiagData = new BrokerDiagData();
        TreeMap<String, String> map = convertMapKey(brokerDiagData.getDiagStatusResultMap());
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            ShowSetting showSetting = new ShowSetting();
            ShowSettingMatching.match(key, showSetting, MonitorType.BROKER, isNewBrokerDiag);
            settingMap.put(key, showSetting);
        }
        IPath historyPath = CubridManagerCorePlugin.getDefault().getStateLocation();
        chartSettingDlg.setTitleName(defaultMonitorTtl[0]);
        String sHistoryPath = historyPath.toOSString() + File.separator + historyFileName;
        chartSettingDlg.setHistoryPath(sHistoryPath);
    } else {
        //title
        String titleName = monData.getTitleName();
        String titleBgColor = monData.getTitleBgColor();
        String titleFontName = monData.getTitleFontName();
        int titleFontSize = monData.getTitleFontSize();
        String titleFontColor = monData.getTitleFontColor();
        chartSettingDlg.setTitleName(titleName);
        chartSettingDlg.setTtlBgColor(titleBgColor);
        chartSettingDlg.setTtlFontName(titleFontName);
        chartSettingDlg.setTtlFontSize(titleFontSize);
        chartSettingDlg.setTtlFontColor(titleFontColor);
        //plot
        String plotBgColor = monData.getPlotBgColor();
        String plotDateAxisColor = monData.getPlotDateAxisColor();
        String plotDomainGridColor = monData.getPlotDomainGridColor();
        String plotNumberAxisColor = monData.getPlotNumberAxisColor();
        String plotRangGridColor = monData.getPlotRangGridColor();
        chartSettingDlg.setPlotBgColor(plotBgColor);
        chartSettingDlg.setPlotDateAxisColor(plotDateAxisColor);
        chartSettingDlg.setPlotDomainGridColor(plotDomainGridColor);
        chartSettingDlg.setPlotNumberAxisColor(plotNumberAxisColor);
        chartSettingDlg.setPlotRangGridColor(plotRangGridColor);
        //series
        settingMap = monData.getSettingMap();
        //history path 
        String historyPath = monData.getHistoryPath();
        chartSettingDlg.setHistoryPath(historyPath);
    }
    chartSettingDlg.setSettingMap(settingMap);
    chartSettingDlg.createTtlTab();
    chartSettingDlg.createPlotItem();
    chartSettingDlg.createSeriesItemByDefault();
    chartSettingDlg.createHistoryPathItem();
    folder.setSelection(0);
    saveBtn = new Button(comp, SWT.CHECK);
    saveBtn.setText(Messages.btnSaveMonitorSetting);
    setTitle(Messages.addMonInsDlgTtl);
    setMessage(Messages.addMonInsDlgMsg);
    return comp;
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) MonitorType(com.cubrid.cubridmanager.ui.monitoring.editor.internal.MonitorType) ModifyListener(org.eclipse.swt.events.ModifyListener) IPath(org.eclipse.core.runtime.IPath) Label(org.eclipse.swt.widgets.Label) BrokerDiagData(com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) TreeMap(java.util.TreeMap) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ChartSettingDlg(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartSettingDlg) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) ShowSetting(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 55 with CTabFolder

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

the class DetailTabManager method createTabs.

/**
     * Creates all the tabs in the detail pane to display the information for a
     * given node.
     * 
     * @param composite
     * @param node
     */
public static void createTabs(Composite composite, INode node) {
    List tabs = getTabs(node);
    if (tabs == null || tabs.size() == 0) {
        // no detail found..
        Label label = new Label(composite, SWT.FILL | SWT.WRAP);
        //$NON-NLS-1$ //$NON-NLS-2$
        label.setText(Messages.getString("DatabaseDetailView.Tab.Unavailable") + " " + node.getLabelText());
        return;
    }
    // create tabs
    CTabFolder tabFolder = new CTabFolder(composite, SWT.NULL);
    tabFolder.setSimple(false);
    // only init tabs when the tab becomes active
    tabFolder.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            CTabItem tabItem = (CTabItem) e.item;
            IDetailTab tab = (IDetailTab) tabItem.getData();
            if (tab != null) {
                // create composite on tab and fill it..
                Composite detailComposite = new Composite(tabItem.getParent(), SWT.FILL);
                tabItem.setControl(detailComposite);
                detailComposite.setLayout(new FillLayout());
                tab.fillComposite(detailComposite);
                detailComposite.layout();
                // store tab name, so we can reselect when other node is
                // chosen
                DetailTabManager.setActiveTabName(tabItem.getText());
            }
        }
    });
    // add tabs to folder
    Iterator it = tabs.iterator();
    int tabIndex = 0;
    while (it.hasNext()) {
        IDetailTab detailTab = (IDetailTab) it.next();
        // create tab
        CTabItem tabItem = new CTabItem(tabFolder, SWT.NULL);
        tabItem.setText(detailTab.getLabelText());
        tabItem.setToolTipText(detailTab.getLabelToolTipText());
        // store tab so we can fill later
        tabItem.setData(detailTab);
        // reselect same tab as was previous selected
        if (tabItem.getText() != null && pActiveTabName != null) {
            if (tabItem.getText().equals(pActiveTabName)) {
                tabFolder.setSelection(tabIndex);
            }
        }
        tabIndex++;
    }
    // load data for active tab, default to first one if none is selected
    tabIndex = tabFolder.getSelectionIndex();
    if (tabIndex == -1) {
        tabIndex = 0;
    }
    CTabItem tabItem = tabFolder.getItem(tabIndex);
    if (tabItem != null) {
        Composite detailComposite = new Composite(tabItem.getParent(), SWT.FILL);
        tabItem.setControl(detailComposite);
        detailComposite.setLayout(new FillLayout());
        IDetailTab tab = (IDetailTab) tabItem.getData();
        tab.fillComposite(detailComposite);
        detailComposite.layout();
    }
    if (tabFolder.getChildren().length > 0 && tabFolder.getSelection() == null) {
        tabFolder.setSelection(0);
    }
    tabFolder.layout();
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) FillLayout(org.eclipse.swt.layout.FillLayout) CTabItem(org.eclipse.swt.custom.CTabItem)

Aggregations

CTabFolder (org.eclipse.swt.custom.CTabFolder)66 CTabItem (org.eclipse.swt.custom.CTabItem)36 GridData (org.eclipse.swt.layout.GridData)35 GridLayout (org.eclipse.swt.layout.GridLayout)27 Composite (org.eclipse.swt.widgets.Composite)26 SelectionEvent (org.eclipse.swt.events.SelectionEvent)18 FillLayout (org.eclipse.swt.layout.FillLayout)18 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)13 Label (org.eclipse.swt.widgets.Label)13 Point (org.eclipse.swt.graphics.Point)9 Shell (org.eclipse.swt.widgets.Shell)8 StyledText (org.eclipse.swt.custom.StyledText)7 SelectionListener (org.eclipse.swt.events.SelectionListener)7 Button (org.eclipse.swt.widgets.Button)7 SashForm (org.eclipse.swt.custom.SashForm)6 FormAttachment (org.eclipse.swt.layout.FormAttachment)6 FormData (org.eclipse.swt.layout.FormData)6 Text (org.eclipse.swt.widgets.Text)6 ToolBar (org.eclipse.swt.widgets.ToolBar)6 ToolItem (org.eclipse.swt.widgets.ToolItem)6