Java 类org.eclipse.swt.custom.TableEditor 实例源码

项目:Hydrograph    文件:HeaderAndDataFormattingDialog.java   
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);

            }
        }

    });
}
项目:Hydrograph    文件:HeaderAndDataFormattingDialog.java   
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();
            }
        }
    });
}
项目:Hydrograph    文件:FilterConditionsDialog.java   
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;
}
项目:Hydrograph    文件:FilterConditionsDialog.java   
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;
}
项目:Hydrograph    文件:FilterConditionsDialog.java   
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);
}
项目:Hydrograph    文件:FilterConditionsDialog.java   
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);
}
项目:ermasterr    文件:RelationByExistingColumnsDialog.java   
/**
 * {@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);
    }
}
项目:ermasterr    文件:RelationByExistingColumnsDialog.java   
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;
}
项目:ermasterr    文件:RelationByExistingColumnsDialog.java   
@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;
}
项目:ermasterr    文件:ModelPropertiesDialog.java   
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();
}
项目:ermasterr    文件:ComplexUniqueKeyTabWrapper.java   
@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();
}
项目:ermasterr    文件:IndexDialog.java   
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());
}
项目:ermasterr    文件:CategoryManageDialog.java   
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);
    }
}
项目:ermaster-k    文件:CompositeFactory.java   
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;
}
项目:ermaster-k    文件:RelationByExistingColumnsDialog.java   
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>>();
}
项目:ermaster-k    文件:RelationByExistingColumnsDialog.java   
/**
 * {@inheritDoc}
 */
@Override
protected void perfomeOK() {
    int index = this.columnCombo.getSelectionIndex();

    if (index < this.columnComboInfo.complexUniqueKeyStartIndex) {
        this.referenceForPK = true;

    } else if (index < this.columnComboInfo.columnStartIndex) {
        ComplexUniqueKey complexUniqueKey = this.source
                .getComplexUniqueKeyList()
                .get(index
                        - this.columnComboInfo.complexUniqueKeyStartIndex);

        this.referencedComplexUniqueKey = complexUniqueKey;

    } else {
        this.referencedColumn = this.columnComboInfo.candidateColumns
                .get(index - this.columnComboInfo.columnStartIndex);
    }

    for (TableEditor tableEditor : this.tableEditorList) {
        NormalColumn foreignKeyColumn = this.getSelectedColumn(tableEditor);
        this.foreignKeyColumnList.add(foreignKeyColumn);
    }
}
项目:ermaster-k    文件:RelationByExistingColumnsDialog.java   
private NormalColumn getSelectedColumn(TableEditor tableEditor) {
    Combo foreignKeyCombo = (Combo) tableEditor.getEditor();
    int foreignKeyComboIndex = foreignKeyCombo.getSelectionIndex();
    int startIndex = 1;

    NormalColumn foreignKeyColumn = null;

    List<NormalColumn> foreignKeyList = this.editorReferencedMap
            .get(tableEditor);
    if (foreignKeyList != null) {
        if (foreignKeyComboIndex <= foreignKeyList.size()) {
            foreignKeyColumn = foreignKeyList.get(foreignKeyComboIndex
                    - startIndex);
        } else {
            startIndex += foreignKeyList.size();
        }
    }

    if (foreignKeyColumn == null) {
        foreignKeyColumn = this.candidateForeignKeyColumns
                .get(foreignKeyComboIndex - startIndex);
    }

    return foreignKeyColumn;
}
项目:ermaster-k    文件:RelationByExistingColumnsDialog.java   
@Override
protected String getErrorMessage() {
    Set<NormalColumn> selectedColumns = new HashSet<NormalColumn>();

    for (TableEditor tableEditor : this.tableEditorList) {
        Combo foreignKeyCombo = (Combo) tableEditor.getEditor();
        int index = foreignKeyCombo.getSelectionIndex();

        if (index == 0) {
            return "error.foreign.key.not.selected";
        }

        NormalColumn selectedColumn = this.getSelectedColumn(tableEditor);
        if (selectedColumns.contains(selectedColumn)) {
            return "error.foreign.key.must.be.different";
        }

        selectedColumns.add(selectedColumn);
    }

    if (this.existForeignKeySet(selectedColumns)) {
        return "error.foreign.key.already.exist";
    }

    return null;
}
项目:ermaster-k    文件:RelationByExistingColumnsDialog.java   
private void column2TableItem(NormalColumn referencedColumn) {
    TableItem tableItem = new TableItem(this.comparisonTable, SWT.NONE);

    tableItem.setText(0,
            Format.null2blank(referencedColumn.getLogicalName()));

    List<NormalColumn> foreignKeyList = this.referencedMap
            .get(referencedColumn.getRootReferencedColumn());

    TableEditor tableEditor = new TableEditor(this.comparisonTable);
    tableEditor.grabHorizontal = true;

    tableEditor.setEditor(this.createForeignKeyCombo(foreignKeyList),
            tableItem, 1);
    this.tableEditorList.add(tableEditor);
    this.editorReferencedMap.put(tableEditor, foreignKeyList);
}
项目:ermaster-k    文件:ModelPropertiesDialog.java   
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(FocusEvent e) {
            item.setText(targetColumn, text.getText());
            text.dispose();
        }

    });

    tableEditor.setEditor(text, item, targetColumn);
    text.setFocus();
    text.selectAll();
}
项目:ermaster-k    文件:ComplexUniqueKeyTabWrapper.java   
@Override
public void restruct() {
    this.columnTable.removeAll();

    this.disposeTableEditor();

    for (NormalColumn normalColumn : this.copyData.getNormalColumns()) {
        TableItem tableItem = new TableItem(this.columnTable, SWT.NONE);

        TableEditor tableEditor = CompositeFactory
                .createCheckBoxTableEditor(tableItem, false, 0);
        this.tableEditorList.add(tableEditor);
        this.editorColumnMap.put(tableEditor, normalColumn);

        tableItem.setText(1, Format.null2blank(normalColumn.getName()));
    }

    this.setComboData();
    this.setButtonStatus(false);
    this.nameText.setText("");

    this.columnTable.getColumns()[1].pack();
}
项目:ermaster-k    文件:IndexDialog.java   
private void setTableEditor(final NormalColumn normalColumn,
        TableItem tableItem, Boolean desc) {
    Button descCheckButton = new Button(this.indexColumnList, SWT.CHECK);
    descCheckButton.pack();

    if (DBManagerFactory.getDBManager(this.table.getDiagram()).isSupported(
            DBManager.SUPPORT_DESC_INDEX)) {

        TableEditor editor = new TableEditor(this.indexColumnList);

        editor.minimumWidth = descCheckButton.getSize().x;
        editor.horizontalAlignment = SWT.CENTER;
        editor.setEditor(descCheckButton, tableItem, 1);

        this.columnCheckMap.put(normalColumn, editor);
    }

    this.descCheckBoxMap.put(normalColumn, descCheckButton);
    descCheckButton.setSelection(desc.booleanValue());
}
项目:erflute    文件:ModelPropertiesDialog.java   
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(FocusEvent e) {
            item.setText(targetColumn, text.getText());
            text.dispose();
        }
    });

    tableEditor.setEditor(text, item, targetColumn);
    text.setFocus();
    text.selectAll();
}
项目:erflute    文件:RelationshipByExistingColumnsDialog.java   
private void setupRelationship() {
    newCreatedRelationship = createRelationship();
    newCreatedRelationship.setForeignKeyName(foreignKeyNameText.getText().trim());
    if (isCreateNewColumn()) {
        // TODO ymd コマンド外の操作でカラムを追加しているため、undoしてもカラムが削除されない。コマンド化する。
        for (final NormalColumn referredColumn : selectedReferredColumnList) {
            final NormalColumn newColumn = new NormalColumn(referredColumn, newCreatedRelationship, resultReferenceForPK);
            adjustNewForeignKeyColumn(newColumn);
            selectedForeignKeyColumnList.add(newColumn);
            target.addColumn(newColumn);
        }
    } else {
        for (final TableEditor mapperEditor : mapperEditorList) {
            selectedForeignKeyColumnList.add(findSelectedColumn(mapperEditor));
        }
    }
}
项目:erflute    文件:RelationshipByExistingColumnsDialog.java   
private NormalColumn findSelectedColumn(TableEditor tableEditor) { // not null
    final Combo foreignKeySelector = (Combo) tableEditor.getEditor();
    final int selectionIndex = foreignKeySelector.getSelectionIndex();
    int startIndex = 1;
    NormalColumn foreignKeyColumn = null;
    final List<NormalColumn> foreignKeyList = mapperEditorToReferredColumnsMap.get(tableEditor);
    if (foreignKeyList != null) {
        if (selectionIndex <= foreignKeyList.size()) {
            foreignKeyColumn = foreignKeyList.get(selectionIndex - startIndex);
        } else {
            startIndex += foreignKeyList.size();
        }
    }
    if (foreignKeyColumn == null) {
        foreignKeyColumn = candidateForeignKeyColumns.get(selectionIndex - startIndex);
    }
    return foreignKeyColumn;
}
项目:erflute    文件:MainWalkerGroupManageDialog.java   
private void initNodeTable() {
    nodeTable.removeAll();
    nodeCheckMap = new HashMap<>();
    for (final DiagramWalker walker : getTableWalkers()) {
        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, DisplayMessages.getMessage("label.object.type." + walker.getObjectType()));
        tableItem.setText(2, walker.getName());
        nodeCheckMap.put(walker, editor);
    }
}
项目:erflute    文件:CompoundUniqueKeyTabWrapper.java   
private void checkSelectedKey() {
    final int index = compoundUniqueKeyCombo.getSelectionIndex();
    CompoundUniqueKey complexUniqueKey = null;
    String name = null;
    if (index != -1) {
        complexUniqueKey = table.getCompoundUniqueKeyList().get(index);
        name = complexUniqueKey.getUniqueKeyName();
        setUpdateDeleteButtonStatus(true);
    } else {
        setUpdateDeleteButtonStatus(false);
    }
    uniqueKeyNameText.setText(Format.null2blank(name));
    for (final TableEditor tableEditor : tableEditorList) {
        final Button checkbox = (Button) tableEditor.getEditor();
        final NormalColumn column = editorColumnMap.get(tableEditor);
        if (complexUniqueKey != null && complexUniqueKey.getColumnList().contains(column)) {
            checkbox.setSelection(true);
        } else {
            checkbox.setSelection(false);
        }
    }
}
项目:erflute    文件:CategoryManageDialog.java   
private void initNodeTable() {
    nodeTable.removeAll();
    nodeCheckMap = new HashMap<>();
    for (final DiagramWalker nodeElement : diagram.getDiagramContents().getDiagramWalkers()) {
        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, DisplayMessages.getMessage("label.object.type." + nodeElement.getObjectType()));
        tableItem.setText(2, nodeElement.getName());

        nodeCheckMap.put(nodeElement, editor);
    }
}
项目:ermaster-nhit    文件:CompositeFactory.java   
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;
}
项目:ermaster-nhit    文件:RelationByExistingColumnsDialog.java   
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>>();
}
项目:ermaster-nhit    文件:RelationByExistingColumnsDialog.java   
/**
 * {@inheritDoc}
 */
@Override
protected void perfomeOK() {
    int index = this.columnCombo.getSelectionIndex();

    if (index < this.columnComboInfo.complexUniqueKeyStartIndex) {
        this.referenceForPK = true;

    } else if (index < this.columnComboInfo.columnStartIndex) {
        ComplexUniqueKey complexUniqueKey = this.source
                .getComplexUniqueKeyList()
                .get(index
                        - this.columnComboInfo.complexUniqueKeyStartIndex);

        this.referencedComplexUniqueKey = complexUniqueKey;

    } else {
        this.referencedColumn = this.columnComboInfo.candidateColumns
                .get(index - this.columnComboInfo.columnStartIndex);
    }

    for (TableEditor tableEditor : this.tableEditorList) {
        NormalColumn foreignKeyColumn = this.getSelectedColumn(tableEditor);
        this.foreignKeyColumnList.add(foreignKeyColumn);
    }
}
项目:ermaster-nhit    文件:RelationByExistingColumnsDialog.java   
private NormalColumn getSelectedColumn(TableEditor tableEditor) {
    Combo foreignKeyCombo = (Combo) tableEditor.getEditor();
    int foreignKeyComboIndex = foreignKeyCombo.getSelectionIndex();
    int startIndex = 1;

    NormalColumn foreignKeyColumn = null;

    List<NormalColumn> foreignKeyList = this.editorReferencedMap
            .get(tableEditor);
    if (foreignKeyList != null) {
        if (foreignKeyComboIndex <= foreignKeyList.size()) {
            foreignKeyColumn = foreignKeyList.get(foreignKeyComboIndex
                    - startIndex);
        } else {
            startIndex += foreignKeyList.size();
        }
    }

    if (foreignKeyColumn == null) {
        foreignKeyColumn = this.candidateForeignKeyColumns
                .get(foreignKeyComboIndex - startIndex);
    }

    return foreignKeyColumn;
}
项目:ermaster-nhit    文件:RelationByExistingColumnsDialog.java   
@Override
protected String getErrorMessage() {
    Set<NormalColumn> selectedColumns = new HashSet<NormalColumn>();

    for (TableEditor tableEditor : this.tableEditorList) {
        Combo foreignKeyCombo = (Combo) tableEditor.getEditor();
        int index = foreignKeyCombo.getSelectionIndex();

        if (index == 0) {
            return "error.foreign.key.not.selected";
        }

        NormalColumn selectedColumn = this.getSelectedColumn(tableEditor);
        if (selectedColumns.contains(selectedColumn)) {
            return "error.foreign.key.must.be.different";
        }

        selectedColumns.add(selectedColumn);
    }

    if (this.existForeignKeySet(selectedColumns)) {
        return "error.foreign.key.already.exist";
    }

    return null;
}
项目:ermaster-nhit    文件:RelationByExistingColumnsDialog.java   
private void column2TableItem(NormalColumn referencedColumn) {
    TableItem tableItem = new TableItem(this.comparisonTable, SWT.NONE);

    tableItem.setText(0,
            Format.null2blank(referencedColumn.getLogicalName()));

    List<NormalColumn> foreignKeyList = this.referencedMap
            .get(referencedColumn.getRootReferencedColumn());

    TableEditor tableEditor = new TableEditor(this.comparisonTable);
    tableEditor.grabHorizontal = true;

    tableEditor.setEditor(this.createForeignKeyCombo(foreignKeyList),
            tableItem, 1);
    this.tableEditorList.add(tableEditor);
    this.editorReferencedMap.put(tableEditor, foreignKeyList);
}
项目:ermaster-nhit    文件:ModelPropertiesDialog.java   
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(FocusEvent e) {
            item.setText(targetColumn, text.getText());
            text.dispose();
        }

    });

    tableEditor.setEditor(text, item, targetColumn);
    text.setFocus();
    text.selectAll();
}
项目:ermaster-nhit    文件:ComplexUniqueKeyTabWrapper.java   
@Override
public void restruct() {
    this.columnTable.removeAll();

    this.disposeTableEditor();

    for (NormalColumn normalColumn : this.copyData.getNormalColumns()) {
        TableItem tableItem = new TableItem(this.columnTable, SWT.NONE);

        TableEditor tableEditor = CompositeFactory
                .createCheckBoxTableEditor(tableItem, false, 0);
        this.tableEditorList.add(tableEditor);
        this.editorColumnMap.put(tableEditor, normalColumn);

        tableItem.setText(1, Format.null2blank(normalColumn.getName()));
    }

    this.setComboData();
    this.setButtonStatus(false);
    this.nameText.setText("");

    this.columnTable.getColumns()[1].pack();
}
项目:ermaster-nhit    文件:IndexDialog.java   
private void setTableEditor(final NormalColumn normalColumn,
        TableItem tableItem, Boolean desc) {
    Button descCheckButton = new Button(this.indexColumnList, SWT.CHECK);
    descCheckButton.pack();

    if (DBManagerFactory.getDBManager(this.table.getDiagram()).isSupported(
            DBManager.SUPPORT_DESC_INDEX)) {

        TableEditor editor = new TableEditor(this.indexColumnList);

        editor.minimumWidth = descCheckButton.getSize().x;
        editor.horizontalAlignment = SWT.CENTER;
        editor.setEditor(descCheckButton, tableItem, 1);

        this.columnCheckMap.put(normalColumn, editor);
    }

    this.descCheckBoxMap.put(normalColumn, descCheckButton);
    descCheckButton.setSelection(desc.booleanValue());
}
项目:sadlos2    文件:ReasonerSettingsTableFieldEditor.java   
private void updateCellControls() {
    final TableItem[] items = table.getItems();
    for (int i = 0; i < items.length; i++) {
        TableEditor editor = new TableEditor(table);
        final Text text = new Text(table, SWT.NONE);
        text.setText(items[i].getText(2));
        final int index = i;
        text.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(ModifyEvent e) {
                items[index].setText(2, text.getText());

            }
        });
        editor.grabHorizontal = true;
        editor.setEditor(text, items[i], 2);
    }

}
项目:sadlos2    文件:ReasonerSettingsTableFieldEditor.java   
private void updateCellControls() {
    final TableItem[] items = table.getItems();
    for (int i = 0; i < items.length; i++) {
        TableEditor editor = new TableEditor(table);
        final Text text = new Text(table, SWT.NONE);
        text.setText(items[i].getText(2));
        final int index = i;
        text.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(ModifyEvent e) {
                items[index].setText(2, text.getText());

            }
        });
        editor.grabHorizontal = true;
        editor.setEditor(text, items[i], 2);
    }

}
项目:wt-studio    文件:CreateConfigChartPage.java   
public void CreateTableText(Table table, TableItem item, final int i)
{
    final TableEditor editor = new TableEditor(table);
    editors.add(editor);
    final Text text = new Text(table, SWT.NONE);
    text.setText(item.getText(i));
    editor.grabHorizontal = true;
    editor.setEditor(text, item, i);
    text.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent evt)
        {
            editor.getItem().setText(i, text.getText());
            updateygroup();
        }

    });

}