Package org.zkoss.zss.engine

Examples of org.zkoss.zss.engine.Ref


    }
  }
  @Override
  public RichTextString getText() {
    synchronized(_sheet) {
      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
        if (cell != null)
          return BookHelper.getText(cell);
      }
      return null;
View Full Code Here


    }
  }
  @Override
  public FormatText getFormatText() {
    synchronized(_sheet) {
      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
        if (cell != null)
          return BookHelper.getFormatText(cell);
      }
      return null;
View Full Code Here

  }
 
  @Override
  public RichTextString getRichEditText() {
    synchronized(_sheet) {
      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
        if (cell != null) {
          return BookHelper.getRichEditText(cell);
        }
      }
View Full Code Here

  }
 
  @Override
  public String getEditText() {
    synchronized(_sheet) {
      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
        if (cell != null) {
          return BookHelper.getEditText(cell);
        }
      }
View Full Code Here

 
  //return null if a valid input; otherwise the associated DataVailation for invalid input.
  @Override
  public DataValidation validate(String txt) {
    synchronized(_sheet) {
      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
       
        final Object[] values = BookHelper.editTextToValue(txt, cell);
        final Worksheet sheet = BookHelper.getSheet(_sheet, refSheet);
       
View Full Code Here

  }
 
  @Override
  public void setEditText(String txt) {
    synchronized(_sheet) {
      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
       
        final Object[] values = BookHelper.editTextToValue(txt, cell);
        final Worksheet sheet = BookHelper.getSheet(_sheet, refSheet);
       
View Full Code Here

    for(Ref ref: refs) {
      int tRow = ref.getTopRow();
      int lCol = ref.getLeftCol();
      int bRow = ref.getBottomRow();
      int rCol = ref.getRightCol();
      Ref refx  = _sheet.removeRef(tRow, lCol, bRow, rCol);
      assertSame(ref, refx);
    }
  }
View Full Code Here

    //D1, A1:C1
    _sheet.addDependency(0, 3, null, 0, 0, 0, 2); //D1, A1:C1

    Set<Ref> hits = _sheet.getHitRefs(0,0);
    assertEquals(1, hits.size());
    Ref hit = hits.iterator().next();
    assertSame(_sheet.getRef(0,0,0,2), hit);
    assertEquals(1, hit.getDependents().size());
    Ref src = _sheet.getRef(0,3,0,3);
    assertSame(src, hit.getDependents().iterator().next());
   
    _sheet.removeDependency(0, 3, null, 0, 0, 0, 2); //D1, A1:C1
    assertTrue(hit.getDependents().isEmpty());
    assertTrue(src.getPrecedents().isEmpty());
  }
View Full Code Here

    //D1, A1:C1
    _sheet.addDependency(0, 3, null, 0, 0, 0, 2); //D1, A1:C1

    Set<Ref> dependents = _sheet.getDirectDependents(0,0); //change A1
    assertEquals(1, dependents.size());
    final Ref dependent = dependents.iterator().next();
    assertEquals(0, dependent.getTopRow());
    assertEquals(3, dependent.getLeftCol());
    assertEquals(_sheet, dependent.getOwnerSheet());
  }
View Full Code Here

    //D1, A1:C1
    _sheet.addDependency(0, 3, null, 0, 0, 0, 2); //D1, A1:C1

    Set<Ref> dependents = _sheet.getAllDependents(0,0); //change A1
    assertEquals(1, dependents.size()); //D1
    final Ref dependent = dependents.iterator().next();
    assertEquals(0, dependent.getTopRow());
    assertEquals(3, dependent.getLeftCol());
    assertEquals(_sheet, dependent.getOwnerSheet());
  }
View Full Code Here

TOP

Related Classes of org.zkoss.zss.engine.Ref

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.