Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ColumnLayoutData


        final Point result = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);

        int width = 0;
        final int size = columns.size();
        for (int i = 0; i < size; ++i) {
            final ColumnLayoutData layoutData = columns.get(i);
            if (layoutData instanceof ColumnPixelData) {
                final ColumnPixelData col = (ColumnPixelData) layoutData;
                width += col.width;
            } else if (layoutData instanceof ColumnWeightData) {
                final ColumnWeightData col = (ColumnWeightData) layoutData;
View Full Code Here


        int numberOfWeightColumns = 0;
        int totalWeight = 0;

        // First calc space occupied by fixed columns
        for (int i = 0; i < size; i++) {
            final ColumnLayoutData col = columns.get(i);
            if (col instanceof ColumnPixelData) {
                final int pixels = ((ColumnPixelData) col).width;
                widths[i] = pixels;
                fixedWidth += pixels;
            } else if (col instanceof ColumnWeightData) {
                final ColumnWeightData cw = (ColumnWeightData) col;
                numberOfWeightColumns++;
                // first time, use the weight specified by the column data,
                // otherwise use
                // the actual width as the weight
                // int weight = firstTime ? cw.weight :
                // tableColumns[i].getWidth();
                final int weight = cw.weight;
                totalWeight += weight;
            } else {
                Assert.isTrue(false, "Unknown column layout data"); //$NON-NLS-1$
            }
        }

        // Do we have columns that have a weight
        if (numberOfWeightColumns > 0) {
            // Now distribute the rest to the columns with weight.
            final int rest = width - fixedWidth;
            int totalDistributed = 0;
            for (int i = 0; i < size; ++i) {
                final ColumnLayoutData col = columns.get(i);
                if (col instanceof ColumnWeightData) {
                    final ColumnWeightData cw = (ColumnWeightData) col;
                    // calculate weight as above
                    // int weight = firstTime ? cw.weight :
                    // tableColumns[i].getWidth();
                    final int weight = cw.weight;
                    int pixels = totalWeight == 0 ? 0 : weight * rest / totalWeight;
                    if (pixels < cw.minimumWidth) {
                        pixels = cw.minimumWidth;
                    }
                    totalDistributed += pixels;
                    widths[i] = pixels;
                }
            }

            // Distribute any remaining pixels to columns with weight.
            int diff = rest - totalDistributed;
            for (int i = 0; diff > 0; ++i) {
                if (i == size) {
                    i = 0;
                }
                final ColumnLayoutData col = columns.get(i);
                if (col instanceof ColumnWeightData) {
                    ++widths[i];
                    --diff;
                }
            }
View Full Code Here

    Point result = scrollable.computeSize(wHint, hHint);

    int width = 0;
    int size = getColumnCount(scrollable);
    for (int i = 0; i < size; ++i) {
      ColumnLayoutData layoutData = getLayoutData(scrollable, i);
      if (layoutData instanceof ColumnPixelData) {
        ColumnPixelData col = (ColumnPixelData) layoutData;
        width += col.width;
        if (col.addTrim) {
          width += getColumnTrim();
View Full Code Here

    int fixedWidth = 0;
    int totalWeight = 0;

    // First calc space occupied by fixed columns
    for (int i = 0; i < numberOfColumns; i++) {
      ColumnLayoutData col = getLayoutData(scrollable, i);
      if (col instanceof ColumnPixelData) {
        ColumnPixelData cpd = (ColumnPixelData) col;
        int pixels = cpd.width;
        if (cpd.addTrim) {
          pixels += getColumnTrim();
View Full Code Here

      }
      public void widgetDefaultSelected(SelectionEvent e) {
      }
    });
   
    ColumnLayoutData columnLayoutData= new ColumnWeightData(1);
   
    TableColumn nameColumn= new TableColumn(hyperlinkDetectorTable, SWT.NONE, 0);
    nameColumn.setText(TextEditorMessages.HyperlinkDetectorTable_nameColumn);
    tableColumnlayout.setColumnData(nameColumn, columnLayoutData);
   
View Full Code Here

    Point result= table.computeSize(wHint, hHint);
   
    int width= 0;
    int size= columns.size();
    for (int i= 0; i < size; ++i) {
      ColumnLayoutData layoutData= (ColumnLayoutData) columns.get(i);
      if (layoutData instanceof ColumnPixelData) {
        ColumnPixelData col= (ColumnPixelData) layoutData;
        width += col.width;
        if (col.addTrim) {
          width += COLUMN_TRIM;
View Full Code Here

    int minWeightWidth= 0;
    int totalWeight= 0;

    // First calc space occupied by fixed columns
    for (int i= 0; i < size; i++) {
      ColumnLayoutData col= (ColumnLayoutData) columns.get(i);
      if (col instanceof ColumnPixelData) {
        ColumnPixelData cpd= (ColumnPixelData) col;
        int pixels= cpd.width;
        if (cpd.addTrim) {
          pixels += COLUMN_TRIM;
View Full Code Here

        // create the columns
        TableColumn keyColumn = new TableColumn(contextValuesTable, SWT.LEFT);
        TableColumn valueColumn = new TableColumn(contextValuesTable, SWT.LEFT);
        keyColumn.setText(Messages.ContextProperties_KeyColumn);
        valueColumn.setText(Messages.ContextProperties_ValueColumn);
        ColumnLayoutData keyColumnLayout = new ColumnWeightData(30, false);
        ColumnLayoutData valueColumnLayout = new ColumnWeightData(70, false);

        // set columns in Table layout
        TableLayout tableLayout = new TableLayout();
        tableLayout.addColumnData(keyColumnLayout);
        tableLayout.addColumnData(valueColumnLayout);
View Full Code Here

    // create the columns
    TableColumn keyColumn = new TableColumn(contextValuesTable, SWT.LEFT);
    TableColumn valueColumn = new TableColumn(contextValuesTable, SWT.LEFT);
    keyColumn.setText(Messages.FreemarkerMultiPageEditor_COLUMN_NAME);
    valueColumn.setText(Messages.FreemarkerMultiPageEditor_COLUMN_TYPE);
    ColumnLayoutData keyColumnLayout = new ColumnWeightData(30, false);
    ColumnLayoutData valueColumnLayout = new ColumnWeightData(70, false);

    // set columns in Table layout
    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(keyColumnLayout);
    tableLayout.addColumnData(valueColumnLayout);
View Full Code Here

    Point result= table.computeSize(wHint, hHint);

    int width= 0;
    int size= columns.size();
    for (int i= 0; i < size; ++i) {
      ColumnLayoutData layoutData= (ColumnLayoutData) columns.get(i);
      if (layoutData instanceof ColumnPixelData) {
        ColumnPixelData col= (ColumnPixelData) layoutData;
        width += col.width;
        if (col.addTrim) {
          width += COLUMN_TRIM;
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.ColumnLayoutData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.