Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ColumnLayoutData


    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


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

        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) {
View Full Code Here

        int numberOfWeightColumns = 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;
                }
                widths[i] = pixels;
                fixedWidth += pixels;
            } else if (col instanceof  ColumnWeightData) {
                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();
                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.
            int rest = width - fixedWidth;
            int totalDistributed = 0;
            for (int i = 0; i < size; ++i) {
                ColumnLayoutData col = (ColumnLayoutData) columns
                        .get(i);
                if (col instanceof  ColumnWeightData) {
                    ColumnWeightData cw = (ColumnWeightData) col;
                    // calculate weight as above
                    // int weight = firstTime ? cw.weight : tableColumns[i].getWidth();
                    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;
                ColumnLayoutData col = (ColumnLayoutData) columns
                        .get(i);
                if (col instanceof  ColumnWeightData) {
                    ++widths[i];
                    --diff;
                }
View Full Code Here

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

    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 numberOfWeightColumns = 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;
        }
        widths[i] = pixels;
        fixedWidth += pixels;
      } else if (col instanceof ColumnWeightData) {
        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();
        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.
      int rest = width - fixedWidth;
      int totalDistributed = 0;
      for (int i = 0; i < size; ++i) {
        ColumnLayoutData col = (ColumnLayoutData) columns.get(i);
        if (col instanceof ColumnWeightData) {
          ColumnWeightData cw = (ColumnWeightData) col;
          // calculate weight as above
          // int weight = firstTime ? cw.weight :
          // tableColumns[i].getWidth();
          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;
        ColumnLayoutData col = (ColumnLayoutData) 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 += 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 = getLayoutData(scrollable,i);
      if (col instanceof ColumnPixelData) {
        ColumnPixelData cpd = (ColumnPixelData) col;
        int pixels = cpd.width;
        if (cpd.addTrim) {
          pixels += 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.