org.tizen.common.externals_2.0.0.201311012034

16:49:50.647 INFO  jd.cli.Main - Decompiling org.tizen.common.externals_2.0.0.201311012034.jar
package org.mihalis.opal;

import java.util.Map;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;

public abstract class OpalItem
{
  private Map<String, Object> data;
  private Object datum;
  private Color background;
  private Font font;
  private Color foreground;
  private Image image;
  private String text;
  private int height = -1;
  
  public Color getBackground()
  {
    return background;
  }
  
  public Object getData()
  {
    return datum;
  }
  
  public Object getData(String key)
  {
    return data.get(key);
  }
  
  public Font getFont()
  {
    return font;
  }
  
  public Color getForeground()
  {
    return foreground;
  }
  
  public int getHeight()
  {
    return height;
  }
  
  public Image getImage()
  {
    return image;
  }
  
  public String getText()
  {
    return text;
  }
  
  public void setBackground(Color background)
  {
    this.background = background;
  }
  
  public void setFont(Font font)
  {
    this.font = font;
  }
  
  public void setForeground(Color foreground)
  {
    this.foreground = foreground;
  }
  
  public void setHeight(int height)
  {
    this.height = height;
  }
  
  public void setImage(Image image)
  {
    this.image = image;
  }
  
  public void setText(String text)
  {
    this.text = text;
  }
  
  public void setData(Object data)
  {
    datum = data;
  }
  
  public void setData(String key, Object value)
  {
    data.put(key, value);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.OpalItem
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.angles;

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

class AngleSlider$1
  implements Listener
{
  AngleSlider$1(AngleSlider paramAngleSlider) {}
  
  public void handleEvent(Event event)
  {
    AngleSlider.access$0(this$0, event);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.angles.AngleSlider.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.angles;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.mihalis.opal.utils.SWTGraphicUtil;

class AngleSlider$2
  implements DisposeListener
{
  AngleSlider$2(AngleSlider paramAngleSlider) {}
  
  public void widgetDisposed(DisposeEvent arg0)
  {
    SWTGraphicUtil.dispose(AngleSlider.access$1(this$0));
    SWTGraphicUtil.dispose(AngleSlider.access$2(this$0));
    SWTGraphicUtil.dispose(AngleSlider.access$3(this$0));
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.angles.AngleSlider.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.angles;

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

class AngleSlider$3
  implements Listener
{
  AngleSlider$3(AngleSlider paramAngleSlider) {}
  
  public void handleEvent(Event event)
  {
    if (!this$0.isEnabled()) {
      return;
    }
    if (type == 3) {
      AngleSlider.access$4(this$0, true);
    }
    if ((type == 3) || ((type == 5) && (AngleSlider.access$5(this$0))))
    {
      float deltaX = x - 20.0F;
      float deltaY = y - 20.0F;
      double angle = Math.atan2(deltaX, deltaY);
      AngleSlider.access$6(this$0, 360 - (int)(360.0D * angle / 6.283185307179586D + 360.0D) % 360);
      
      this$0.redraw();
    }
    if (type == 4)
    {
      AngleSlider.access$4(this$0, false);
      AngleSlider.access$7(this$0, event);
    }
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.angles.AngleSlider.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.angles;

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

class AngleSlider$4
  implements Listener
{
  AngleSlider$4(AngleSlider paramAngleSlider) {}
  
  public void handleEvent(Event event)
  {
    if (!this$0.isEnabled()) {
      return;
    }
    if (type != 1) {
      return;
    }
    if ((keyCode == 16777217) || (keyCode == 16777219)) {
      this$0.setSelection(AngleSlider.access$8(this$0) + 5);
    }
    if ((keyCode == 16777218) || (keyCode == 16777220)) {
      this$0.setSelection(AngleSlider.access$8(this$0) - 5);
    }
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.angles.AngleSlider.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.angles;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.mihalis.opal.utils.SWTGraphicUtil;

public class AngleSlider
  extends Canvas
{
  private static final int WHOLE_RADIUS = 40;
  private static final int BUTTON_RADIUS = 10;
  private static final int STEP = 5;
  private final Image backgroundImage;
  private final Image buttonFocus;
  private final Image buttonNoFocus;
  private int selection;
  private final List<SelectionListener> selectionListeners;
  private boolean mousePressed;
  
  public AngleSlider(Composite parent, int style)
  {
    super(parent, style | 0x20000000);
    
    backgroundImage = new Image(getDisplay(), getClass().getClassLoader().getResourceAsStream("images/angleBackground.png"));
    
    buttonFocus = new Image(getDisplay(), getClass().getClassLoader().getResourceAsStream("images/angleButtonFocus.png"));
    buttonNoFocus = new Image(getDisplay(), getClass().getClassLoader().getResourceAsStream("images/angleButtonFocusLost.png"));
    
    addListener(9, new Listener()
    {
      public void handleEvent(Event event)
      {
        AngleSlider.this.paintControl(event);
      }
    });
    addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent arg0)
      {
        SWTGraphicUtil.dispose(backgroundImage);
        SWTGraphicUtil.dispose(buttonFocus);
        SWTGraphicUtil.dispose(buttonNoFocus);
      }
    });
    addListener(3, createMouseListener());
    addListener(4, createMouseListener());
    addListener(5, createMouseListener());
    addListener(1, createKeyListener());
    
    selection = 0;
    selectionListeners = new ArrayList();
  }
  
  private void paintControl(Event event)
  {
    GC gc = gc;
    
    gc.drawImage(backgroundImage, 0, 0);
    
    float angle = selection / 360.0F;
    angle = (float)(angle * 2.0F * 3.141592653589793D - 1.5707963267948966D);
    
    float x = (float)(20.0D - 10.0D * Math.cos(angle));
    float y = (float)(20.0D - 10.0D * Math.sin(angle));
    if (isFocusControl()) {
      gc.drawImage(buttonFocus, (int)x - 2, (int)y - 2);
    } else {
      gc.drawImage(buttonNoFocus, (int)x - 2, (int)y - 2);
    }
    if (!isEnabled())
    {
      gc.setAlpha(127);
      gc.setAntialias(1);
      gc.setBackground(getDisplay().getSystemColor(1));
      gc.fillOval(4, 4, 33, 33);
    }
  }
  
  private Listener createMouseListener()
  {
    new Listener()
    {
      public void handleEvent(Event event)
      {
        if (!isEnabled()) {
          return;
        }
        if (type == 3) {
          mousePressed = true;
        }
        if ((type == 3) || ((type == 5) && (mousePressed)))
        {
          float deltaX = x - 20.0F;
          float deltaY = y - 20.0F;
          double angle = Math.atan2(deltaX, deltaY);
          selection = (360 - (int)(360.0D * angle / 6.283185307179586D + 360.0D) % 360);
          
          redraw();
        }
        if (type == 4)
        {
          mousePressed = false;
          AngleSlider.this.fireSelectionListeners(event);
        }
      }
    };
  }
  
  private void fireSelectionListeners(Event event)
  {
    for (SelectionListener selectionListener : selectionListeners) {
      selectionListener.widgetSelected(new SelectionEvent(event));
    }
  }
  
  private Listener createKeyListener()
  {
    new Listener()
    {
      public void handleEvent(Event event)
      {
        if (!isEnabled()) {
          return;
        }
        if (type != 1) {
          return;
        }
        if ((keyCode == 16777217) || (keyCode == 16777219)) {
          setSelection(selection + 5);
        }
        if ((keyCode == 16777218) || (keyCode == 16777220)) {
          setSelection(selection - 5);
        }
      }
    };
  }
  
  public void addSelectionListener(SelectionListener selectionListener)
  {
    checkWidget();
    selectionListeners.add(selectionListener);
  }
  
  public Point computeSize(int wHint, int hHint, boolean changed)
  {
    checkWidget();
    return new Point(40, 40);
  }
  
  public int getSelection()
  {
    checkWidget();
    return selection;
  }
  
  public void removeSelectionListener(SelectionListener selectionListener)
  {
    checkWidget();
    selectionListeners.remove(selectionListener);
  }
  
  public void setEnabled(boolean enabled)
  {
    super.setEnabled(enabled);
    redraw();
  }
  
  public void setSelection(int selection)
  {
    checkWidget();
    if ((selection < 0) || (selection > 360)) {
      SWT.error(28);
    }
    this.selection = selection;
    fireSelectionListeners(new Event());
    redraw();
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.angles.AngleSlider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.brushedMetalComposite;

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

class BrushedMetalComposite$1
  implements Listener
{
  BrushedMetalComposite$1(BrushedMetalComposite paramBrushedMetalComposite) {}
  
  public void handleEvent(Event event)
  {
    BrushedMetalComposite.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.brushedMetalComposite.BrushedMetalComposite.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.brushedMetalComposite;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.mihalis.opal.utils.SWTGraphicUtil;

class BrushedMetalComposite$2
  implements DisposeListener
{
  BrushedMetalComposite$2(BrushedMetalComposite paramBrushedMetalComposite) {}
  
  public void widgetDisposed(DisposeEvent e)
  {
    SWTGraphicUtil.dispose(BrushedMetalComposite.access$1(this$0));
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.brushedMetalComposite.BrushedMetalComposite.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.brushedMetalComposite;

import java.util.Random;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.mihalis.opal.utils.SWTGraphicUtil;

public class BrushedMetalComposite
  extends Composite
{
  private Image oldImage;
  private int radius = 10;
  private float amount = 0.1F;
  private int color = -7829368;
  private float shine = 0.1F;
  private boolean monochrome = true;
  private Random randomNumbers;
  
  public BrushedMetalComposite(Composite parent, int style)
  {
    super(parent, style);
    addListener(11, new Listener()
    {
      public void handleEvent(Event event)
      {
        BrushedMetalComposite.this.redrawComposite();
      }
    });
    parent.addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent e)
      {
        SWTGraphicUtil.dispose(oldImage);
      }
    });
  }
  
  private void redrawComposite()
  {
    Display display = getDisplay();
    Rectangle rect = getClientArea();
    ImageData imageData = drawBrushedMetalBackground(Math.max(1, width), Math.max(1, width));
    Image newImage = new Image(display, imageData);
    
    setBackgroundImage(newImage);
    SWTGraphicUtil.dispose(oldImage);
    oldImage = newImage;
  }
  
  private ImageData drawBrushedMetalBackground(int width, int height)
  {
    int[] inPixels = new int[width];
    PaletteData palette = new PaletteData(16711680, 65280, 255);
    ImageData data = new ImageData(width, height, 32, palette);
    
    randomNumbers = new Random(0L);
    int a = color & 0xFF000000;
    int r = color >> 16 & 0xFF;
    int g = color >> 8 & 0xFF;
    int b = color & 0xFF;
    for (int y = 0; y < height; y++)
    {
      for (int x = 0; x < width; x++)
      {
        int tr = r;
        int tg = g;
        int tb = b;
        if (shine != 0.0F)
        {
          int f = (int)(255.0F * shine * Math.sin(x / width * 3.141592653589793D));
          tr += f;
          tg += f;
          tb += f;
        }
        if (monochrome)
        {
          int n = (int)(255.0F * (2.0F * randomNumbers.nextFloat() - 1.0F) * amount);
          inPixels[x] = (a | clamp(tr + n) << 16 | clamp(tg + n) << 8 | clamp(tb + n));
        }
        else
        {
          inPixels[x] = (a | random(tr) << 16 | random(tg) << 8 | random(tb));
        }
      }
      if (radius != 0) {
        setDataElements(data, palette, 0, y, width, 1, blur(inPixels, width, radius));
      } else {
        setDataElements(data, palette, 0, y, width, 1, inPixels);
      }
    }
    return data;
  }
  
  private void setDataElements(ImageData data, PaletteData palette, int posX, int posY, int width, int height, int[] pixels)
  {
    int cpt = 0;
    for (int y = posY; y < posY + height; y++) {
      for (int x = posX; x < posX + width; x++)
      {
        int rgb = pixels[(cpt++)];
        int pixel = palette.getPixel(new RGB(rgb >> 16 & 0xFF, rgb >> 8 & 0xFF, rgb & 0xFF));
        data.setPixel(x, y, pixel);
        data.setAlpha(x, y, rgb >> 24 & 0xFF);
      }
    }
  }
  
  private int random(int x)
  {
    x += (int)(255.0F * (2.0F * randomNumbers.nextFloat() - 1.0F) * amount);
    if (x < 0) {
      x = 0;
    } else if (x > 255) {
      x = 255;
    }
    return x;
  }
  
  private int clamp(int c)
  {
    if (c < 0) {
      return 0;
    }
    if (c > 255) {
      return 255;
    }
    return c;
  }
  
  private int[] blur(int[] in, int width, int radius)
  {
    int[] out = new int[width];
    int widthMinus1 = width - 1;
    int r2 = 2 * radius + 1;
    int tr = 0;int tg = 0;int tb = 0;
    for (int i = -radius; i <= radius; i++)
    {
      int rgb = in[mod(i, width)];
      tr += (rgb >> 16 & 0xFF);
      tg += (rgb >> 8 & 0xFF);
      tb += (rgb & 0xFF);
    }
    for (int x = 0; x < width; x++)
    {
      out[x] = (0xFF000000 | tr / r2 << 16 | tg / r2 << 8 | tb / r2);
      
      int i1 = x + radius + 1;
      if (i1 > widthMinus1) {
        i1 = mod(i1, width);
      }
      int i2 = x - radius;
      if (i2 < 0) {
        i2 = mod(i2, width);
      }
      int rgb1 = in[i1];
      int rgb2 = in[i2];
      
      tr += ((rgb1 & 0xFF0000) - (rgb2 & 0xFF0000) >> 16);
      tg += ((rgb1 & 0xFF00) - (rgb2 & 0xFF00) >> 8);
      tb += (rgb1 & 0xFF) - (rgb2 & 0xFF);
    }
    return out;
  }
  
  private int mod(int a, int b)
  {
    int n = a / b;
    
    a -= n * b;
    if (a < 0) {
      return a + b;
    }
    return a;
  }
  
  public int getRadius()
  {
    return radius;
  }
  
  public void setRadius(int radius)
  {
    this.radius = radius;
    redrawComposite();
  }
  
  public float getAmount()
  {
    return amount;
  }
  
  public void setAmount(float amount)
  {
    if ((amount < 0.0F) || (amount > 1.0F)) {
      SWT.error(5);
    }
    this.amount = amount;
    redrawComposite();
  }
  
  public Color getColor()
  {
    return new Color(getDisplay(), color >> 16 & 0xFF, color >> 8 & 0xFF, color & 0xFF);
  }
  
  public void setColor(Color color)
  {
    if (color == null) {
      SWT.error(4);
    }
    this.color = (0xFF000000 | color.getRed() << 16 | color.getGreen() << 8 | color.getBlue());
    redrawComposite();
  }
  
  public float getShine()
  {
    return shine;
  }
  
  public void setShine(float shine)
  {
    if ((amount < 0.0F) || (amount > 1.0F)) {
      SWT.error(5);
    }
    this.shine = shine;
    redrawComposite();
  }
  
  public boolean isMonochrome()
  {
    return monochrome;
  }
  
  public void setMonochrome(boolean monochrome)
  {
    this.monochrome = monochrome;
    redrawComposite();
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.brushedMetalComposite.BrushedMetalComposite
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.checkBoxGroup;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class CheckBoxGroup$1
  extends SelectionAdapter
{
  CheckBoxGroup$1(CheckBoxGroup paramCheckBoxGroup) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    doit = CheckBoxGroup.access$0(this$0, e);
    if (!doit) {
      return;
    }
    if (this$0.button.getSelection()) {
      this$0.activate();
    } else {
      this$0.deactivate();
    }
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.checkBoxGroup.CheckBoxGroup.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.checkBoxGroup;

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

class CheckBoxGroup$2
  implements Listener
{
  CheckBoxGroup$2(CheckBoxGroup paramCheckBoxGroup) {}
  
  public void handleEvent(Event event)
  {
    CheckBoxGroup.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.checkBoxGroup.CheckBoxGroup.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.checkBoxGroup;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
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.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.mihalis.opal.utils.SWTGraphicUtil;

public class CheckBoxGroup
  extends Composite
{
  private Image oldImage;
  protected final Button button;
  private final Composite content;
  private final List<SelectionListener> selectionListeners;
  
  public CheckBoxGroup(Composite parent, int style)
  {
    super(parent, style);
    super.setLayout(new GridLayout());
    selectionListeners = new ArrayList();
    
    button = new Button(this, 32);
    GridData gdButton = new GridData(1, 2, true, false);
    horizontalIndent = 15;
    button.setLayoutData(gdButton);
    button.setSelection(true);
    button.setBackground(getBackground());
    button.pack();
    
    button.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        doit = CheckBoxGroup.this.fireSelectionListeners(e);
        if (!doit) {
          return;
        }
        if (button.getSelection()) {
          activate();
        } else {
          deactivate();
        }
      }
    });
    content = new Composite(this, 0);
    content.setLayoutData(new GridData(4, 4, true, true));
    
    addListener(11, new Listener()
    {
      public void handleEvent(Event event)
      {
        CheckBoxGroup.this.drawWidget();
      }
    });
  }
  
  private boolean fireSelectionListeners(SelectionEvent selectionEvent)
  {
    widget = this;
    for (SelectionListener listener : selectionListeners)
    {
      listener.widgetSelected(selectionEvent);
      if (!doit) {
        return false;
      }
    }
    return true;
  }
  
  private void drawWidget()
  {
    Display display = getDisplay();
    Rectangle rect = getClientArea();
    Image newImage = new Image(display, Math.max(1, width), Math.max(1, height));
    
    GC gc = new GC(newImage);
    gc.setBackground(getBackground());
    
    gc.fillRectangle(0, 0, width, height);
    
    int margin = (int)(button.getSize().y * 1.5D);
    int startY = margin / 2;
    
    gc.setForeground(getDisplay().getSystemColor(18));
    gc.drawRoundRectangle(1, startY, width - 2, height - startY - 2, 2, 2);
    
    gc.setForeground(getDisplay().getSystemColor(19));
    gc.drawRoundRectangle(2, startY + 1, width - 4, height - startY - 4, 2, 2);
    
    gc.dispose();
    
    setBackgroundImage(newImage);
    if (oldImage != null) {
      oldImage.dispose();
    }
    oldImage = newImage;
  }
  
  public void activate()
  {
    button.setSelection(true);
    SWTGraphicUtil.enable(content, true);
  }
  
  public void addSelectionListener(SelectionListener listener)
  {
    checkWidget();
    selectionListeners.add(listener);
  }
  
  public void deactivate()
  {
    button.setSelection(false);
    SWTGraphicUtil.enable(content, false);
  }
  
  public boolean isActivated()
  {
    return button.getSelection();
  }
  
  public Layout getLayout()
  {
    return content.getLayout();
  }
  
  public void removeSelectionListener(SelectionListener listener)
  {
    checkWidget();
    selectionListeners.remove(listener);
  }
  
  public boolean setFocus()
  {
    return content.setFocus();
  }
  
  public void setLayout(Layout layout)
  {
    content.setLayout(layout);
  }
  
  public String getText()
  {
    return button.getText();
  }
  
  public void setText(String text)
  {
    button.setText(text);
  }
  
  public Font getFont()
  {
    return button.getFont();
  }
  
  public void setFont(Font font)
  {
    button.setFont(font);
  }
  
  public Composite getContent()
  {
    return content;
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.checkBoxGroup.CheckBoxGroup
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.columns;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.mihalis.opal.utils.SWTGraphicUtil;

class ColumnBrowserWidget$1
  implements DisposeListener
{
  ColumnBrowserWidget$1(ColumnBrowserWidget paramColumnBrowserWidget) {}
  
  public void widgetDisposed(DisposeEvent arg0)
  {
    SWTGraphicUtil.dispose(ColumnBrowserWidget.access$0(this$0));
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.columns.ColumnBrowserWidget.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.columns;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;

class ColumnBrowserWidget$2
  implements Listener
{
  ColumnBrowserWidget$2(ColumnBrowserWidget paramColumnBrowserWidget, Table paramTable) {}
  
  public void handleEvent(Event event)
  {
    int width = val$table.getSize().x;
    val$table.getColumn(0).setWidth(width - 5);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.columns.ColumnBrowserWidget.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.columns;

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

class ColumnBrowserWidget$3
  implements Listener
{
  ColumnBrowserWidget$3(ColumnBrowserWidget paramColumnBrowserWidget) {}
  
  public void handleEvent(Event event)
  {
    Table table = (Table)widget;
    if ((table.getSelection() == null) || (table.getSelection().length != 1)) {
      return;
    }
    ColumnBrowserWidget.access$1(this$0, table.getSelection()[0]);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.columns.ColumnBrowserWidget.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.columns;

import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.TableItem;

class ColumnBrowserWidget$4
  implements Listener
{
  ColumnBrowserWidget$4(ColumnBrowserWidget paramColumnBrowserWidget) {}
  
  public void handleEvent(Event event)
  {
    switch (type)
    {
    case 41: 
      Rectangle rect = ColumnBrowserWidget.access$0(this$0).getBounds();
      width += width;
      height = Math.max(height, height + 2);
      break;
    case 42: 
      if (!(item instanceof TableItem)) {
        return;
      }
      TableItem item = (TableItem)item;
      if (item.getData() == null) {
        return;
      }
      if (((ColumnItem)item.getData()).getItemCount() == 0) {
        return;
      }
      int x = x + width;
      Rectangle rect = ColumnBrowserWidget.access$0(this$0).getBounds();
      int offset = Math.max(0, (height - height) / 2);
      gc.drawImage(ColumnBrowserWidget.access$0(this$0), x, y + offset);
      break;
    }
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.columns.ColumnBrowserWidget.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.columns;

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;

class ColumnBrowserWidget$5
  implements SelectionListener
{
  ColumnBrowserWidget$5(ColumnBrowserWidget paramColumnBrowserWidget) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    ColumnBrowserWidget.access$2(this$0, e);
  }
  
  public void widgetDefaultSelected(SelectionEvent e)
  {
    ColumnBrowserWidget.access$2(this$0, e);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.columns.ColumnBrowserWidget.5
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.columns;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Font;
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.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.mihalis.opal.utils.SWTGraphicUtil;

public class ColumnBrowserWidget
  extends ScrolledComposite
{
  private final List<Table> columns;
  private final Composite composite;
  private final Image columnArrow;
  private final List<SelectionListener> selectionListeners;
  
  public ColumnBrowserWidget(Composite parent, int style)
  {
    super(parent, style | 0x100 | 0x200);
    
    composite = new Composite(this, 0);
    RowLayout layout = new RowLayout(256);
    spacing = 1;
    pack = false;
    composite.setLayout(layout);
    
    columnArrow = SWTGraphicUtil.createImage("images/columnArrow.png");
    
    columns = new ArrayList();
    for (int i = 0; i < 3; i++) {
      createTable();
    }
    ((Table)columns.get(0)).setData(new ColumnItem(this));
    
    setContent(composite);
    setExpandHorizontal(true);
    setExpandVertical(true);
    setShowFocusedControl(true);
    updateContent();
    setMinSize(composite.computeSize(-1, -1));
    
    selectionListeners = new ArrayList();
    
    addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent arg0)
      {
        SWTGraphicUtil.dispose(columnArrow);
      }
    });
  }
  
  private void createTable()
  {
    final Table table = new Table(composite, 67844);
    new TableColumn(table, 16384);
    
    table.setLayoutData(new RowData(150, 175));
    columns.add(table);
    
    table.addListener(11, new Listener()
    {
      public void handleEvent(Event event)
      {
        int width = tablegetSizex;
        table.getColumn(0).setWidth(width - 5);
      }
    });
    table.addListener(13, new Listener()
    {
      public void handleEvent(Event event)
      {
        Table table = (Table)widget;
        if ((table.getSelection() == null) || (table.getSelection().length != 1)) {
          return;
        }
        ColumnBrowserWidget.this.selectItem(table.getSelection()[0]);
      }
    });
    Listener paintListener = new Listener()
    {
      public void handleEvent(Event event)
      {
        switch (type)
        {
        case 41: 
          Rectangle rect = columnArrow.getBounds();
          width += width;
          height = Math.max(height, height + 2);
          break;
        case 42: 
          if (!(item instanceof TableItem)) {
            return;
          }
          TableItem item = (TableItem)item;
          if (item.getData() == null) {
            return;
          }
          if (((ColumnItem)item.getData()).getItemCount() == 0) {
            return;
          }
          int x = x + width;
          Rectangle rect = columnArrow.getBounds();
          int offset = Math.max(0, (height - height) / 2);
          gc.drawImage(columnArrow, x, y + offset);
          break;
        }
      }
    };
    table.addListener(41, paintListener);
    table.addListener(42, paintListener);
    
    table.addSelectionListener(new SelectionListener()
    {
      public void widgetSelected(SelectionEvent e)
      {
        ColumnBrowserWidget.this.fireSelectionListeners(e);
      }
      
      public void widgetDefaultSelected(SelectionEvent e)
      {
        ColumnBrowserWidget.this.fireSelectionListeners(e);
      }
    });
    if ((super.getBackground() != null) && (super.getBackground().getRed() != 240) && (super.getBackground().getGreen() != 240) && (super.getBackground().getBlue() != 240)) {
      table.setBackground(super.getBackground());
    }
    table.setBackgroundImage(super.getBackgroundImage());
    table.setBackgroundMode(super.getBackgroundMode());
    table.setCursor(super.getCursor());
    table.setFont(super.getFont());
    table.setForeground(super.getForeground());
    table.setMenu(super.getMenu());
    table.setToolTipText(super.getToolTipText());
  }
  
  private boolean fireSelectionListeners(SelectionEvent selectionEvent)
  {
    for (SelectionListener listener : selectionListeners)
    {
      Event event = new Event();
      
      button = 0;
      display = getDisplay();
      item = null;
      widget = this;
      data = null;
      time = time;
      x = x;
      y = y;
      
      SelectionEvent selEvent = new SelectionEvent(event);
      listener.widgetSelected(selEvent);
      if (!doit) {
        return false;
      }
    }
    return true;
  }
  
  private void selectItem(TableItem tableItem)
  {
    ColumnItem c = (ColumnItem)tableItem.getData();
    if (c.getItemCount() == 0) {
      return;
    }
    int selectedColumn = findSelectedColumn(tableItem);
    boolean needPacking = false;
    if (selectedColumn != columns.size() - 1)
    {
      for (int i = selectedColumn + 1; i < columns.size(); i++)
      {
        ((Table)columns.get(i)).setData(null);
        ((Table)columns.get(i)).deselectAll();
      }
      int i = 0;
      Iterator<Table> it = columns.iterator();
      while (it.hasNext())
      {
        Table t = (Table)it.next();
        if (i >= 3)
        {
          t.dispose();
          it.remove();
          
          setMinSize(composite.computeSize(-1, -1));
        }
        i++;
      }
      if (selectedColumn != columns.size() - 1)
      {
        ((Table)columns.get(selectedColumn + 1)).setData(c);
      }
      else
      {
        createTable();
        ((Table)columns.get(columns.size() - 1)).setData(c);
      }
      needPacking = true;
    }
    else
    {
      createTable();
      needPacking = true;
      ((Table)columns.get(columns.size() - 1)).setData(c);
    }
    updateContent();
    if (needPacking)
    {
      composite.pack();
      setMinSize(composite.computeSize(-1, -1));
    }
    ((Table)columns.get(columns.size() - 1)).forceFocus();
  }
  
  private int findSelectedColumn(TableItem tableItem)
  {
    for (int i = 0; i < columns.size(); i++) {
      if (((Table)columns.get(i)).equals(tableItem.getParent())) {
        return i;
      }
    }
    return -1;
  }
  
  void updateContent()
  {
    if (columns == null) {
      return;
    }
    for (int i = 0; i < columns.size(); i++)
    {
      Table table = (Table)columns.get(i);
      int index = table.getSelectionIndex();
      table.removeAll();
      if (table.getData() != null)
      {
        ColumnItem[] arrayOfColumnItem;
        int j = (arrayOfColumnItem = ((ColumnItem)table.getData()).getItems()).length;
        for (int i = 0; i < j; i++)
        {
          ColumnItem c = arrayOfColumnItem[i];
          TableItem item = new TableItem(table, 0);
          item.setData(c);
          if (c.getText() != null) {
            item.setText(c.getText());
          }
          if (c.getImage() != null) {
            item.setImage(c.getImage());
          }
        }
        table.setSelection(index);
      }
    }
  }
  
  public void addSelectionListener(SelectionListener listener)
  {
    checkWidget();
    selectionListeners.add(listener);
  }
  
  public void clear(boolean needPacking)
  {
    Iterator<Table> it = columns.iterator();
    int i = 0;
    while (it.hasNext())
    {
      Table t = (Table)it.next();
      if (i >= 3)
      {
        t.dispose();
        it.remove();
      }
      else
      {
        if (i != 0) {
          t.setData(null);
        }
        t.deselectAll();
      }
      i++;
    }
    updateContent();
    if (needPacking)
    {
      composite.pack();
      setMinSize(composite.computeSize(-1, -1));
    }
    ((Table)columns.get(0)).forceFocus();
  }
  
  public ColumnItem getSelection()
  {
    for (int i = columns.size() - 1; i >= 0; i--)
    {
      Table table = (Table)columns.get(i);
      if ((table != null) && (table.getData() != null) && (table.getSelection().length != 0)) {
        return (ColumnItem)table.getItem(table.getSelectionIndex()).getData();
      }
    }
    return null;
  }
  
  public void removeSelectionListener(SelectionListener listener)
  {
    checkWidget();
    selectionListeners.remove(listener);
  }
  
  public void select(ColumnItem item)
  {
    List<ColumnItem> items = new ArrayList();
    findElement(item, items);
    Collections.reverse(items);
    if (items.isEmpty()) {
      return;
    }
    clear(false);
    for (int i = 3; i < items.size(); i++) {
      createTable();
    }
    for (int i = 0; i < items.size() - 1; i++) {
      ((Table)columns.get(i + 1)).setData(items.get(i));
    }
    updateContent();
    for (int i = 0; i < columns.size() - 1; i++)
    {
      ColumnItem nextItem = (ColumnItem)((Table)columns.get(i + 1)).getData();
      TableItem[] arrayOfTableItem;
      int j = (arrayOfTableItem = ((Table)columns.get(i)).getItems()).length;
      for (int i = 0; i < j; i++)
      {
        TableItem tableItem = arrayOfTableItem[i];
        if ((tableItem.getData() != null) && (tableItem.getData().equals(nextItem))) {
          tableItem.getParent().setSelection(tableItem);
        }
      }
    }
    composite.pack();
    setMinSize(composite.computeSize(-1, -1));
    ((Table)columns.get(columns.size() - 1)).forceFocus();
  }
  
  private void findElement(ColumnItem item, List<ColumnItem> items)
  {
    if (item == null) {
      return;
    }
    items.add(item);
    findElement(item.getParentItem(), items);
  }
  
  public void setBackground(Color color)
  {
    super.setBackground(color);
    for (Table column : columns) {
      column.setBackground(color);
    }
  }
  
  public void setBackgroundMode(int mode)
  {
    super.setBackgroundMode(mode);
    for (Table column : columns) {
      column.setBackgroundMode(mode);
    }
  }
  
  public void setBackgroundImage(Image image)
  {
    super.setBackgroundImage(image);
    for (Table column : columns) {
      column.setBackgroundImage(image);
    }
  }
  
  public void setCursor(Cursor cursor)
  {
    super.setCursor(cursor);
    for (Table column : columns) {
      column.setCursor(cursor);
    }
  }
  
  public void setFont(Font font)
  {
    super.setFont(font);
    for (Table column : columns) {
      column.setFont(font);
    }
  }
  
  public void setForeground(Color color)
  {
    super.setForeground(color);
    for (Table column : columns) {
      column.setForeground(color);
    }
  }
  
  public void setMenu(Menu menu)
  {
    super.setMenu(menu);
    for (Table column : columns) {
      column.setMenu(menu);
    }
  }
  
  public void setToolTipText(String tooltipText)
  {
    super.setToolTipText(tooltipText);
    for (Table column : columns) {
      column.setToolTipText(tooltipText);
    }
  }
  
  ColumnItem getRootItem()
  {
    if ((columns == null) || (columns.isEmpty())) {
      return null;
    }
    return (ColumnItem)((Table)columns.get(0)).getData();
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.columns.ColumnBrowserWidget
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.columns;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.mihalis.opal.OpalItem;

public class ColumnItem
  extends OpalItem
{
  private final ColumnBrowserWidget widget;
  private final ColumnItem parent;
  private final List<ColumnItem> children;
  
  public ColumnItem(ColumnBrowserWidget widget)
  {
    if (widget == null) {
      SWT.error(4);
    }
    if (widget.isDisposed()) {
      SWT.error(24);
    }
    this.widget = widget;
    parent = null;
    children = new ArrayList();
    if (widget.getRootItem() != null) {
      getRootItemchildren.add(this);
    }
    widget.updateContent();
  }
  
  public ColumnItem(ColumnBrowserWidget widget, int index)
  {
    if (widget == null) {
      SWT.error(4);
    }
    if (widget.isDisposed()) {
      SWT.error(24);
    }
    this.widget = widget;
    parent = null;
    children = new ArrayList();
    getRootItemchildren.add(index, this);
    widget.updateContent();
  }
  
  public ColumnItem(ColumnItem parent)
  {
    if (parent == null) {
      SWT.error(4);
    }
    if (widget.isDisposed()) {
      SWT.error(24);
    }
    widget = widget;
    this.parent = parent;
    children = new ArrayList();
    children.add(this);
    widget.updateContent();
  }
  
  public ColumnItem(ColumnItem parent, int index)
  {
    if (parent == null) {
      SWT.error(4);
    }
    if (widget.isDisposed()) {
      SWT.error(24);
    }
    widget = widget;
    this.parent = parent;
    children = new ArrayList();
    children.add(index, this);
    widget.updateContent();
  }
  
  public void remove(ColumnItem item)
  {
    if (widget == null) {
      SWT.error(4);
    }
    if (widget.isDis
1 2 3 4 5 6 7 8 9 10 11 12

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