Package org.eclipse.wb.draw2d.geometry

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


    for (int row = 0; row < getRowCount(); row++) {
      int cell = getCellOfColumn(row, index);
      if (cell < getCellCount(row)) {
        int colSpan = getColSpan(row, cell);
        if (colSpan != 1) {
          m_cellToSpan.get(new Point(cell, row)).width++;
        } else {
          for (Iterator<Point> I = m_cellToSpan.keySet().iterator(); I.hasNext();) {
            Point key = I.next();
            if (key.y == row) {
              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


  @Override
  protected void updateGridTarget(Point mouseLocation) throws Exception {
    m_target = new GridTarget();
    // prepare location in model
    Point location = mouseLocation.getCopy();
    PolicyUtils.translateAbsoluteToModel(this, location);
    // prepare grid information
    IGridInfo gridInfo = m_layout.getGridInfo();
    Interval[] columnIntervals = gridInfo.getColumnIntervals();
    Interval[] rowIntervals = gridInfo.getRowIntervals();
View Full Code Here

    super.deleteColumn(index);
    for (int row = 0; row < getRowCount(); row++) {
      int cell = getCellOfColumn(row, index);
      int colSpan = getColSpan(row, cell);
      if (colSpan != 1) {
        m_cellToSpan.get(new Point(cell, row)).width--;
      } else {
        for (Iterator<Point> I = m_cellToSpan.keySet().iterator(); I.hasNext();) {
          Point key = I.next();
          if (key.y == row) {
            if (key.x == cell) {
              I.remove();
            } else if (key.x > cell) {
              key.x--;
View Full Code Here

    super.insertRow(index);
    // update information about existing rows
    {
      for (Iterator<Map.Entry<Point, Dimension>> I = m_cellToSpan.entrySet().iterator(); I.hasNext();) {
        Map.Entry<Point, Dimension> entry = I.next();
        Point key = entry.getKey();
        if (key.y < index && index < key.y + entry.getValue().height) {
          entry.getValue().height++;
        } else if (key.y >= index) {
          key.y++;
        }
      }
      rehashMap(m_cellToSpan);
    }
    // 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

  public void deleteRow(int index) throws Exception {
    // update information about rows
    {
      for (Iterator<Map.Entry<Point, Dimension>> I = m_cellToSpan.entrySet().iterator(); I.hasNext();) {
        Map.Entry<Point, Dimension> entry = I.next();
        Point key = entry.getKey();
        if (key.y < index && index < key.y + entry.getValue().height) {
          entry.getValue().height--;
        } else if (key.y == index) {
          I.remove();
        } else if (key.y >= index) {
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  @Override
  public int getRowSpan(final int row, final int cell) {
    return ExecutionUtils.runObject(new RunnableObjectEx<Integer>() {
      public Integer runObject() throws Exception {
        return m_cellToSpan.get(new Point(cell, row)).height;
      }
    }, "Can not find cell (cell,row) (%d, %d) in %s %s.", cell, row, m_panel, this);
  }
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

  @Override
  public int getColSpan(final int row, final int cell) {
    return ExecutionUtils.runObject(new RunnableObjectEx<Integer>() {
      public Integer runObject() throws Exception {
        return m_cellToSpan.get(new Point(cell, row)).width;
      }
    }, "Can not find cell (cell,row) (%d, %d) in %s %s.", cell, row, m_panel, this);
  }
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

  @Override
  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;
View Full Code Here

TOP

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

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.