Java 类org.eclipse.swt.widgets.ExpandItem 实例源码

项目:convertigo-eclipse    文件:ComponentExplorerComposite.java   
private void refresh() {
    //Display.getDefault().timerExec(1, new Runnable()
    Display.getDefault().asyncExec(new Runnable()
    {
        @Override
        public void run()
        {
            for (ExpandItem expandItem : bar.getItems()) {
                Point size = expandItem.getControl().getSize();
                Point size2 = expandItem.getControl().computeSize(size.x,SWT.DEFAULT);
                expandItem.setHeight(size2.y);
            }

            Rectangle r = scrolledComposite.getClientArea();
            scrolledComposite.setMinSize(bar.computeSize(r.width, SWT.DEFAULT));
            scrolledComposite.layout(true, true);
        }
    });
}
项目:Hydrograph    文件:TransformDialog.java   
private boolean checkIfSchemaIsBlank(List<FilterProperties> filterProperties) {
    if(filterProperties.isEmpty())
    {

        transformMapping.getOutputFieldList().clear();
        for(MappingSheetRow mappingSheetRow:transformMapping.getMappingSheetRows())
        {
            mappingSheetRow.getOutputList().clear();
        }
        for(ExpandItem item:expandBar.getItems())
        {

            TableViewer tableViewer=(TableViewer)item.getData(OUTPUT_TABLE_VIEWER);
            if(tableViewer!=null)
            tableViewer.refresh();
        }
        transformMapping.getMapAndPassthroughField().clear();
        mappingTableViewer.refresh();
        finalSortedList.clear();
        outputFieldViewer.refresh();

    }
    return filterProperties.isEmpty();
}
项目:tlaplus    文件:ObligationsView.java   
/**
 * Removes the item from the view, performing necessary
 * cleanup.
 * 
 * @param item
 */
private void removeItem(ExpandItem item)
{
    // remove the source viewer's control from the
    // font listener since it no longer needs to be
    // notified of font changes.
    fontListener.removeControl(((SourceViewer) viewers.get(item)).getControl());

    // retrieve the id for the item
    // the id is stored in the item's data, which should be a marker,
    // as set in the updateItem method
    final Object data = item.getData(KEY);
    items.remove(Integer.parseInt(data.toString()));

    item.getControl().dispose();
    item.dispose();
}
项目:convertigo-eclipse    文件:ComponentExplorerComposite.java   
private void removeItems() {
    ExpandItem[] items = bar.getItems();
    for (int i = items.length - 1; i >= 0; i--)
    {
        items[i].getControl().dispose();
        items[i].dispose();
    }
}
项目:Hydrograph    文件:TransformDialog.java   
private void attachListenerOnSwitchToClassButton(
            final ExpandItem expandItem,
            final OperationClassComposite operationClassComposite,
            final AbstractExpressionComposite expressionComposite) {
        expressionComposite.getSwitchToClassButton().addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) 
            {
                Button toggleButton=(Button)e.widget;
                if(toggleButton.getSelection())
                {
                    toggleButton.setSelection(false);
                    expandItem.setControl(operationClassComposite);
                    expandItem.setText(operationClassComposite.getOperationIdTextBox().getText());
                    MappingSheetRow mappingSheetRowForExpressionClass=(MappingSheetRow)expressionComposite.getData(Messages.MAPPING_SHEET);
                    MappingSheetRow mappingSheetRowForOperationClass=
                            (MappingSheetRow)operationClassComposite.getBrowseButton().getData(Messages.MAPPING_SHEET);
                    removeExpressionOrOperationOutputFieldFromOutputList(mappingSheetRowForExpressionClass);
                    transformMapping.getOutputFieldList().addAll(mappingSheetRowForOperationClass.getOutputList());
                    mappingSheetRowForExpressionClass.setActive(false);
                    mappingSheetRowForOperationClass.setActive(true);
                    operationClassComposite.getSwitchToClassButton().setSelection(true);
                    expressionComposite.setVisible(false);
                    operationClassComposite.setVisible(true);
                    setDuplicateOperationInputFieldMap(mappingSheetRowForOperationClass);
                    refreshOutputTable();
                    showHideValidationMessage();
                    if(Constants.AGGREGATE.equalsIgnoreCase(component.getComponentName())||
                           Constants.TRANSFORM.equalsIgnoreCase(component.getComponentName()) ||
                         Constants.GROUP_COMBINE.equalsIgnoreCase(component.getComponentName()))
                        {
//                          expandItem.setHeight(220);
//                          middleSashForm.setWeights(new int[] {54, 59, 25});
                            scrolledComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
                        }
                    }   
            }
        });
    }
项目:Hydrograph    文件:TransformDialog.java   
private void attachModifyListenerToIdTextBox(
        final MappingSheetRow mappingSheetRow,Text operationIDTextBox) {
    operationIDTextBox.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            Text textBox = (Text) e.widget;

            ExpandItem expandItem = (ExpandItem) textBox.getData();

            expandItem.setText(textBox.getText());
            mappingSheetRow.setOperationID(textBox.getText());
        }
    });
}
项目:Hydrograph    文件:TransformDialog.java   
private void syncTransformFieldsWithSchema() {

    List<FilterProperties> filterProperties = convertSchemaToFilterProperty();
    if(checkIfSchemaIsBlank(filterProperties))
    {
    return;
    }   
    SchemaSyncUtility.INSTANCE.removeOpFields(filterProperties, transformMapping,
            transformMapping.getMappingSheetRows(),component.getComponentName());
    Schema schema = (Schema) component.getProperties().get(Constants.SCHEMA_PROPERTY_NAME);
    List<NameValueProperty> outputFileds= SchemaSyncUtility.INSTANCE.getComponentSchemaAsProperty(schema.getGridRow());
    SchemaSyncUtility.INSTANCE.filterCommonMapFields(outputFileds, transformMapping);
    Map<Integer,FilterProperties> indexValueParameterMap=SchemaSyncUtility.INSTANCE.retainIndexAndValueOfParameterFields
            (transformMapping.getOutputFieldList());
    transformMapping.getOutputFieldList().clear();
    SchemaSyncUtility.INSTANCE.addOperationFieldAndMapPassthroughfieldToOutputField(transformMapping);
    List<FilterProperties> finalSortedList=SchemaSyncUtility.INSTANCE.
            sortOutputFieldToMatchSchemaSequence(filterProperties,transformMapping);
    transformMapping.getOutputFieldList().clear();
    transformMapping.getOutputFieldList().addAll(finalSortedList);
    SchemaSyncUtility.INSTANCE.addParamtereFieldsToSameIndexAsBeforePull(indexValueParameterMap,transformMapping);
    refreshOutputTable();
    for(ExpandItem item:expandBar.getItems())
    {
        TableViewer tableViewer=(TableViewer)item.getData(OUTPUT_TABLE_VIEWER);
        if(tableViewer!=null)
        tableViewer.refresh();
    }
}
项目:Hydrograph    文件:TransformDialog.java   
public void refresh(){
    for(ExpandItem expandItem:expandBar.getItems()){
        expandItem.setExpanded(false);
        expandItem.dispose();
    }
    isAllPassthrougButton.setSelection(transformMapping.isAllInputFieldsArePassthrough());
    loadExpressionAndOperationData();       
    mappingTableViewer.refresh();
    refreshOutputTable();
    showHideValidationMessage();


}
项目:TranskribusSwtGui    文件:StructuralMetadataWidget.java   
private void initExpandItmes() {
        ExpandItem item1 = new ExpandItem (bar, SWT.NONE, 0);
        item1.setText("Structure");
        item1.setHeight(structureGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
        item1.setControl(structureGroup);       
        item1.setExpanded(true);

//      ExpandItem item3 = new ExpandItem (bar, SWT.NONE, 2);
//      item3.setText("Text-Style");
//      item3.setHeight(textStyleWidget.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
//      item3.setControl(textStyleWidget);
//      item3.setExpanded(true);
    }
项目:tlaplus    文件:ObligationsView.java   
public ObligationsView()
{
    items = new HashMap<Integer, ExpandItem>();
    viewers = new HashMap<ExpandItem, SourceViewer>();
    fontListener = new FontPreferenceChangeListener(null, JFaceResources.TEXT_FONT);
    JFaceResources.getFontRegistry().addListener(fontListener);
}
项目:kettle-4.4.0-stable    文件:MarketplaceDialog.java   
private void setPluginName(ExpandItem expandItem, String name, boolean isInstalled) {
  if (isInstalled) {
    expandItem.setText(BaseMessages.getString(MARKET_PKG, "Marketplaces.Dialog.PluginInstalled.message", name));
  } else {
    expandItem.setText(BaseMessages.getString(MARKET_PKG, "Marketplaces.Dialog.PluginNotInstalled.message", name));
  }
}
项目:kettle-trunk    文件:MarketplaceDialog.java   
private void setPluginName(ExpandItem expandItem, String name, boolean isInstalled) {
  if (isInstalled) {
    expandItem.setText(BaseMessages.getString(MARKET_PKG, "Marketplaces.Dialog.PluginInstalled.message", name));
  } else {
    expandItem.setText(BaseMessages.getString(MARKET_PKG, "Marketplaces.Dialog.PluginNotInstalled.message", name));
  }
}
项目:atdl4j    文件:SWTStrategyPanelHelper.java   
/**
 * Navigates through aWidget's getParent() looking for ExpandBar with ExpandItems not-yet-expanded and expands those
 * @param aWidget
 * @return boolean indicating whether any ExpandBar ExpandItems were adjusted
 */
public boolean expandAtdl4jWidgetParentStrategyPanel( Atdl4jWidget<?> aWidget )
{
    boolean tempAdjustedFlag = false;
    if ( ( aWidget.getParent() != null ) && ( aWidget.getParent() instanceof Composite ) )
    {
        Composite tempParent = (Composite) aWidget.getParent();

        while ( tempParent != null ) 
        {
            // -- Expand if necessary --
            if ( tempParent instanceof ExpandBar )
            {
                ExpandBar tempExpandBar = (ExpandBar) tempParent;
                for ( ExpandItem tempExpandItem : tempExpandBar.getItems() )
                {
                    if ( ! tempExpandItem.getExpanded() )
                    {
                        tempExpandItem.setExpanded( true );
                        // -- (relayoutParents=false) --
                        relayoutExpandBar( tempExpandBar, false );
                        tempAdjustedFlag = true;
                    }
                }
            }

            // -- Iterate to next parent --
            if ( ( tempParent.getParent() != null ) && ( ( tempParent.getParent() instanceof Composite ) ) )
            {
                tempParent = (Composite) tempParent.getParent();
            }
            else
            {
                break;
            }
        }
    }

    return tempAdjustedFlag;
}
项目:Hydrograph    文件:JoinMapDialog.java   
private void createInputFieldExpandBarSection(Composite composite) {
    Composite composite_1 = new Composite(composite, SWT.NONE);
    GridLayout gl_composite_1 = new GridLayout(1, false);
    gl_composite_1.horizontalSpacing = 0;
    gl_composite_1.verticalSpacing = 0;
    gl_composite_1.marginWidth = 0;
    gl_composite_1.marginHeight = 0;
    composite_1.setLayout(gl_composite_1);
    GridData gd_composite_1 = new GridData(SWT.FILL, SWT.FILL, false, true,
            1, 1);
    gd_composite_1.widthHint = 276;
    composite_1.setLayoutData(gd_composite_1);
    composite_1.setBounds(0, 0, 64, 64);

    final ScrolledComposite scrolledComposite_1 = new ScrolledComposite(
            composite_1, SWT.BORDER | SWT.V_SCROLL );
    scrolledComposite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
            true, true, 1, 1));
    scrolledComposite_1.setExpandHorizontal(true);
    scrolledComposite_1.setExpandVertical(true);

    Composite composite_7 = new Composite(scrolledComposite_1, SWT.NONE);
    composite_7.setLayout(new GridLayout(1, false));

    final ExpandBar expandBar = new ExpandBar(composite_7, SWT.H_SCROLL);
    expandBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1,
            1));

    expandBar.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 240, 240, 240));
    populateInputFieldExpandBarSection(expandBar);

    expandBar.getItem(0).setExpanded(true);

    scrolledComposite_1.setContent(composite_7);
    scrolledComposite_1.setMinSize(composite_7.computeSize(SWT.DEFAULT,
            SWT.DEFAULT));


    composite_7.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {

            for(ExpandItem expandItem:expandBar.getItems()){
                ((TableColumn)expandItem.getData("TableColumn")).setWidth(scrolledComposite_1.getSize().x);
            }
        }
    });
}
项目:Hydrograph    文件:OperationClassDeleteDialog.java   
@Override
protected void okPressed() {
    for (ExpandItem expandItem : expandBar.getItems()) {

        for (Object object : checkboxTableViewer.getCheckedElements()) {
            if (expandItem.getText().equals(object.toString())) {
                expandItem.setExpanded(false);
                for (int i = 0; i < mappingSheetRowList.size(); i++) {
                    if (mappingSheetRowList.get(i).getOperationID().equals(object.toString())) 
                    {
                    for(FilterProperties filterProperties:mappingSheetRowList.get(i).getOutputList())
                        {   
                        int index=-1;   
                        for(int j=0;j<outerOutputList.size();j++)
                        {
                            if(outerOutputList.get(j)==filterProperties)
                            {
                                index=j;
                                break;
                            }   
                        }
                        if(index!=-1)
                        outerOutputList.remove(index);
                        }

                        if(mappingSheetRowList.get(i).isExpression())
                        {
                            mappingSheetRowList.remove(i);
                            mappingSheetRowList.remove(i-1);

                        }
                        else
                        {
                            mappingSheetRowList.remove(i+1);
                            mappingSheetRowList.remove(i);
                        }

                    break;
                    }
                }
                expandItem.dispose();
                   break;
            }
        }
    }
    super.okPressed();
}
项目:Hydrograph    文件:TransformDialog.java   
private void addExpandItem(final ScrolledComposite scrollBarComposite) 
{
    final ExpandItem expandItem = new ExpandItem(expandBar, SWT.V_SCROLL);
    expandItem.setExpanded(true);
    if (OSValidator.isMac()) {
        if (Constants.AGGREGATE.equalsIgnoreCase(component.getComponentName())
                || Constants.CUMULATE.equalsIgnoreCase(component.getComponentName())) {
            expandItem.setHeight(415);
        } else if (Constants.GROUP_COMBINE.equalsIgnoreCase(component.getComponentName())) {
            expandItem.setHeight(460);
        } else {
            expandItem.setHeight(362);
        }
    } else if (Constants.AGGREGATE.equalsIgnoreCase(component.getComponentName())
            || Constants.CUMULATE.equalsIgnoreCase(component.getComponentName())) {
        expandItem.setHeight(409);
    } else if (Constants.GROUP_COMBINE.equalsIgnoreCase(component.getComponentName())) {
        expandItem.setHeight(450);
    } else {
        expandItem.setHeight(350);
    }
    expandBar.addListener(SWT.MouseUp, new Listener() {

        @Override
        public void handleEvent(Event event) {
            scrollBarComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        }
    });
    final OperationClassComposite operationClassComposite = createOperationClassComposite(expandItem);
    final AbstractExpressionComposite expressionComposite = createExpressionComposite(expandItem,
            operationClassComposite);
    if (mappingSheetRowForExpression.isActive()) {
        expandItem.setControl(expressionComposite);
        expandItem.setText(mappingSheetRowForExpression.getOperationID());
    } else if (mappingSheetRowForOperationClass.isActive()) {
        expandItem.setControl(operationClassComposite);
        expandItem.setText(mappingSheetRowForOperationClass.getOperationID());

    }
    if (!Constants.NORMALIZE.equalsIgnoreCase(component.getComponentName())) {
        attachListenerOnSwitchToClassButton(expandItem, operationClassComposite, expressionComposite);
        attachListenerOnSwitchToExpressiomButton(expandItem, operationClassComposite, expressionComposite);
    }
    showHideValidationMessage();
    scrollBarComposite.setContent(expandBar);
    scrollBarComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
项目:Hydrograph    文件:TransformDialog.java   
private void attachListenerOnSwitchToExpressiomButton(final ExpandItem expandItem,
            final OperationClassComposite operationClassComposite,
            final AbstractExpressionComposite expressionComposite) {
        operationClassComposite.getSwitchToExpressionButton().addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                Button toggleButton = (Button) e.widget;
                if (toggleButton.getSelection()) {
                    toggleButton.setSelection(false);
                    expandItem.setControl(expressionComposite);
                    expandItem.setText(expressionComposite.getExpressionIdTextBox().getText());
                    MappingSheetRow mappingSheetRowForExpressionClass = (MappingSheetRow) expressionComposite
                            .getData(Messages.MAPPING_SHEET);
                    MappingSheetRow mappingSheetRowForOperationClass = (MappingSheetRow) operationClassComposite
                            .getBrowseButton().getData(Messages.MAPPING_SHEET);
                    mappingSheetRowForOperationClass.setActive(false);
                    mappingSheetRowForExpressionClass.setActive(true);
                    expressionComposite.getSwitchToExpressionButton().setSelection(true);
                    removeExpressionOrOperationOutputFieldFromOutputList(mappingSheetRowForOperationClass);
                    transformMapping.getOutputFieldList().addAll(mappingSheetRowForExpressionClass.getOutputList());
                    expressionComposite.setVisible(true);
                    operationClassComposite.setVisible(false);
                    setDuplicateOperationInputFieldMap(mappingSheetRowForExpressionClass);
                    refreshOutputTable();
                    showHideValidationMessage();
                    if (Constants.AGGREGATE.equalsIgnoreCase(component.getComponentName())
                            || Constants.TRANSFORM.equalsIgnoreCase(component.getComponentName())
                            || Constants.CUMULATE.equalsIgnoreCase(component.getComponentName())) {
//                      expandItem.setHeight(289);
//                      middleSashForm.setWeights(new int[] { 65, 54, 23 });
                        scrolledComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
                    } else if (Constants.GROUP_COMBINE.equalsIgnoreCase(component.getComponentName())) {
//                      expandItem.setHeight(340);
//                      middleSashForm.setWeights(new int[] { 85, 44, 23 });
                        scrolledComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
                    }
                }
            }
        });
    }
项目:Hydrograph    文件:TransformDialog.java   
private AbstractExpressionComposite createExpressionComposite(
        final ExpandItem expandItem,
        final OperationClassComposite operationClassComposite) {
    final AbstractExpressionComposite expressionComposite=ExpressionCompositeFactory.INSTANCE.
            getComposite(expandBar,mappingSheetRowForExpression,getComponent(),widgetConfig);
    expressionComposite.setTransformDialog(this);
    expressionComposite.setTransformMapping(transformMapping);

    expressionComposite.getExpressionIdTextBox().setText(mappingSheetRowForExpression.getOperationID());
        expressionComposite.getExpressionIdTextBox().setData(expandItem);
        expressionComposite.setData(Messages.MAPPING_SHEET, mappingSheetRowForExpression);
        OperationClassConfig configurationForTransformWidget;
        configurationForTransformWidget = (OperationClassConfig) widgetConfig;
        if (StringUtils.equalsIgnoreCase(Constants.AGGREGATE, configurationForTransformWidget.getComponentName())
            || StringUtils.equalsIgnoreCase(Constants.CUMULATE,configurationForTransformWidget.getComponentName())
            || StringUtils.equalsIgnoreCase(Constants.GROUP_COMBINE,configurationForTransformWidget.getComponentName())) {
        addModifyListenerToComboDataTypes(expressionComposite.getComboDataTypes(),expressionComposite,mappingSheetRowForExpression);
        addModifyListenerToAccumulator(expressionComposite.getTextAccumulator(),expressionComposite,mappingSheetRowForExpression);
        addModifyListnerToAccumulatorIsParameter(expressionComposite.getIsParamAccumulator(),mappingSheetRowForExpression);
    if(StringUtils.isNotBlank(mappingSheetRowForExpression.getAccumulator()))
        expressionComposite.getTextAccumulator().setText(mappingSheetRowForExpression.getAccumulator());
        }
        addListenerForRowHighlighting(expressionComposite);
        addModifyListenerToOperationClassAndExpressionTextBox(expressionComposite.getExressionTextBox());
        if(StringUtils.equalsIgnoreCase(Constants.GROUP_COMBINE,configurationForTransformWidget.getComponentName())){
        addModifyListenerToOperationClassAndExpressionTextBox(expressionComposite.getExressionTextBox2());
        }
        attachModifyListenerToIdTextBox(mappingSheetRowForExpression, expressionComposite.getExpressionIdTextBox());
        attachFocusListenerToIdTextBox(expressionComposite.getExpressionIdTextBox());
        addIsParamSelectionListener(expressionComposite.getIsParamButton(), mappingSheetRowForExpression);
        operationalInputFieldTableViewer=expressionComposite.getTableViewer();
        operationalInputFieldTableViewer = setTableViewer(operationalInputFieldTableViewer,
                 operationalInputFieldTableViewer.getControl().getParent(), new String[] {Messages.INNER_OPERATION_INPUT_FIELD },
                new ELTFilterContentProvider());
    if (OSValidator.isMac()) {
        operationalInputFieldTableViewer.getTable().getColumn(0).setWidth(147);
    } else {
        operationalInputFieldTableViewer.getTable().getColumn(0).setWidth(145);
    }
         operationalInputFieldTableViewer.setInput(mappingSheetRowForExpression.getInputFields());
         operationalInputFieldTableViewer.setCellModifier(new ELTCellModifier(operationalInputFieldTableViewer,
                 this,mappingSheetRowForExpression));
         operationalInputFieldTableViewer.setLabelProvider(new ELTFilterLabelProvider());
         attachFocuListenerToParamaterTextBox(expressionComposite.getParameterTextBox());
         addModifyAndFocusListenerToOutputField(expressionComposite.getOutputFieldTextBox(),mappingSheetRowForExpression);
         DragDropTransformOpImp dragDropTransformOpImpnew = new DragDropTransformOpImp
              (this,transformMapping,mappingSheetRowForExpression.getInputFields(),true,true,operationalInputFieldTableViewer,expressionComposite);
         DragDropUtility.INSTANCE.applyDrop(operationalInputFieldTableViewer, dragDropTransformOpImpnew);
         intializeFunctionalityToExpressionWidget(expressionComposite,mappingSheetRowForExpression,operationalInputFieldTableViewer);
         operationalInputTableDoubleClick(mappingSheetRowForExpression,operationalInputFieldTableViewer);  
         return expressionComposite;
}
项目:Hydrograph    文件:TransformDialog.java   
private OperationClassComposite createOperationClassComposite(
        final ExpandItem expandItem) {
    final OperationClassComposite operationClassComposite=new OperationClassComposite(this,expandBar, 
            SWT.NONE,mappingSheetRowForOperationClass,getComponent(),widgetConfig,transformMapping);
    expandItem.setData(OUTPUT_TABLE_VIEWER, operationClassComposite.getOutputTableViewer());
    operationClassComposite.getOperationIdTextBox().setText(mappingSheetRowForOperationClass.getOperationID());
    operationClassComposite.getOperationIdTextBox().setData(expandItem); 
    addListenerForRowHighlightingForOperationComposite(operationClassComposite);
    addModifyListenerToOperationClassAndExpressionTextBox(operationClassComposite.getOperationTextBox());
    attachModifyListenerToIdTextBox(mappingSheetRowForOperationClass, operationClassComposite.getOperationIdTextBox());
    attachFocusListenerToIdTextBox(operationClassComposite.getOperationIdTextBox());
    addIsParamSelectionListenerForOperationClassWidget(operationClassComposite.getBtnIsParam(), mappingSheetRowForOperationClass);
    operationalInputFieldTableViewer=operationClassComposite.getInputTableViewer();
    operationalInputFieldTableViewer = setTableViewer(operationalInputFieldTableViewer,
             operationalInputFieldTableViewer.getControl().getParent(), new String[] {Messages.INNER_OPERATION_INPUT_FIELD },
            new ELTFilterContentProvider());
    if (OSValidator.isMac()) {
        operationalInputFieldTableViewer.getTable().getColumn(0).setWidth(147);
    } else {
        operationalInputFieldTableViewer.getTable().getColumn(0).setWidth(145);
    }
     operationalInputFieldTableViewer.setInput(mappingSheetRowForOperationClass.getInputFields());
     operationalInputFieldTableViewer.setCellModifier(new ELTCellModifier(operationalInputFieldTableViewer, this,
             mappingSheetRowForOperationClass));
     operationalInputFieldTableViewer.setLabelProvider(new ELTFilterLabelProvider());
     CellEditor[] editor=operationalInputFieldTableViewer.getCellEditors();
         fieldNameDecorator = WidgetUtility.addDecorator(editor[0].getControl(),Messages.FIELDNAME_SHOULD_NOT_BE_BLANK);
         isFieldNameAlphanumericDecorator=WidgetUtility.addDecorator(editor[0].getControl(),Messages.FIELDNAME_NOT_ALPHANUMERIC_ERROR); 
         editors[0].setValidator(new TransformCellEditorFieldValidator(fieldNameDecorator,isFieldNameAlphanumericDecorator));
     isFieldNameAlphanumericDecorator.setMarginWidth(8);
     fieldNameDecorator.setMarginWidth(8);

         operationalOutputFieldTableViewer=operationClassComposite.getOutputTableViewer();
     operationalOutputFieldTableViewer = setTableViewer(operationalOutputFieldTableViewer,
             operationalOutputFieldTableViewer.getControl().getParent(), new String[] {Messages.INNER_OPERATION_OUTPUT_FIELD },
            new ELTFilterContentProvider());
     if (OSValidator.isMac()) {
         operationalOutputFieldTableViewer.getTable().getColumn(0).setWidth(147);
        } else {
            operationalOutputFieldTableViewer.getTable().getColumn(0).setWidth(145);
        }
     operationalOutputFieldTableViewer.setCellModifier(new ELTCellModifier(operationalOutputFieldTableViewer, this));
     operationalOutputFieldTableViewer.setInput(mappingSheetRowForOperationClass.getOutputList());
     operationalOutputFieldTableViewer.setLabelProvider(new ELTFilterLabelProvider());

     CellEditor[] operationalOutputFieldEditor=operationalOutputFieldTableViewer.getCellEditors();
     ControlDecoration operationalOutputfieldDecorator = WidgetUtility.addDecorator(operationalOutputFieldEditor[0].getControl(),Messages.FIELDNAME_SHOULD_NOT_BE_BLANK);
     ControlDecoration operationalOutputfieldAlphaNumeric = WidgetUtility.addDecorator(operationalOutputFieldEditor[0].getControl(),Messages.FIELDNAME_NOT_ALPHANUMERIC_ERROR); 
     operationalOutputFieldEditor[0].setValidator(new TransformCellEditorFieldValidator(operationalOutputfieldDecorator,operationalOutputfieldAlphaNumeric));
     operationalOutputfieldAlphaNumeric.setMarginWidth(8);
     operationalOutputfieldDecorator.setMarginWidth(8);

     attachFocuListenerToParamaterTextBox(operationClassComposite.getParameterTextBox());
     addSelectionListenerToBrowseButton(operationClassComposite);
     operationClassComposite.getBrowseButton().setData(Messages.MAPPING_SHEET,mappingSheetRowForOperationClass);
     operationClassComposite.getBrowseButton().setData(OPERATION_CLASS_TEXT_BOX, operationClassComposite.getOperationTextBox());
     DragDropTransformOpImp dragDropTransformOpImpnew1 = new DragDropTransformOpImp(this,
             temporaryOutputFieldMap,
             mappingSheetRowForOperationClass.getOutputList(), mappingSheetRowForOperationClass.getInputFields(), true,
            operationalInputFieldTableViewer, operationalOutputFieldTableViewer,transformMapping.getOutputFieldList());
         DragDropUtility.INSTANCE.applyDrop(operationalInputFieldTableViewer, dragDropTransformOpImpnew1);
     intializeFunctionalityToOperationClassWidget
     (operationClassComposite, mappingSheetRowForOperationClass, operationalInputFieldTableViewer, operationalOutputFieldTableViewer);
     operationClassComposite.setVisible(false);
     operationalOutputTableDoubleClick(mappingSheetRowForOperationClass,operationalOutputFieldTableViewer); 
     operationalInputTableDoubleClick(mappingSheetRowForOperationClass,operationalInputFieldTableViewer);  
     return operationClassComposite;
}
项目:Hydrograph    文件:TransformDialog.java   
private Set<String> showErrorIfOperationClassOrExpressionBlankOrOperationIDDuplicate() 
  {
   Set<String> setToCheckDuplicates = new HashSet<String>();
   Button isParam = null;
   Text idTextBox=null;
 for(ExpandItem item:expandBar.getItems() )
{
    if(item.getControl() !=null && item.getControl().getClass()==OperationClassComposite.class)
    {
        Text operationClassTextBox=((OperationClassComposite)item.getControl()).getOperationTextBox();
        isParam=((OperationClassComposite)item.getControl()).getBtnIsParam();
        idTextBox=((OperationClassComposite)item.getControl()).getOperationIdTextBox();
        MappingSheetRow mappingSheetRow=
                (MappingSheetRow)((OperationClassComposite)item.getControl()).getBrowseButton().getData(Messages.MAPPING_SHEET);

    if(operationClassTextBox!=null)
    {
       if(StringUtils.isBlank(operationClassTextBox.getText()) && !isParam.getSelection())
       {
        intializeErrorLabelObject(idTextBox,"Operation Class must not be blank for");
       }
       else if(!isParam.getSelection()
               &&!mappingSheetRow.isClassParameter()
               && !(ValidatorUtility.INSTANCE.isClassFilePresentOnBuildPath(operationClassTextBox.getText()))
               )
       {
           intializeErrorLabelObject(idTextBox,"Java class is not present on build path of current project for");
       }    
    }
    }
    if(item.getControl() instanceof AbstractExpressionComposite)
    {
    Text expressionTextBox=((AbstractExpressionComposite)item.getControl()).getExressionTextBox();
    Text expressionTextBox2=((AbstractExpressionComposite)item.getControl()).getExressionTextBox2();
    Text outputFieldTextBox=((AbstractExpressionComposite)item.getControl()).getOutputFieldTextBox();
    idTextBox=((AbstractExpressionComposite)item.getControl()).getExpressionIdTextBox();
       isParam=((AbstractExpressionComposite)item.getControl()).getIsParamButton();
    if(expressionTextBox!=null)
    {
        if(StringUtils.isBlank(expressionTextBox.getText()) && !isParam.getSelection())
       {
        intializeErrorLabelObject(idTextBox,"Expression must not be blank for");
       }

    }

    if(expressionTextBox2!=null)
    {
        if(StringUtils.isBlank(expressionTextBox2.getText()) && !isParam.getSelection())
       {
        intializeErrorLabelObject(idTextBox,"MergeExpression must not be blank for");
       }

    }
    if(outputFieldTextBox!=null)
    {
        if(StringUtils.isBlank(outputFieldTextBox.getText()) && !isParam.getSelection())
         {
            intializeErrorLabelObject(idTextBox,"Output Field must not be blank for");
         }
    }   
    }
    if(!setToCheckDuplicates.add(idTextBox.getText())&&!isParam.getSelection())
    {
        intializeErrorLabelObject(idTextBox,"Duplicate Operation Id");
    }   
}
return setToCheckDuplicates;
 }
项目:Hydrograph    文件:TransformDialog.java   
private void addOperations() {
    if (expandBar.getItemCount()>0){
        for (ExpandItem expandItem : expandBar.getItems()) {
            expandItem.setExpanded(false);
        }
    }
    List<MappingSheetRow> activeMappingSheetRows=
            TransformMappingFeatureUtility.INSTANCE.getActiveMappingSheetRow(transformMapping.getMappingSheetRows());
    int n = activeMappingSheetRows.size()+1;
    String operationID;
    operationID= Messages.OPERATION_ID_PREFIX + n;  

    Set<String> operationIds = new HashSet<String>();

    transformMapping.getMappingSheetRows().forEach(mappingSheetRow->{
        operationIds.add(mappingSheetRow.getOperationID());
        }
    );

    //If duplicate Operation Id (for Operation)exists
    while(operationIds.contains(operationID)){
        operationID = Messages.OPERATION_ID_PREFIX + ++n;
    }
    List<FilterProperties> inputFieldListOperationClass = new ArrayList<>();
    List<FilterProperties> outputListOperationClass = new ArrayList<>();
    List<NameValueProperty> nameValuePropertyOperationClass = new ArrayList<>();
    mappingSheetRowForOperationClass = new MappingSheetRow(inputFieldListOperationClass, 
            outputListOperationClass, operationID, Messages.CUSTOM, "",
            nameValuePropertyOperationClass, false, "", false, "",false,null,null,setActiveMappingSheetForOperationClass());    
    transformMapping.getMappingSheetRows().add(mappingSheetRowForOperationClass);

    List<FilterProperties> inputFieldList = new ArrayList<>();
    List<FilterProperties> outputList = new ArrayList<>();
    List<NameValueProperty> nameValueProperty = new ArrayList<>();
    operationID=Messages.EXPRESSION_ID_PREFIX + n;

    //If duplicate Operation Id (for Expression)exists
    while(operationIds.contains(operationID)){
        operationID = Messages.EXPRESSION_ID_PREFIX + ++n;
    }

    ExpressionEditorData expressionEditorData=new ExpressionEditorData("",component.getComponentName());
    ExpressionEditorData mergeExpressionEditorDataForGroupCombine=new ExpressionEditorData("",component.getComponentName());
    mappingSheetRowForExpression = new MappingSheetRow(inputFieldList, outputList, operationID, Messages.CUSTOM, "",
            nameValueProperty, false, "", false, "",true,expressionEditorData,mergeExpressionEditorDataForGroupCombine,setActiveMappingSheetForExpression());
    transformMapping.getMappingSheetRows().add(mappingSheetRowForExpression);
    addExpandItem(scrolledComposite);
}
项目:TranskribusSwtGui    文件:ExpandBarControlsAdding.java   
public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    shell.setText("ExpandBar Example");
    ExpandBar bar = new ExpandBar(shell, SWT.V_SCROLL);
//    Image image = new Image(display, "yourFile.gif");

    // First item
    Composite composite = new Composite(bar, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
    layout.verticalSpacing = 10;
    composite.setLayout(layout);
    Button button = new Button(composite, SWT.PUSH);
    button.setText("SWT.PUSH");
    button = new Button(composite, SWT.RADIO);
    button.setText("SWT.RADIO");
    button = new Button(composite, SWT.CHECK);
    button.setText("SWT.CHECK");
    button = new Button(composite, SWT.TOGGLE);
    button.setText("SWT.TOGGLE");
    ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
    item0.setText("What is your favorite button");
    item0.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    item0.setControl(composite);


    ExpandItem item1 = new ExpandItem(bar, SWT.NONE, 0);
    item1.setText("What is your favorite button2");
    item1.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    Button btn = new Button(bar, SWT.PUSH);
    btn.setText("hello");
    item1.setControl(btn);    


//    item0.setImage(image);

    item0.setExpanded(true);

    bar.setSpacing(8);
    shell.setSize(400, 350);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
//    image.dispose();
    display.dispose();
  }
项目:tlaplus    文件:ProblemView.java   
/**
 * Fill data
 * @param specLoaded
 */
private void fillData(Spec specLoaded)
{
    if (specLoaded == null)
    {
        hide();
        return;
    } else
    {

        // retrieve the markers associated with the loaded spec
        IMarker[] markers = TLAMarkerHelper.getProblemMarkers(specLoaded.getProject(), null);

        if (markers == null || markers.length == 0)
        {
            hide();
        }

        // sort the markers
        List<IMarker> markersList = new ArrayList<IMarker>(Arrays.asList(markers));
        Collections.sort(markersList, new MarkerComparator());

        // Bug fix: 2 June 2010.  It takes forever if
        // there are a large number of markers, which
        // can easily happen if you remove a definition
        // that's used hundreds of times.
        int iterations = Math.min(markers.length, 20);
        for (int j = 0; j < iterations; j++)
        {
            final IMarker problem = markersList.get(j);

            // listener
            Listener listener = new Listener() {
                // goto marker on click
                public void handleEvent(Event event)
                {
                    TLAMarkerHelper.gotoMarker(problem, ((event.stateMask & SWT.CTRL) != 0));
                }
            };

            // contents of the item
            Composite problemItem = new Composite(bar, SWT.LINE_SOLID);
            problemItem.setLayout(new RowLayout(SWT.VERTICAL));
            problemItem.addListener(SWT.MouseDown, listener);

            String[] lines = problem.getAttribute(IMarker.MESSAGE, "").split("\n");
            for (int i = 0; i < lines.length; i++)
            {
                StyledText styledText = new StyledText(problemItem, SWT.INHERIT_DEFAULT);
                styledText.setEditable(false);
                styledText.setCursor(styledText.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
                styledText.setText(lines[i]);
                styledText.addListener(SWT.MouseDown, listener);

                if (isErrorLine(lines[i], problem))
                {
                    StyleRange range = new StyleRange();
                    range.underline = true;
                    range.foreground = styledText.getDisplay().getSystemColor(SWT.COLOR_RED);
                    range.start = 0;
                    range.length = lines[i].length();
                    styledText.setStyleRange(range);
                }
            }

            ExpandItem item = new ExpandItem(bar, SWT.NONE, 0);
            item.setExpanded(true);

            String markerType = TLAMarkerHelper.getType(problem);
            item.setText(AdapterFactory.getMarkerTypeAsText(markerType) + " " + AdapterFactory.getSeverityAsText(problem.getAttribute(IMarker.SEVERITY,
                    IMarker.SEVERITY_ERROR)));
            item.setHeight(problemItem.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
            item.setControl(problemItem);
            item.addListener(SWT.MouseDown, listener);
        }
    }
    return ;
}
项目:tlaplus    文件:ObligationsView.java   
/**
  * Used to refresh the obligation view if it is currently open. If the view
  * is not currently open, this method does nothing. If the view is currently open,
  * this takes the following two steps:
  * 
  * 1.) Removes all items from the expand bar for this view.
  * 
  * 2.) Retrieve all obligation statuses by calling {@link ProverHelper#getObligationStatuses()}.
  *     Fills the view with information from these statuses.
  * 
  * 3.) If there are no interesting obligations in the view after steps 1 and 2, then
  * the view is hidden.
  */
 public static void refreshObligationView()
 {
    UIHelper.runUIAsync(new Runnable() {
/* (non-Javadoc)
 * @see java.lang.Runnable#run()
 */
public void run() {

       final ObligationsView oblView = (ObligationsView) UIHelper.findView(VIEW_ID);
       if (oblView != null)
       {

           /*
            * Remove all items in the bar.
            * 
            * For each item:
            * 1.) Dispose the item's control.
            * 2.) Dispose the item.
            * 
            * After disposing of all items, clear
            * the map of ids to items.
            */
           ExpandItem[] expandItems = oblView.bar.getItems();
           for (int i = 0; i < expandItems.length; i++)
           {
               oblView.removeItem(expandItems[i]);
           }

           /*
            * Fill the obligation view with markers from the current spec.
            * If the obligations view is empty after doing this (there are
            * no interesting obligations) then hide the view.
            */
           oblView.fillFromCurrentSpec();

           if (oblView.isEmpty())
           {
               UIHelper.getActivePage().hideView(oblView);
           }

       }
}
    });
 }
项目:Archie-Smart-IDE    文件:GraphView.java   
/*******************************************************
 * Creates the left control panel of the graph view
 * 
 * @param parent
 *            The {@link SashForm} parent of this panel
 *******************************************************/
private void createLeftControlPanel(Composite parent)
{
    // The expand bar
    ExpandBar bar = new ExpandBar(parent, SWT.V_SCROLL);

    // Create the composites of the Macro/Micro Expand Items:

    // --- 1 - The Macro composite
    Composite macroComp = new Composite(bar, SWT.BORDER | SWT.SHADOW_ETCHED_IN);
    macroComp.setLayout(new GridLayout(1, true));
    macroComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    // The enable button of the macro graph
    mEnableMacroGraph = new Button(macroComp, SWT.RADIO);
    mEnableMacroGraph.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    mEnableMacroGraph.setText("Enable Macro Graph");

    // The list of tactics for the macro graph: contains check boxes
    mMacroTactics = new Group(macroComp, SWT.BORDER | SWT.SHADOW_ETCHED_IN);
    mMacroTactics.setLayout(new GridLayout(1, true));
    mMacroTactics.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    mMacroTactics.setText("Select Tactics");

    // --- 2 - The Micro composite
    Composite microComp = new Composite(bar, SWT.BORDER | SWT.SHADOW_ETCHED_IN);
    microComp.setLayout(new GridLayout(1, true));
    microComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    // The enable button of the micro graph
    mEnableMicroGraph = new Button(microComp, SWT.RADIO);
    mEnableMicroGraph.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    mEnableMicroGraph.setText("Enable Micro Graph");

    // The list of tactics for the macro graph: contains check boxes
    mMicroTactics = new Group(microComp, SWT.BORDER | SWT.SHADOW_ETCHED_IN);
    mMicroTactics.setLayout(new GridLayout(1, true));
    mMicroTactics.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    mMicroTactics.setText("Select a Tactic");

    // Create the expand items:

    // 1 - The Macro Graph Expand Item
    mMacroExpandItem = new ExpandItem(bar, SWT.NONE);
    mMacroExpandItem.setText("Macro Graph");
    mMacroExpandItem.setImage(mImageRegistry.getImage("timIcon"));
    // Set the control of the expand item
    mMacroExpandItem.setHeight(macroComp.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    mMacroExpandItem.setControl(macroComp);

    // 2 - The Macro Graph Expand Item
    mMicroExpandItem = new ExpandItem(bar, SWT.NONE);
    mMicroExpandItem.setText("Micro Graph");
    mMicroExpandItem.setImage(mImageRegistry.getImage("timIcon"));
    // Set the control of the expand item
    mMicroExpandItem.setHeight(microComp.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    mMicroExpandItem.setControl(microComp);

    // Expand the macro item by default
    mMacroExpandItem.setExpanded(true);
    mMicroExpandItem.setExpanded(false);
}
项目:collabthings.swt    文件:ObjectContextView.java   
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public ObjectContextView(CTApp app, AppWindow window, Composite parent, int style) {
    super(parent, style);

    this.app = app;

    setLayout(new GridLayout(1, false));

    ctools = new CTComposite(this, SWT.NONE);
    ctools.setBackground(CTResourceManagerFactory.instance().getActiontitle2Background());
    ctools.setForeground(CTResourceManagerFactory.instance().getActionTitle2Color());

    GridLayout ctoolslayout = new GridLayout();
    ctoolslayout.numColumns = 10;
    ctools.setLayout(ctoolslayout);
    ctools.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));

    CTLabel ltitle = new CTLabel(ctools, SWT.NONE);

    scrolledComposite = new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL);
    scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.addListener(SWT.Resize, new Listener() {
        @Override
        public void handleEvent(Event arg0) {
            updateLayout();
        }
    });

    expandBar = new ExpandBar(scrolledComposite, SWT.NONE);
    expandBar.setBackground(CTResourceManagerFactory.instance().getControlBg());

    ExpandItem xpndtmUsedIn = new ExpandItem(expandBar, SWT.NONE);
    xpndtmUsedIn.setExpanded(true);
    xpndtmUsedIn.setText("Used in");

    cusedin = new CTComposite(expandBar, SWT.NONE);

    xpndtmUsedIn.setControl(cusedin);
    xpndtmUsedIn.setHeight(xpndtmUsedIn.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y);

    xpndtmProperties = new ExpandItem(expandBar, SWT.NONE);
    xpndtmProperties.setExpanded(true);
    xpndtmProperties.setText("Properties");

    propertiesview = new ObjectViewer(app, window, expandBar);
    xpndtmProperties.setControl(propertiesview);

    xpndtmChildren = new ExpandItem(expandBar, SWT.NONE);
    xpndtmChildren.setExpanded(true);
    xpndtmChildren.setText("children");

    createSubpartsTable();

    scrolledComposite.setContent(expandBar);
    scrolledComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    ltitle.setText("Tree");
    ltitle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));

    propertiesview.addObjectChangeListener((e) -> {
        updateLayout();
    });
}
项目:redmine.rap    文件:PlanView.java   
private void setReleaseIterations(Map<Integer, Iteration> iterations) {
        // 
        List<TableViewer>
            iterationsViewers = new ArrayList<TableViewer>();
        Rectangle bounds      = iterationsComposite.getBounds();
/*
        for (Control control : iterationsComposite.getChildren()) {
              control.dispose();
        }
*/
        if (iterationsComposite.getChildren().length > 0) {

            iterationsComposite.dispose();      
            iterationsComposite = toolkit.createComposite(planComposite, SWT.NULL);
            iterationsComposite.setLayout(new GridLayout(1, Boolean.TRUE));
            iterationsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, Boolean.TRUE, Boolean.TRUE));
        }

        ExpandBar expandBar = new ExpandBar(iterationsComposite, SWT.NONE);
        expandBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, Boolean.TRUE, Boolean.TRUE));

        Composite expandBarComposite = toolkit.createComposite(expandBar, SWT.NULL);
//      expandBarComposite.setLayout((new CustomLayout(1, Boolean.TRUE)).getLayout());
        expandBarComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, Boolean.TRUE, Boolean.TRUE));

//      iterationsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));     // TODO

        // For each iteration, paint User Stories
        for (Iteration iteration : iterations.values()) {

            ExpandItem expandItem = new ExpandItem (expandBar, SWT.NONE);
            expandItem.setText(iteration.getName());
            expandItem.setHeight(200);      
            expandItem.setExpanded(Boolean.TRUE);

            Composite iterationComposite = new Composite(expandBar, SWT.NONE);
//          iterationComposite.setLayout(new CustomLayout(1, Boolean.TRUE).getLayout());
            iterationComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, Boolean.TRUE, Boolean.TRUE));
            expandItem.setControl(iterationComposite);

            iterationComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));      // TODO

            TableViewer iterationUserStoriesViewer = new TableViewer(iterationComposite, SWT.BORDER
                                                                                    | SWT.FULL_SELECTION);
            customizeViewer(iterationUserStoriesViewer);

            iterationUserStoriesViewer.setContentProvider(new USContentProvider());
            iterationUserStoriesViewer.setInput(iteration.getUserStories());
            iterationUserStoriesViewer.setItemCount(iteration.getUserStories().size());

            iterationUserStoriesViewer.getTable().setData(iteration.getId());
            iterationUserStoriesViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, Boolean.TRUE, Boolean.TRUE));
            iterationUserStoriesViewer.getTable().setHeaderVisible(Boolean.TRUE);
            iterationUserStoriesViewer.getTable().setSize(iterationComposite.getSize().x,
                                                          iterationComposite.getSize().y);
            iterationUserStoriesViewer.getTable().setLinesVisible(Boolean.TRUE);
            iterationUserStoriesViewer.refresh(Boolean.TRUE);

            iterationsViewers.add(iterationUserStoriesViewer);

            iterationsComposite.setBounds(bounds);
        }

        // DND controls
        setDragControls();
        setDropControls(iterationsViewers);

        // DND Source/Target
        setDragSource();
        setDropTarget();
    }
项目:atdl4j    文件:SWTStrategyPanelHelper.java   
public static void relayoutExpandBar(ExpandBar expandBar, boolean relayoutParents)
{
    Composite c = expandBar;
    int tempMaxControlX = 0;

    logger.debug( "----- relayoutExpandBar (relayoutParents: " + relayoutParents + " expandBar: " + expandBar + " -----" );

    do
    {
        logger.debug( "c: " + c.getClass() + " c.getParent(): " + c.getParent().getClass() );

        if ( c instanceof ExpandBar )
        {
            ExpandBar eb = (ExpandBar) c;

            logger.debug( "ExpandBar.getSize(): " + eb.getSize() );

            for ( ExpandItem expandItem : eb.getItems() )
            {
                logger.debug( "expandItem: " + expandItem + " text: " + expandItem.getText() + " control: " + expandItem.getControl() + " controlLocation: " + expandItem.getControl().getLocation());                  
                logger.debug( "before pack(): expandItem.getControl().getSize(): " + expandItem.getControl().getSize() );

                expandItem.getControl().pack();

                if ( expandItem.getControl().getSize().x > tempMaxControlX )
                {
                    tempMaxControlX = expandItem.getControl().getSize().x;
                }

                logger.debug( "before: expandItem.getHeight(): " + expandItem.getHeight() + " expandItem.getControl().getSize(): " + expandItem.getControl().getSize() );

                expandItem.setHeight( expandItem.getControl().computeSize( eb.getSize().x, SWT.DEFAULT, true ).y );
            }

            // -- Need to set ExpandBar's GridData.widthHint to the width of the widest control within it -- 
            GridData tempGridData2 = (GridData) expandBar.getLayoutData();
            tempGridData2.widthHint = tempMaxControlX;
            // do not set height as ExpandBar handles this tempGridData2.heightHint = expandBar.getSize().y;
            expandBar.setLayoutData( tempGridData2 );


            if ( relayoutParents )
            {
                Control p = c.getParent();

                if ( p instanceof ScrolledComposite )
                {
                    ScrolledComposite scrolledComposite = (ScrolledComposite) p;
                    if ( scrolledComposite.getExpandHorizontal() || scrolledComposite.getExpandVertical() )
                    {
                        scrolledComposite.setMinSize( scrolledComposite.getContent().computeSize( SWT.DEFAULT, SWT.DEFAULT, true ) );
                    }
                    else
                    {
                        scrolledComposite.getContent().pack( true );
                    }
                }

                if ( p instanceof Composite )
                {
                    Composite composite = (Composite) p;
                    composite.layout();
                }
            }
            else
            {
                // -- this (or relayoutParents=true) is needed (otherwise ExampleStrategyPanelTests2.xml with 2 "columns" of StrategyPanels may not draw all of the ExpandBars initially) --
                expandBar.getParent().layout();
            }

        }
        c = c.getParent();
    }
    while ( c != null && c.getParent() != null && !( c instanceof ScrolledComposite ) );


    // -- Needed to ensure that strategy panel is expanded vertically as panels go from collapsed to expanded
    expandBar.getShell().layout();
    expandBar.getShell().pack();
}