Package org.gudy.azureus2.ui.swt.views.table

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


    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

              //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

  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

    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

    });
  }
 
  // @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

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

      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

    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

    Control[] children = c.getChildren();
    for (Control childControl : children) {
      if (!childControl.isVisible()) {
        continue;
      }
      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

Related Classes of org.gudy.azureus2.ui.swt.views.table.TableOrTreeSWT

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.