Package ag.ion.bion.officelayer.text

Examples of ag.ion.bion.officelayer.text.ITextTableProperties


      ITextTable textTable = textDocument.getTextTableService()
          .constructTextTable(5, 15);
      textDocument.getTextService().getTextContentService()
          .insertTextContent(textTable);

      ITextTableProperties tableProperties = textTable.getProperties();
      tableProperties.getCellWidths();

    } catch (Exception exception) {
      exception.printStackTrace();
      Assert.fail();
    }
View Full Code Here


   *
   * @author Markus Kr�ger
   */
  public void setWidth(short width) throws TextException {
    //get text table properties
    ITextTableProperties textTableProperties = textTable.getProperties()
   
    //get column separators
    TextTableColumnsSeparator[] textTableColumnsSeparators = textTableProperties.getTableColumnSeparators();
   
    int columnsSeparatorsLength = textTableColumnsSeparators.length;
    long textTableWidth = textTableProperties.getWidth();
   
    //only if there is more than one column
    if(columnsSeparatorsLength > 0 && index <= columnsSeparatorsLength) {
      //sets separator if index is 0
      if(index == 0) {
        //for a table with only two columns
        if(columnsSeparatorsLength == 1) {     
          //set new position only if the width does not exceed table width
          if(width < textTableWidth - MIN_COLUMN_WIDTH) {
            //set new position of separator
            textTableColumnsSeparators[index].setPosition(width);
          }
          else {
            //set new position of separator to table width
            textTableColumnsSeparators[index].setPosition( (short)(textTableWidth - MIN_COLUMN_WIDTH) );
          }
        }
        //for a table with at least three columns
        else {
          //set new position only if the width does not exceed the position of the next column separator
          if(width < textTableColumnsSeparators[index+1].getPosition() - MIN_COLUMN_WIDTH) {
            //set new position of separator
            textTableColumnsSeparators[index].setPosition(width);
          }
          else {
            //set new position of separator right next to the position of the next column separator
            textTableColumnsSeparators[index].setPosition( (short)(textTableColumnsSeparators[index+1].getPosition() - MIN_COLUMN_WIDTH) );
          }
        }           
      }
      //sets separator the column is not the first one or the last one
      else if(index < columnsSeparatorsLength) {
        //if the column is the last but one
        if(index == columnsSeparatorsLength-1) {     
          //set new position only if the width does not exceed table width
          if(textTableColumnsSeparators[index-1].getPosition() + width < textTableWidth - MIN_COLUMN_WIDTH) {
            //set new position of separator
            textTableColumnsSeparators[index].setPosition( (short) (textTableColumnsSeparators[index-1].getPosition() + width ) );
          }
          else {
            //set new position of separator to table width
            textTableColumnsSeparators[index].setPosition( (short)(textTableWidth - MIN_COLUMN_WIDTH) );
          }
        }
        //if the column is not the last but one
        else {
          //set new position only if the width does not exceed the position of the next column separator
          if(textTableColumnsSeparators[index-1].getPosition() + width < textTableColumnsSeparators[index+1].getPosition() - MIN_COLUMN_WIDTH) {
            //set new position of separator
            textTableColumnsSeparators[index].setPosition( (short) (textTableColumnsSeparators[index-1].getPosition() + width ) );
          }
          else {
            //set new position of separator right next to the position of the next column separator
            textTableColumnsSeparators[index].setPosition( (short)(textTableColumnsSeparators[index+1].getPosition() - MIN_COLUMN_WIDTH) );
          }
        }
      }
      //sets the last column width
      else {
        //if there are only two columns
        if(columnsSeparatorsLength == 1) {
          //new position is not smaller than 0
          if(textTableWidth - width > MIN_COLUMN_WIDTH) {
            //set new position of the only separator
            textTableColumnsSeparators[index-1].setPosition( (short) (textTableWidth - width) );
          }
          //new position is smaller than MIN_COLUMN_WIDTH, then set it to MIN_COLUMN_WIDTH
          else {
            //set new position of the only separator
            textTableColumnsSeparators[index-1].setPosition( (short) MIN_COLUMN_WIDTH);
          }
        }
        //if there are more than two columns
        else {
          //new position is not smaller than the position of the last separator
          if(textTableWidth - width > textTableColumnsSeparators[index-2].getPosition() + MIN_COLUMN_WIDTH) {
            //set new position of the separator
            textTableColumnsSeparators[index-1].setPosition( (short) (textTableWidth - width) );
          }
          //new position is smaller than the position of the last separator, then set it right next to it
          else {
            //set new position of the separator
            textTableColumnsSeparators[index-1].setPosition( (short) (textTableColumnsSeparators[index-2].getPosition() + MIN_COLUMN_WIDTH) );
          }
        }
      }     
    }
   
    //sets new separators
    textTableProperties.setTableColumnSeparators(textTableColumnsSeparators);
 
View Full Code Here

   *
   * @author Markus Kr�ger
   */
  public short getWidth() throws TextException {
    //get text table properties
    ITextTableProperties textTableProperties = textTable.getProperties();   
    //get column separators
    TextTableColumnsSeparator[] textTableColumnsSeparators = textTableProperties.getTableColumnSeparators();
   
    int columnsSeparatorsLength = textTableColumnsSeparators.length;
   
    if(index <= columnsSeparatorsLength) {
      //return column width
      if(index == 0)
        //for the first column the position of the first separator is the width
        return textTableColumnsSeparators[index].getPosition();
      else if(index < columnsSeparatorsLength)
        //for columns between the first and the lastone the width is the position of the next separator minus the
        //position of the actual column separator
        return (short) (textTableColumnsSeparators[index].getPosition()-textTableColumnsSeparators[index-1].getPosition());
      else
        //for the last column the distance between last separator and tabelend is the width
        return (short) (textTableProperties.getWidth()-textTableColumnsSeparators[index-1].getPosition());
    }
    return 0;
  }
View Full Code Here

   *
   * @author Markus Kr�ger
   */
  public void setWidth(short width) throws TextException {
    // get text table properties
    ITextTableProperties textTableProperties = textTable.getProperties();

    // get column separators
    TextTableColumnsSeparator[] textTableColumnsSeparators = textTableProperties
        .getTableColumnSeparators();

    int columnsSeparatorsLength = textTableColumnsSeparators.length;
    long textTableWidth = textTableProperties.getWidth();

    // only if there is more than one column
    if (columnsSeparatorsLength > 0 && index <= columnsSeparatorsLength) {
      // sets separator if index is 0
      if (index == 0) {
        // for a table with only two columns
        if (columnsSeparatorsLength == 1) {
          // set new position only if the width does not exceed table
          // width
          if (width < textTableWidth - MIN_COLUMN_WIDTH) {
            // set new position of separator
            textTableColumnsSeparators[index].setPosition(width);
          } else {
            // set new position of separator to table width
            textTableColumnsSeparators[index]
                .setPosition((short) (textTableWidth - MIN_COLUMN_WIDTH));
          }
        }
        // for a table with at least three columns
        else {
          // set new position only if the width does not exceed the
          // position of the next column separator
          if (width < textTableColumnsSeparators[index + 1]
              .getPosition()
              - MIN_COLUMN_WIDTH) {
            // set new position of separator
            textTableColumnsSeparators[index].setPosition(width);
          } else {
            // set new position of separator right next to the
            // position of the next column separator
            textTableColumnsSeparators[index]
                .setPosition((short) (textTableColumnsSeparators[index + 1]
                    .getPosition() - MIN_COLUMN_WIDTH));
          }
        }
      }
      // sets separator the column is not the first one or the last one
      else if (index < columnsSeparatorsLength) {
        // if the column is the last but one
        if (index == columnsSeparatorsLength - 1) {
          // set new position only if the width does not exceed table
          // width
          if (textTableColumnsSeparators[index - 1].getPosition()
              + width < textTableWidth - MIN_COLUMN_WIDTH) {
            // set new position of separator
            textTableColumnsSeparators[index]
                .setPosition((short) (textTableColumnsSeparators[index - 1]
                    .getPosition() + width));
          } else {
            // set new position of separator to table width
            textTableColumnsSeparators[index]
                .setPosition((short) (textTableWidth - MIN_COLUMN_WIDTH));
          }
        }
        // if the column is not the last but one
        else {
          // set new position only if the width does not exceed the
          // position of the next column separator
          if (textTableColumnsSeparators[index - 1].getPosition()
              + width < textTableColumnsSeparators[index + 1]
              .getPosition()
              - MIN_COLUMN_WIDTH) {
            // set new position of separator
            textTableColumnsSeparators[index]
                .setPosition((short) (textTableColumnsSeparators[index - 1]
                    .getPosition() + width));
          } else {
            // set new position of separator right next to the
            // position of the next column separator
            textTableColumnsSeparators[index]
                .setPosition((short) (textTableColumnsSeparators[index + 1]
                    .getPosition() - MIN_COLUMN_WIDTH));
          }
        }
      }
      // sets the last column width
      else {
        // if there are only two columns
        if (columnsSeparatorsLength == 1) {
          // new position is not smaller than 0
          if (textTableWidth - width > MIN_COLUMN_WIDTH) {
            // set new position of the only separator
            textTableColumnsSeparators[index - 1]
                .setPosition((short) (textTableWidth - width));
          }
          // new position is smaller than MIN_COLUMN_WIDTH, then set
          // it to MIN_COLUMN_WIDTH
          else {
            // set new position of the only separator
            textTableColumnsSeparators[index - 1]
                .setPosition((short) MIN_COLUMN_WIDTH);
          }
        }
        // if there are more than two columns
        else {
          // new position is not smaller than the position of the last
          // separator
          if (textTableWidth - width > textTableColumnsSeparators[index - 2]
              .getPosition()
              + MIN_COLUMN_WIDTH) {
            // set new position of the separator
            textTableColumnsSeparators[index - 1]
                .setPosition((short) (textTableWidth - width));
          }
          // new position is smaller than the position of the last
          // separator, then set it right next to it
          else {
            // set new position of the separator
            textTableColumnsSeparators[index - 1]
                .setPosition((short) (textTableColumnsSeparators[index - 2]
                    .getPosition() + MIN_COLUMN_WIDTH));
          }
        }
      }
    }

    // sets new separators
    textTableProperties
        .setTableColumnSeparators(textTableColumnsSeparators);
  }
View Full Code Here

   *
   * @author Markus Kr�ger
   */
  public short getWidth() throws TextException {
    // get text table properties
    ITextTableProperties textTableProperties = textTable.getProperties();
    // get column separators
    TextTableColumnsSeparator[] textTableColumnsSeparators = textTableProperties
        .getTableColumnSeparators();

    int columnsSeparatorsLength = textTableColumnsSeparators.length;

    if (index <= columnsSeparatorsLength) {
      // return column width
      if (index == 0)
        // for the first column the position of the first separator is
        // the width
        return textTableColumnsSeparators[index].getPosition();
      else if (index < columnsSeparatorsLength)
        // for columns between the first and the lastone the width is
        // the position of the next separator minus the
        // position of the actual column separator
        return (short) (textTableColumnsSeparators[index].getPosition() - textTableColumnsSeparators[index - 1]
            .getPosition());
      else
        // for the last column the distance between last separator and
        // tabelend is the width
        return (short) (textTableProperties.getWidth() - textTableColumnsSeparators[index - 1]
            .getPosition());
    }
    return 0;
  }
View Full Code Here

      else {
        //use default
        propertyKeysToCopy = TextTableProperties.getDefaultPropertyKeys();
      }
      if(propertyKeysToCopy != null) {
        ITextTableProperties newTableProperties = newTable.getProperties();
        ((IPropertyStore)tablePropertyStore).getProperties().copyTo(propertyKeysToCopy, newTableProperties);
      }
     
      int rowArrayLength = cellCloneServices.length;
      for (int rows = 0; rows < rowArrayLength; rows++) {
View Full Code Here

   * @param table the ITextTable that should be analysed
   *
   * @author Sebastian R�sgen  
   */
  private void getTableAnalyse (ITextTable table) throws TextException {
    ITextTableProperties props = table.getProperties();
    this.properties = props;
    this.columnCount = table.getColumnCount();
    this.rowCount = table.getRowCount();
    this.tableWidth = props.getWidth();
    this.cellWidth = props.getCellWidths();
    this.repeatHeadline = props.repeatHeadline();
    this.textTableColumnsSeparators = props.getTableColumnSeparators();
     
  }
View Full Code Here

          }
          if(helpCount * columnCount > ITextTable.MAX_CELLS_IN_TABLE) {
            insert = maxRowsInTable;
          }
          ITextTable textTable = textDocument.getTextTableService().constructTextTable(1,columnCount);
          ITextTableProperties properties = textTable.getProperties();
          properties.setRepeatHeadline(tablePropertyStore.repeatHeadline());
          textDocument.getTextService().getTextContentService().insertTextContentAfter(textTable,textTableLast);
          properties.setTableColumnSeparators(tablePropertyStore.getTableColumnSeparators());
          IDestinationPosition destinationPosition = new DestinationPosition(textTable.getCell("A1"));
          if(tablePropertyStore.repeatHeadline()) {
            textTableCellRangeHeaderClone.getCloneService().cloneToPositionNoReturn(destinationPosition,null);
            destinationPosition = new DestinationPosition(textTable.getCell("A2"));
            textTableCellRangeClone.getCloneService().cloneToPositionNoReturn(destinationPosition,false,null);
View Full Code Here

      ITextDocument textDocument = (ITextDocument)localOfficeApplication.getDocumentService().constructNewDocument(IDocument.WRITER, new DocumentDescriptor());
     
      ITextTable textTable = textDocument.getTextTableService().constructTextTable(5, 15);
      textDocument.getTextService().getTextContentService().insertTextContent(textTable);
     
      ITextTableProperties tableProperties = textTable.getProperties();
      tableProperties.getCellWidths();
     
     
    }
    catch(Exception exception) {
      exception.printStackTrace();
View Full Code Here

          if (helpCount * columnCount > ITextTable.MAX_CELLS_IN_TABLE) {
            insert = maxRowsInTable;
          }
          ITextTable textTable = textDocument.getTextTableService()
              .constructTextTable(1, columnCount);
          ITextTableProperties properties = textTable.getProperties();
          properties.setRepeatHeadline(tablePropertyStore
              .repeatHeadline());
          textDocument.getTextService().getTextContentService()
              .insertTextContentAfter(textTable, textTableLast);
          properties.setTableColumnSeparators(tablePropertyStore
              .getTableColumnSeparators());
          IDestinationPosition destinationPosition = new DestinationPosition(
              textTable.getCell("A1"));
          if (tablePropertyStore.repeatHeadline()) {
            textTableCellRangeHeaderClone.getCloneService()
View Full Code Here

TOP

Related Classes of ag.ion.bion.officelayer.text.ITextTableProperties

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.