protected void refresh() { adjustItemNumber(); if (fInput == null) return; if (fInput.fAnnotations == null) return; if (fInput.fViewer != null) fInput.fViewer.addViewportListener(fViewportListener); fShell.setRegion(fLayouter.getShellRegion(fInput.fAnnotations.length)); Layout layout= fLayouter.getLayout(fInput.fAnnotations.length); fComposite.setLayout(layout); Control[] children= fComposite.getChildren(); for (int i= 0; i < fInput.fAnnotations.length; i++) { Canvas canvas= (Canvas) children[i]; Item item= new Item(); item.canvas= canvas; item.fAnnotation= fInput.fAnnotations[i]; canvas.setData(item); canvas.redraw(); } }
protected void adjustItemNumber() { if (fComposite == null) return; Control[] children= fComposite.getChildren(); int oldSize= children.length; int newSize= fInput == null ? 0 : fInput.fAnnotations.length; Display display= fShell.getDisplay(); // add missing items for (int i= oldSize; i < newSize; i++) { Canvas canvas= new Canvas(fComposite, SWT.NONE); Object gridData= fLayouter.getLayoutData(); canvas.setLayoutData(gridData); canvas.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); canvas.addPaintListener(fPaintListener); canvas.addMouseTrackListener(fMouseTrackListener); canvas.addMouseListener(fMouseListener); canvas.addListener(SWT.MenuDetect, fMenuDetectListener); canvas.addDisposeListener(fDisposeListener); } // dispose of exceeding resources for (int i= oldSize; i > newSize; i--) { Item item= (Item) children[i - 1].getData(); item.deselect(); children[i - 1].dispose(); } }
protected void adjustItemNumber() { if (fComposite == null) return; Control[] children= fComposite.getChildren(); int oldSize= children.length; int newSize= fInput == null ? 0 : fInput.fAnnotations.length; Display display= fShell.getDisplay(); // add missing items for (int i= oldSize; i < newSize; i++) { Canvas canvas= new Canvas(fComposite, SWT.NONE); Object gridData= fLayouter.getLayoutData(); canvas.setLayoutData(gridData); canvas.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); canvas.addPaintListener(fPaintListener); canvas.addMouseTrackListener(fMouseTrackListener); canvas.addMouseListener(fMouseListener); canvas.addListener(SWT.MenuDetect, fMenuDetectListener); canvas.addDisposeListener(fDisposeListener); } // dispose of exceeding resources for (int i= oldSize; i > newSize; i--) { Item item= (Item) children[i - 1].getData(); item.deselect(); children[i - 1].dispose(); } }
protected void adjustItemNumber() { if (fComposite == null) return; Control[] children= fComposite.getChildren(); int oldSize= children.length; int newSize= fInput == null ? 0 : fInput.fAnnotations.length; Display display= fShell.getDisplay(); // add missing items for (int i= oldSize; i < newSize; i++) { Canvas canvas= new Canvas(fComposite, SWT.NONE); Object gridData= fLayouter.getLayoutData(); canvas.setLayoutData(gridData); canvas.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); canvas.addPaintListener(fPaintListener); canvas.addMouseTrackListener(fMouseTrackListener); canvas.addMouseListener(fMouseListener); canvas.addListener(SWT.MenuDetect, fMenuDetectListener); canvas.addDisposeListener(fDisposeListener); } // dispose of exceeding resources for (int i= oldSize; i > newSize; i--) { Item item= (Item) children[i - 1].getData(); item.deselect(); children[i - 1].dispose(); } }
@Override public void mouseExit(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); if (item != null) item.deselect(); // if the event lies outside the entire popup, dispose org.eclipse.swt.graphics.Region region= fShell.getRegion(); Canvas can= (Canvas) e.getSource(); Point p= can.toDisplay(e.x, e.y); if (region == null) { Rectangle bounds= fShell.getBounds(); // p= fShell.toControl(p); if (!bounds.contains(p)) dispose(); } else { p= fShell.toControl(p); if (!region.contains(p)) dispose(); } }
protected void refresh() { adjustItemNumber(); if (fInput == null) return; if (fInput.fAnnotations == null) return; if (fInput.fViewer != null) fInput.fViewer.addViewportListener(fViewportListener); fShell.setRegion(fLayouter.getShellRegion(fInput.fAnnotations.length)); Layout layout= fLayouter.getLayout(fInput.fAnnotations.length); fComposite.setLayout(layout); Control[] children= fComposite.getChildren(); for (int i= 0; i < fInput.fAnnotations.length; i++) { Canvas canvas= (Canvas) children[i]; Item item= new Item(); item.canvas= canvas; item.fAnnotation= fInput.fAnnotations[i]; canvas.setData(item); canvas.redraw(); } }
protected void refresh() { adjustItemNumber(); if (fInput == null) return; if (fInput.fAnnotations == null) return; if (fInput.fViewer != null) fInput.fViewer.addViewportListener(fViewportListener); fShell.setRegion(fLayouter.getShellRegion(fInput.fAnnotations.length)); Layout layout= fLayouter.getLayout(fInput.fAnnotations.length); fComposite.setLayout(layout); Control[] children= fComposite.getChildren(); for (int i= 0; i < fInput.fAnnotations.length; i++) { Canvas canvas= (Canvas) children[i]; Item item= new Item(); item.canvas= canvas; item.fAnnotation= fInput.fAnnotations[i]; canvas.setData(item); canvas.redraw(); } }
@Override public void mouseExit(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); if (item != null) item.deselect(); // if the event lies outside the entire popup, dispose org.eclipse.swt.graphics.Region region= fShell.getRegion(); Canvas can= (Canvas) e.getSource(); Point p= can.toDisplay(e.x, e.y); if (region == null) { Rectangle bounds= fShell.getBounds(); // p= fShell.toControl(p); if (!bounds.contains(p)) dispose(); } else { p= fShell.toControl(p); if (!region.contains(p)) dispose(); } }
public void mouseExit(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); if (item != null) item.deselect(); // if the event lies outside the entire popup, dispose org.eclipse.swt.graphics.Region region= fShell.getRegion(); Canvas can= (Canvas) e.getSource(); Point p= can.toDisplay(e.x, e.y); if (region == null) { Rectangle bounds= fShell.getBounds(); // p= fShell.toControl(p); if (!bounds.contains(p)) dispose(); } else { p= fShell.toControl(p); if (!region.contains(p)) dispose(); } }
@Override public void mouseEnter(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); if (item != null) item.selected(); }
public void mouseDown(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); // TODO for now, to make double click work: disable single click on the first item // disable later when the annotationlistener selectively handles input if (item != null && e.button == 1) // && item.fAnnotation != fInput.fAnnotations[0]) item.defaultSelected(); }
@Override public void widgetDisposed(DisposeEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); item.deselect(); item.canvas= null; item.fAnnotation= null; item.oldStyles= null; ((Widget) e.getSource()).setData(null); } }
@Override public void mouseDown(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); // TODO for now, to make double click work: disable single click on the first item // disable later when the annotationlistener selectively handles input if (item != null && e.button == 1) // && item.fAnnotation != fInput.fAnnotations[0]) item.defaultSelected(e); }
@Override public void mouseDown(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); // TODO for now, to make double click work: disable single click on the first item // disable later when the annotationlistener selectively handles input if (item != null && e.button == 1) // && item.fAnnotation != fInput.fAnnotations[0]) item.defaultSelected(e); }
public void mouseEnter(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); if (item != null) item.selected(); }
public void widgetDisposed(DisposeEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); item.deselect(); item.canvas= null; item.fAnnotation= null; item.oldStyles= null; ((Widget) e.getSource()).setData(null); } }
@Override public void widgetDisposed(DisposeEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); item.deselect(); item.canvas= null; item.fAnnotation= null; item.oldStyles= null; ((Widget) e.getSource()).setData(null); } }
@Override public void mouseEnter(MouseEvent e) { Item item= (Item) ((Widget) e.getSource()).getData(); if (item != null) item.selected(); }