Examples of TableOrTreeSWT


Examples of org.gudy.azureus2.ui.swt.views.table.TableOrTreeSWT

  }

  public static void eraseItem(Event event, GC gc, TableItemOrTreeItem item,
      int columnNo, boolean drawExtended, Rectangle bounds, TableViewSWTImpl<?> tv, boolean alwaysDrawBG) {

    TableOrTreeSWT table = tv.getTableOrTreeSWT();

    if (event == null || (event.detail & (SWT.HOT | SWT.SELECTED | SWT.FOCUSED)) == 0) {

      int pos;
      TableItemOrTreeItem parentItem = item.getParentItem();
      if (parentItem != null) {
        pos = parentItem.indexOf(item) + ((table.indexOf(parentItem) + 1) % 2);
      } else {
        pos = table.indexOf(item);
      }
      Color color = alternatingColors[pos % 2];
      if (color != null) {
        gc.setBackground(color);
        if (parentItem != null) {
          gc.setAlpha(128);
        }
      }
      Rectangle drawBounds = bounds;
      if (TableViewSWTImpl.DRAW_FULL_ROW && drawExtended
          && columnNo == table.getColumnCount() - 1) {
        tv.swt_calculateClientArea();
        drawBounds = new Rectangle(bounds.x, bounds.y, tv.clientArea.x
            + tv.clientArea.width - bounds.x, bounds.height);
        gc.setClipping(drawBounds);
        //System.out.println(bounds.width);
      }
      if (alwaysDrawBG || color != null) {
        if (color == null) {
          gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
        }
        gc.fillRectangle(drawBounds);
        if (event != null) {
          event.detail &= ~SWT.BACKGROUND;
        }
      }
    }
   
    if (event != null && (event.detail & SWT.SELECTED) > 0 && !table.isFocusControl()) {
      gc.setBackground(Colors.blues[3]);
      gc.fillRectangle(bounds);
      if (event != null) {
        event.detail &= ~SWT.BACKGROUND;
      }
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.views.table.TableOrTreeSWT

      if (object instanceof TableOrTreeSWT) {
        return (TableOrTreeSWT) object;
      }
    }

    TableOrTreeSWT delegate = null;
    synchronized (mapDelegates) {
      if (widget instanceof Tree) {
        delegate = new TreeDelegate((Tree) widget);
        mapDelegates.put(widget, delegate);
      } else if (widget instanceof Table) {
        delegate = new TableDelegate((Table) widget);
        mapDelegates.put(widget, delegate);
      }
    }

    if (delegate != null) {
      delegate.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          synchronized (mapDelegates) {
            mapDelegates.remove(e.widget);
          }
        }
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.views.table.TableOrTreeSWT

    return null;
  }

  public static TableOrTreeSWT createGrid(Composite parent, int style,
      boolean tree) {
    TableOrTreeSWT delegate = null;
    synchronized (mapDelegates) {
      if (tree) {
        try {
          delegate = new TreeDelegate(parent, style);
          mapDelegates.put(((TreeDelegate) delegate).getComposite(), delegate);
        } catch (Exception e) {
          Debug.out(e);
        }
      } else {
        delegate = new TableDelegate(parent, style);
        mapDelegates.put(((TableDelegate)delegate).getComposite(), delegate);
      }
    }

    if (delegate != null) {
      delegate.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          synchronized (mapDelegates) {
            mapDelegates.remove(e.widget);
          }
        }
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.views.table.TableOrTreeSWT

              //if (!row.isVisible()) {
              //  return;
              //}
              Rectangle bounds = getBoundsRaw();
              if (bounds != null) {
                TableOrTreeSWT table = row.getTable();
                Rectangle dirty = table.getClientArea().intersection(bounds);
                //System.out.println("old = " + this.text + ";new=" + text + ";dirty=" + bounds);

                if (!dirty.isEmpty()) {
                  quickRedrawCell(table, dirty, bounds);
                }
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.views.table.TableOrTreeSWT

  public int getPosition() {
    return position;
  }

  public Image getBackgroundImage() {
    TableOrTreeSWT table = row.getTable();
   
    Rectangle bounds = getBounds();
   
    if (bounds.isEmpty()) {
      return null;
    }
   
    Image image = new Image(table.getDisplay(), bounds.width, bounds.height);
   
    GC gc = new GC(image);
    gc.setForeground(getBackground());
    gc.setBackground(getBackground());
    gc.fillRectangle(0, 0, bounds.width, bounds.height);
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.views.table.TableOrTreeSWT

    Utils.execSWTThread(new AERunnable() {
      public void runSupport() {
        if (row == null) {
          return;
        }
        TableOrTreeSWT table = row.getTable();
        if (table == null || table.isDisposed()) {
          return;
        }
        table.setCursor(table.getDisplay().getSystemCursor(cursorID));
      }
    });
  }
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.views.table.TableOrTreeSWT

    });
  }
 
  // @see org.gudy.azureus2.ui.swt.components.BufferedTableItem#isMouseOver()
  public boolean isMouseOver() {
    TableOrTreeSWT table = row.getTable();
    if (table == null || table.isDisposed()) {
      return false;
    }
    Point pt = table.getDisplay().getCursorLocation();
    pt = table.toControl(pt);

    Rectangle bounds = getBounds();
    return bounds == null ? false : bounds.contains(pt);
  }
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.views.table.TableOrTreeSWT

      gc.dispose();
     
      return imageCellBG;
    }
   
    TableOrTreeSWT table = row.getTable();
   
    Rectangle bounds = super.getBounds();
   
    if (bounds.isEmpty()) {
      return null;
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.views.table.TableOrTreeSWT

      private TableColumnCore tableColumn;

      public void dragStart(DragSourceEvent event) {
        event.doit = true;

        TableOrTreeSWT table = TableOrTreeUtils.getTableOrTreeSWT(((DragSource) event.widget).getControl());
        TableView tv = (TableView) table.getData("TableView");
        // drag start happens a bit after the mouse moves, so the
        // cursor location isn't accurate
        //Point cursorLocation = event.display.getCursorLocation();
        //cursorLocation = tv.getTableComposite().toControl(cursorLocation);
        //TableRowCore row = tv.getRow(cursorLocation.x, cursorLocation.y);
        //System.out.println("" + event.x + ";" + event.y + "/" + cursorLocation);

        // event.x and y doesn't always return correct values!
        //TableRowCore row = tv.getRow(event.x, event.y);

        TableRowCore row = tv.getFocusedRow();
        if (row == null) {
          event.doit = false;
          return;
        }

        tableColumn = (TableColumnCore) row.getDataSource();

        if (event.image != null && !Constants.isLinux) {
          try {
            GC gc = new GC(event.image);
            try {
              Rectangle bounds = event.image.getBounds();
              gc.fillRectangle(bounds);
              String title = MessageText.getString(
                  tableColumn.getTitleLanguageKey(), tableColumn.getName());
              String s = title
                  + " Column will be placed at the location you drop it, shifting other columns down";
              GCStringPrinter sp = new GCStringPrinter(gc, s, bounds, false, false,
                  SWT.CENTER | SWT.WRAP);
              sp.calculateMetrics();
              if (sp.isCutoff()) {
                GCStringPrinter.printString(gc, title, bounds, false, false,
                    SWT.CENTER | SWT.WRAP);
              } else {
                sp.printString();
              }
            } finally {
              gc.dispose();
            }
          } catch (Throwable t) {
            //ignore
          }
        }
      }

      public void dragSetData(DragSourceEvent event) {
        TableOrTreeSWT table = TableOrTreeUtils.getTableOrTreeSWT(((DragSource) event.widget).getControl());
        TableView tv = (TableView) table.getData("TableView");
        event.data = "" + (tv == tvChosen ? "c" : "a");
      }

      public void dragFinished(DragSourceEvent event) {
      }
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.views.table.TableOrTreeSWT

    Point ourOfs = Utils.getLocationRelativeToShell(control);

    Control[] swtChildren = ((Composite) control).getChildren();
    for (int i = 0; i < swtChildren.length; i++) {
      Control childControl = swtChildren[i];
      TableOrTreeSWT tableOrTree = TableOrTreeUtils.getTableOrTreeSWT(childControl);
      TableView tv = tableOrTree == null ? null
          : (TableView) tableOrTree.getData("TableView");
      if (tv instanceof ObfusticateImage) {
        ObfusticateImage oi = (ObfusticateImage) tv;
        oi.obfusticatedImage(image);
        continue;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.