コード例 #1
0
 /**
  * Return the full path of the given page; the path is composed by the concatenation of the code
  * of the page starting from the root to the given page.
  *
  * @param page The page whose path must be found.
  * @param separator The separator of the page codes
  * @return The full path of the page
  */
 public static StringBuffer getFullPath(IPage page, String separator) {
   if (page.isRoot()) {
     return new StringBuffer(page.getCode());
   }
   IPage temp = page;
   StringBuffer buffer = new StringBuffer();
   buffer.insert(0, temp.getCode());
   while (!temp.getCode().equals(temp.getParentCode())) {
     temp = temp.getParent();
     if (temp.isShowable()) {
       buffer.insert(0, temp.getCode() + separator);
     }
   }
   return buffer;
 }
コード例 #2
0
  /**
   * Get an Image of the page. The Image is build from the Control.
   *
   * @param The IPage for which an Image is requested.
   * @return The Image of the page, or null if no Image can be built.
   */
  public static Image getPageImage(IPage page) {
    Rectangle size;
    Control control = page.getControl();

    size = control.getBounds();
    if (size.width == 0 && size.height == 0) {
      Point pt = control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
      size = new Rectangle(0, 0, pt.x, pt.y);
    }

    Image image = new Image(control.getDisplay(), size);
    GC gc = new GC(image);

    boolean success = control.print(gc);
    gc.dispose();
    if (!success) {
      image.dispose();
      return null;
    }

    return image;
  }
コード例 #3
0
 public PagingListener(Table table, IPage page) {
   this.table = table;
   this.page = page;
   this.count = (int) page.getCount();
   table.setItemCount(count);
 }