org.eclipse.e4.ui.widgets_0.12.3.v20130123-162658

16:43:01.708 INFO  jd.cli.Main - Decompiling org.eclipse.e4.ui.widgets_0.12.3.v20130123-162658.jar
package org.eclipse.e4.ui.widgets;

import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;

class ImageBasedFrame$1
  implements PaintListener
{
  ImageBasedFrame$1(ImageBasedFrame paramImageBasedFrame) {}
  
  public void paintControl(PaintEvent e)
  {
    this$0.drawFrame(e);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.widgets.ImageBasedFrame.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.widgets;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class ImageBasedFrame$2
  implements Listener
{
  ImageBasedFrame$2(ImageBasedFrame paramImageBasedFrame) {}
  
  public void handleEvent(Event event)
  {
    ImageBasedFrame frame = (ImageBasedFrame)widget;
    frame.setCursor(null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.widgets.ImageBasedFrame.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.widgets;

import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;

class ImageBasedFrame$3
  implements MouseMoveListener
{
  ImageBasedFrame$3(ImageBasedFrame paramImageBasedFrame) {}
  
  public void mouseMove(MouseEvent e)
  {
    Rectangle handleRect = this$0.getHandleRect();
    
    ImageBasedFrame frame = (ImageBasedFrame)widget;
    if (handleRect.contains(x, y)) {
      frame.setCursor(frame.getDisplay().getSystemCursor(
        5));
    } else {
      frame.setCursor(null);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.widgets.ImageBasedFrame.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.widgets;

import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;

class ImageBasedFrame$4
  implements ControlListener
{
  ImageBasedFrame$4(ImageBasedFrame paramImageBasedFrame) {}
  
  public void controlResized(ControlEvent e)
  {
    this$0.pack(true);
  }
  
  public void controlMoved(ControlEvent e) {}
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.widgets.ImageBasedFrame.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.widgets;

import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ToolBar;

public class ImageBasedFrame
  extends Canvas
{
  private Control framedControl;
  private boolean draggable = true;
  private boolean vertical = true;
  private int w1;
  private int w2;
  private int w3;
  private int h1;
  private int h2;
  private int h3;
  private Image imageCache;
  private Image handle;
  private int handleWidth;
  private int handleHeight;
  protected String id;
  
  public ImageBasedFrame(Composite parent, Control toWrap, boolean vertical, boolean draggable)
  {
    super(parent, 0);
    
    framedControl = toWrap;
    this.vertical = vertical;
    this.draggable = draggable;
    
    addPaintListener(new PaintListener()
    {
      public void paintControl(PaintEvent e)
      {
        drawFrame(e);
      }
    });
    addListener(7, new Listener()
    {
      public void handleEvent(Event event)
      {
        ImageBasedFrame frame = (ImageBasedFrame)widget;
        frame.setCursor(null);
      }
    });
    addMouseMoveListener(new MouseMoveListener()
    {
      public void mouseMove(MouseEvent e)
      {
        Rectangle handleRect = getHandleRect();
        
        ImageBasedFrame frame = (ImageBasedFrame)widget;
        if (handleRect.contains(x, y)) {
          frame.setCursor(frame.getDisplay().getSystemCursor(
            5));
        } else {
          frame.setCursor(null);
        }
      }
    });
    toWrap.setParent(this);
    toWrap.pack(true);
    
    toWrap.addControlListener(new ControlListener()
    {
      public void controlResized(ControlEvent e)
      {
        pack(true);
      }
      
      public void controlMoved(ControlEvent e) {}
    });
    if (vertical) {
      toWrap.setLocation(w1, h1 + handleHeight);
    } else {
      toWrap.setLocation(w1 + handleWidth, h1);
    }
    setSize(computeSize(-1, -1));
    if ((toWrap instanceof ToolBar)) {
      id = "TB";
    }
  }
  
  public Rectangle getHandleRect()
  {
    Rectangle handleRect = new Rectangle(0, 0, 0, 0);
    if (!draggable) {
      return handleRect;
    }
    if (vertical)
    {
      x = w1;
      y = h1;
      width = framedControl.getSize().x;
      height = handle.getBounds().height;
    }
    else
    {
      x = w1;
      y = h1;
      width = handle.getBounds().width;
      height = framedControl.getSize().y;
    }
    return handleRect;
  }
  
  public Point computeSize(int wHint, int hHint)
  {
    if (vertical)
    {
      int width = w1 + framedControl.getSize().x + w3;
      int height = h1 + handleHeight + framedControl.getSize().y + h3;
      return new Point(width, height);
    }
    int width = w1 + handleWidth + framedControl.getSize().x + w3;
    int height = h1 + framedControl.getSize().y + h3;
    return new Point(width, height);
  }
  
  protected void drawFrame(PaintEvent e)
  {
    Point inner = framedControl.getSize();
    int handleWidth = (handle != null) && (!vertical) ? handle.getBounds().width : 
      0;
    int handleHeight = (handle != null) && (vertical) ? handle.getBounds().height : 
      0;
    
    Rectangle srcRect = new Rectangle(0, 0, 0, 0);
    Rectangle dstRect = new Rectangle(0, 0, 0, 0);
    
    x = 0;
    y = 0;
    width = w1;
    height = h1;
    x = 0;
    y = 0;
    width = w1;
    height = h1;
    gc.drawImage(imageCache, x, y, width, 
      height, x, y, width, 
      height);
    
    x = w1;
    y = 0;
    width = w2;
    height = h1;
    x = w1;
    y = 0;
    width = (x + handleWidth);
    height = h1;
    gc.drawImage(imageCache, x, y, width, 
      height, x, y, width, 
      height);
    if (handleHeight > 0)
    {
      x = 0;
      y = 0;
      width = handle.getBounds().width;
      height = handle.getBounds().height;
      x = w1;
      y = h1;
      width = x;
      height = handleHeight;
      gc.drawImage(handle, x, y, width, 
        height, x, y, width, 
        height);
    }
    x = (w1 + w2);
    y = 0;
    width = w3;
    height = h1;
    x = (w1 + handleWidth + x);
    y = 0;
    width = w3;
    height = h3;
    gc.drawImage(imageCache, x, y, width, 
      height, x, y, width, 
      height);
    
    x = 0;
    y = h1;
    width = w1;
    height = h2;
    x = 0;
    y = h1;
    width = w1;
    height = (y + handleHeight);
    gc.drawImage(imageCache, x, y, width, 
      height, x, y, width, 
      height);
    if (handleWidth > 0)
    {
      x = 0;
      y = 0;
      width = handle.getBounds().width;
      height = handle.getBounds().height;
      x = w1;
      y = h1;
      width = handleWidth;
      height = y;
      gc.drawImage(handle, x, y, width, 
        height, x, y, width, 
        height);
    }
    x = (w1 + w2);
    y = h1;
    width = w3;
    height = h2;
    x = (w1 + handleWidth + x);
    y = h1;
    width = w3;
    height = (y + handleHeight);
    gc.drawImage(imageCache, x, y, width, 
      height, x, y, width, 
      height);
    
    x = 0;
    y = (h1 + h2);
    width = w1;
    height = h3;
    x = 0;
    y = (h1 + handleHeight + y);
    width = w1;
    height = h3;
    gc.drawImage(imageCache, x, y, width, 
      height, x, y, width, 
      height);
    
    x = w1;
    y = (h1 + h2);
    width = w2;
    height = h3;
    x = w1;
    y = (h1 + handleHeight + y);
    width = (handleWidth + x);
    height = h3;
    gc.drawImage(imageCache, x, y, width, 
      height, x, y, width, 
      height);
    
    x = (w1 + w2);
    y = (h1 + h2);
    width = w3;
    height = h3;
    x = (w1 + handleWidth + x);
    y = (h1 + handleHeight + y);
    width = w3;
    height = h3;
    gc.drawImage(imageCache, x, y, width, 
      height, x, y, width, 
      height);
    
    x = w1;
    y = h1;
    width = w2;
    height = h2;
    x = (w1 + handleWidth);
    y = (h1 + handleHeight);
    width = x;
    height = y;
    gc.drawImage(imageCache, x, y, width, 
      height, x, y, width, 
      height);
  }
  
  public Image getImageCache()
  {
    return imageCache;
  }
  
  public Image getHandleImage()
  {
    return handle;
  }
  
  public void setImages(Image frameImage, Integer[] frameInts, Image handleImage)
  {
    if (frameImage != null) {
      imageCache = frameImage;
    }
    if (handleImage != null) {
      handle = handleImage;
    }
    if (frameInts != null)
    {
      w1 = frameInts[0].intValue();
      w2 = frameInts[1].intValue();
      h1 = frameInts[2].intValue();
      h2 = frameInts[3].intValue();
      w3 = (imageCache.getBounds().width - (w1 + w2));
      h3 = (imageCache.getBounds().height - (h1 + h2));
    }
    handleWidth = ((handle != null) && (!vertical) ? handle.getBounds().width : 
      0);
    handleHeight = ((handle != null) && (vertical) ? handle.getBounds().height : 
      0);
    if (vertical) {
      framedControl.setLocation(w1, h1 + handleHeight);
    } else {
      framedControl.setLocation(w1 + handleWidth, h1);
    }
    setSize(computeSize(-1, -1));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.widgets.ImageBasedFrame
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
1

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd