Package org.eclipse.wb.draw2d.geometry

Examples of org.eclipse.wb.draw2d.geometry.Dimension


        int cellsInRow = (Integer) invokeMethod(object, "getCellCount(int)", row);
        rowCellCount.add(cellsInRow);
        for (int cell = 0; cell < cellsInRow; cell++) {
          int rowSpan = (Integer) invokeMethod(flex, "getRowSpan(int,int)", row, cell);
          int colSpan = (Integer) invokeMethod(flex, "getColSpan(int,int)", row, cell);
          cellToSpan.put(new Point(cell, row), new Dimension(colSpan, rowSpan));
        }
      }
    }
    // prepare m_columnCount as maximum count of columns in each row
    for (int row = 0; row < m_rowCount; row++) {
      int columnsInRow = 0;
      int cellsInRow = rowCellCount.get(row);
      for (int cell = 0; cell < cellsInRow; cell++) {
        int colSpan = cellToSpan.get(new Point(cell, row)).width;
        columnsInRow += colSpan;
      }
      m_columnCount = Math.max(m_columnCount, columnsInRow);
    }
    // last step: fill final m_rowCellCount and m_cellToSpan
    for (int row = 0; row < m_rowCount; row++) {
      // iterate over existing cells
      int column = 0;
      int cell = 0;
      {
        int cellsInRow = rowCellCount.get(row);
        for (; cell < cellsInRow; cell++) {
          Point key = new Point(cell, row);
          // remember existing span
          Dimension span = cellToSpan.get(key);
          m_cellToSpan.put(key, span);
          // move column index
          column += span.width;
        }
      }
      // if cells are over, but we still did not reach required number of columns...
      while (column < m_columnCount) {
        Point key = new Point(cell, row);
        // remember default span
        Dimension span = new Dimension(1, 1);
        m_cellToSpan.put(key, span);
        // next column/cell
        column++;
        cell++;
      }
View Full Code Here


              if (key.x >= cell) {
                key.x++;
              }
            }
          }
          m_cellToSpan.put(new Point(cell, row), new Dimension(1, 1));
          updateCellCount(row, +1);
        }
      } else {
        m_cellToSpan.put(new Point(cell, row), new Dimension(1, 1));
        updateCellCount(row, +1);
      }
    }
    rehashMap(m_cellToSpan);
  }
View Full Code Here

    }
    // add new row
    {
      m_rowCellCount.add(index, getColumnCount());
      for (int column = 0; column < getColumnCount(); column++) {
        m_cellToSpan.put(new Point(column, index), new Dimension(1, 1));
      }
    }
  }
View Full Code Here

  /**
   * Sets the <code>rowSpan</code> attribute of given cell.
   */
  public void setRowSpan(int row, int cell, int newSpan) {
    // set new span for cell
    Dimension span = m_cellToSpan.get(new Point(cell, row));
    span.height = newSpan;
  }
View Full Code Here

   */
  public void setColSpan(int row, int cell, int newSpan) {
    // update cell count
    int oldSpan;
    {
      Dimension span = m_cellToSpan.get(new Point(cell, row));
      oldSpan = span.width;
      // we can change span: 1 -> some value; or some value -> 1
      Assert.isTrue(oldSpan == 1 || newSpan == 1);
      // set new span for cell
      span.width = newSpan;
    }
    // update count of cells (they will be filled by fillAllCells() method)
    updateCellCount(row, oldSpan - newSpan);
    // update span table
    {
      int delta = oldSpan - newSpan;
      if (oldSpan == 1) {
        // remove cells that will be filled
        for (int i = cell + 1; i < cell + newSpan; i++) {
          m_cellToSpan.remove(new Point(i, row));
        }
        // update cells after current on same row
        for (Point key : m_cellToSpan.keySet()) {
          if (key.y == row && key.x > cell) {
            key.x += delta;
          }
        }
      } else {
        // update cells after current on same row
        for (Point key : m_cellToSpan.keySet()) {
          if (key.y == row && key.x > cell) {
            key.x += delta;
          }
        }
        // add cells that are not filled anymore
        for (int i = cell + 1; i < cell + oldSpan; i++) {
          m_cellToSpan.put(new Point(i, row), new Dimension(1, 1));
        }
      }
      // rehash
      rehashMap(m_cellToSpan);
    }
View Full Code Here

  public boolean isExistingCell(int row, int cell) throws Exception {
    if (m_isRowSpanFixed) {
      int column = getColumnOfCell(row, cell);
      for (Map.Entry<Point, Dimension> entry : m_cellToSpan.entrySet()) {
        Point location = entry.getKey();
        Dimension span = entry.getValue();
        int _row = location.y;
        int _cell = location.x;
        int _rowSpan = span.height;
        int _colSpan = span.width;
        if (_row < row && row < _row + _rowSpan) {
View Full Code Here

  public Dimension getComponentPreferredSize(IAbstractComponentInfo component) {
    return component.getPreferredSize();
  }

  public Dimension getContainerSize() {
    Dimension size = m_panel.getModelBounds().getSize().getCopy();
    Insets insets = m_panel.getClientAreaInsets();
    return size.shrink(insets.getWidth(), insets.getHeight());
  }
View Full Code Here

      protected void executeEdit() throws Exception {
        placementsSupport.commitAdd();
        Rectangle widgetModelBounds = widget.getModelBounds();
        m_panel.command_CREATE2(widget, null);
        Point location = widgetModelBounds.getLocation();
        Dimension size = getSize(widgetModelBounds);
        m_panel.command_BOUNDS(widget, location, size);
      }

      private Dimension getSize(Rectangle widgetModelBounds) {
        boolean setSize = widget.shouldSetReasonableSize();
View Full Code Here

  private static final int SIZE_EXPAND = 50;

  @Override
  public void apply() throws Exception {
    GwtState state = m_rootPanel.getState();
    Dimension size = getSize();
    // prepare Shell
    IBrowserShell shell = state.getShell();
    shell.prepare();
    // set Shell size
    {
View Full Code Here

      MethodInvocation invocation = m_rootPanel.getMethodInvocation("setPixelSize(int,int)");
      if (invocation != null) {
        List<Expression> arguments = DomGenerics.arguments(invocation);
        int width = (Integer) JavaInfoEvaluationHelper.getValue(arguments.get(0));
        int height = (Integer) JavaInfoEvaluationHelper.getValue(arguments.get(1));
        return new Dimension(width, height);
      }
    }
    // use size from resource properties
    return getResourceSize();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wb.draw2d.geometry.Dimension

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.