jcommon-1.0.12

unitType == null) {
      throw new IllegalArgumentException("Null 'unitType' argument.");
    }
    this.unitType = unitType;
    this.top = top;
    this.bottom = bottom;
    this.left = left;
    this.right = right;
  }
  
  public UnitType getUnitType()
  {
    return unitType;
  }
  
  public double getTop()
  {
    return top;
  }
  
  public double getBottom()
  {
    return bottom;
  }
  
  public double getLeft()
  {
    return left;
  }
  
  public double getRight()
  {
    return right;
  }
  
  public boolean equals(Object obj)
  {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof RectangleInsets)) {
      return false;
    }
    RectangleInsets that = (RectangleInsets)obj;
    if (unitType != unitType) {
      return false;
    }
    if (left != left) {
      return false;
    }
    if (right != right) {
      return false;
    }
    if (top != top) {
      return false;
    }
    if (bottom != bottom) {
      return false;
    }
    return true;
  }
  
  public int hashCode()
  {
    int result = unitType != null ? unitType.hashCode() : 0;
    long temp = top != 0.0D ? Double.doubleToLongBits(top) : 0L;
    result = 29 * result + (int)(temp ^ temp >>> 32);
    temp = bottom != 0.0D ? Double.doubleToLongBits(bottom) : 0L;
    result = 29 * result + (int)(temp ^ temp >>> 32);
    temp = left != 0.0D ? Double.doubleToLongBits(left) : 0L;
    result = 29 * result + (int)(temp ^ temp >>> 32);
    temp = right != 0.0D ? Double.doubleToLongBits(right) : 0L;
    result = 29 * result + (int)(temp ^ temp >>> 32);
    return result;
  }
  
  public String toString()
  {
    return "RectangleInsets[t=" + top + ",l=" + left + ",b=" + bottom + ",r=" + right + "]";
  }
  
  public Rectangle2D createAdjustedRectangle(Rectangle2D base, LengthAdjustmentType horizontal, LengthAdjustmentType vertical)
  {
    if (base == null) {
      throw new IllegalArgumentException("Null 'base' argument.");
    }
    double x = base.getX();
    double y = base.getY();
    double w = base.getWidth();
    double h = base.getHeight();
    if (horizontal == LengthAdjustmentType.EXPAND)
    {
      double leftOutset = calculateLeftOutset(w);
      x -= leftOutset;
      w = w + leftOutset + calculateRightOutset(w);
    }
    else if (horizontal == LengthAdjustmentType.CONTRACT)
    {
      double leftMargin = calculateLeftInset(w);
      x += leftMargin;
      w = w - leftMargin - calculateRightInset(w);
    }
    if (vertical == LengthAdjustmentType.EXPAND)
    {
      double topMargin = calculateTopOutset(h);
      y -= topMargin;
      h = h + topMargin + calculateBottomOutset(h);
    }
    else if (vertical == LengthAdjustmentType.CONTRACT)
    {
      double topMargin = calculateTopInset(h);
      y += topMargin;
      h = h - topMargin - calculateBottomInset(h);
    }
    return new Rectangle2D.Double(x, y, w, h);
  }
  
  public Rectangle2D createInsetRectangle(Rectangle2D base)
  {
    return createInsetRectangle(base, true, true);
  }
  
  public Rectangle2D createInsetRectangle(Rectangle2D base, boolean horizontal, boolean vertical)
  {
    if (base == null) {
      throw new IllegalArgumentException("Null 'base' argument.");
    }
    double topMargin = 0.0D;
    double bottomMargin = 0.0D;
    if (vertical)
    {
      topMargin = calculateTopInset(base.getHeight());
      bottomMargin = calculateBottomInset(base.getHeight());
    }
    double leftMargin = 0.0D;
    double rightMargin = 0.0D;
    if (horizontal)
    {
      leftMargin = calculateLeftInset(base.getWidth());
      rightMargin = calculateRightInset(base.getWidth());
    }
    return new Rectangle2D.Double(base.getX() + leftMargin, base.getY() + topMargin, base.getWidth() - leftMargin - rightMargin, base.getHeight() - topMargin - bottomMargin);
  }
  
  public Rectangle2D createOutsetRectangle(Rectangle2D base)
  {
    return createOutsetRectangle(base, true, true);
  }
  
  public Rectangle2D createOutsetRectangle(Rectangle2D base, boolean horizontal, boolean vertical)
  {
    if (base == null) {
      throw new IllegalArgumentException("Null 'base' argument.");
    }
    double topMargin = 0.0D;
    double bottomMargin = 0.0D;
    if (vertical)
    {
      topMargin = calculateTopOutset(base.getHeight());
      bottomMargin = calculateBottomOutset(base.getHeight());
    }
    double leftMargin = 0.0D;
    double rightMargin = 0.0D;
    if (horizontal)
    {
      leftMargin = calculateLeftOutset(base.getWidth());
      rightMargin = calculateRightOutset(base.getWidth());
    }
    return new Rectangle2D.Double(base.getX() - leftMargin, base.getY() - topMargin, base.getWidth() + leftMargin + rightMargin, base.getHeight() + topMargin + bottomMargin);
  }
  
  public double calculateTopInset(double height)
  {
    double result = top;
    if (unitType == UnitType.RELATIVE) {
      result = top * height;
    }
    return result;
  }
  
  public double calculateTopOutset(double height)
  {
    double result = top;
    if (unitType == UnitType.RELATIVE) {
      result = height / (1.0D - top - bottom) * top;
    }
    return result;
  }
  
  public double calculateBottomInset(double height)
  {
    double result = bottom;
    if (unitType == UnitType.RELATIVE) {
      result = bottom * height;
    }
    return result;
  }
  
  public double calculateBottomOutset(double height)
  {
    double result = bottom;
    if (unitType == UnitType.RELATIVE) {
      result = height / (1.0D - top - bottom) * bottom;
    }
    return result;
  }
  
  public double calculateLeftInset(double width)
  {
    double result = left;
    if (unitType == UnitType.RELATIVE) {
      result = left * width;
    }
    return result;
  }
  
  public double calculateLeftOutset(double width)
  {
    double result = left;
    if (unitType == UnitType.RELATIVE) {
      result = width / (1.0D - left - right) * left;
    }
    return result;
  }
  
  public double calculateRightInset(double width)
  {
    double result = right;
    if (unitType == UnitType.RELATIVE) {
      result = right * width;
    }
    return result;
  }
  
  public double calculateRightOutset(double width)
  {
    double result = right;
    if (unitType == UnitType.RELATIVE) {
      result = width / (1.0D - left - right) * right;
    }
    return result;
  }
  
  public double trimWidth(double width)
  {
    return width - calculateLeftInset(width) - calculateRightInset(width);
  }
  
  public double extendWidth(double width)
  {
    return width + calculateLeftOutset(width) + calculateRightOutset(width);
  }
  
  public double trimHeight(double height)
  {
    return height - calculateTopInset(height) - calculateBottomInset(height);
  }
  
  public double extendHeight(double height)
  {
    return height + calculateTopOutset(height) + calculateBottomOutset(height);
  }
  
  public void trim(Rectangle2D area)
  {
    double w = area.getWidth();
    double h = area.getHeight();
    double l = calculateLeftInset(w);
    double r = calculateRightInset(w);
    double t = calculateTopInset(h);
    double b = calculateBottomInset(h);
    area.setRect(area.getX() + l, area.getY() + t, w - l - r, h - t - b);
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.RectangleInsets
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.lang.reflect.Method;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;

public class RefineryUtilities
{
  public static Point getCenterPoint()
  {
    GraphicsEnvironment localGraphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    try
    {
      Method method = GraphicsEnvironment.class.getMethod("getCenterPoint", (Class[])null);
      return (Point)method.invoke(localGraphicsEnvironment, (Object[])null);
    }
    catch (Exception e)
    {
      Dimension s = Toolkit.getDefaultToolkit().getScreenSize();
      return new Point(width / 2, height / 2);
    }
  }
  
  public static Rectangle getMaximumWindowBounds()
  {
    GraphicsEnvironment localGraphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    try
    {
      Method method = GraphicsEnvironment.class.getMethod("getMaximumWindowBounds", (Class[])null);
      return (Rectangle)method.invoke(localGraphicsEnvironment, (Object[])null);
    }
    catch (Exception e)
    {
      Dimension s = Toolkit.getDefaultToolkit().getScreenSize();
      return new Rectangle(0, 0, width, height);
    }
  }
  
  public static void centerFrameOnScreen(Window frame)
  {
    positionFrameOnScreen(frame, 0.5D, 0.5D);
  }
  
  public static void positionFrameOnScreen(Window frame, double horizontalPercent, double verticalPercent)
  {
    Rectangle s = getMaximumWindowBounds();
    Dimension f = frame.getSize();
    int w = Math.max(width - width, 0);
    int h = Math.max(height - height, 0);
    int x = (int)(horizontalPercent * w) + x;
    int y = (int)(verticalPercent * h) + y;
    frame.setBounds(x, y, width, height);
  }
  
  public static void positionFrameRandomly(Window frame)
  {
    positionFrameOnScreen(frame, Math.random(), Math.random());
  }
  
  public static void centerDialogInParent(Dialog dialog)
  {
    positionDialogRelativeToParent(dialog, 0.5D, 0.5D);
  }
  
  public static void positionDialogRelativeToParent(Dialog dialog, double horizontalPercent, double verticalPercent)
  {
    Dimension d = dialog.getSize();
    Container parent = dialog.getParent();
    Dimension p = parent.getSize();
    
    int baseX = parent.getX() - width;
    int baseY = parent.getY() - height;
    int w = width + width;
    int h = height + height;
    int x = baseX + (int)(horizontalPercent * w);
    int y = baseY + (int)(verticalPercent * h);
    
    Rectangle s = getMaximumWindowBounds();
    x = Math.min(x, width - width);
    x = Math.max(x, 0);
    y = Math.min(y, height - height);
    y = Math.max(y, 0);
    
    dialog.setBounds(x + x, y + y, width, height);
  }
  
  public static JPanel createTablePanel(TableModel model)
  {
    JPanel panel = new JPanel(new BorderLayout());
    JTable table = new JTable(model);
    for (int columnIndex = 0; columnIndex < model.getColumnCount(); columnIndex++)
    {
      TableColumn column = table.getColumnModel().getColumn(columnIndex);
      Class c = model.getColumnClass(columnIndex);
      if (c.equals(Number.class)) {
        column.setCellRenderer(new NumberCellRenderer());
      }
    }
    panel.add(new JScrollPane(table));
    return panel;
  }
  
  public static JLabel createJLabel(String text, Font font)
  {
    JLabel result = new JLabel(text);
    result.setFont(font);
    return result;
  }
  
  public static JLabel createJLabel(String text, Font font, Color color)
  {
    JLabel result = new JLabel(text);
    result.setFont(font);
    result.setForeground(color);
    return result;
  }
  
  public static JButton createJButton(String label, Font font)
  {
    JButton result = new JButton(label);
    result.setFont(font);
    return result;
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.RefineryUtilities
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import java.util.Enumeration;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.jfree.date.SerialDate;

public class SerialDateChooserPanel
  extends JPanel
  implements ActionListener
{
  public static final Color DEFAULT_DATE_BUTTON_COLOR = Color.red;
  public static final Color DEFAULT_MONTH_BUTTON_COLOR = Color.lightGray;
  private SerialDate date;
  private Color dateButtonColor;
  private Color monthButtonColor;
  private Color chosenOtherButtonColor = Color.darkGray;
  private int firstDayOfWeek = 1;
  private int yearSelectionRange = 20;
  private Font dateFont = new Font("SansSerif", 0, 10);
  private JComboBox monthSelector = null;
  private JComboBox yearSelector = null;
  private JButton todayButton = null;
  private JButton[] buttons = null;
  private boolean refreshing = false;
  
  public SerialDateChooserPanel()
  {
    this(SerialDate.createInstance(new Date()), false, DEFAULT_DATE_BUTTON_COLOR, DEFAULT_MONTH_BUTTON_COLOR);
  }
  
  public SerialDateChooserPanel(SerialDate date, boolean controlPanel)
  {
    this(date, controlPanel, DEFAULT_DATE_BUTTON_COLOR, DEFAULT_MONTH_BUTTON_COLOR);
  }
  
  public SerialDateChooserPanel(SerialDate date, boolean controlPanel, Color dateButtonColor, Color monthButtonColor)
  {
    super(new BorderLayout());
    
    this.date = date;
    this.dateButtonColor = dateButtonColor;
    this.monthButtonColor = monthButtonColor;
    
    add(constructSelectionPanel(), "North");
    add(getCalendarPanel(), "Center");
    if (controlPanel) {
      add(constructControlPanel(), "South");
    }
  }
  
  public void setDate(SerialDate date)
  {
    this.date = date;
    monthSelector.setSelectedIndex(date.getMonth() - 1);
    refreshYearSelector();
    refreshButtons();
  }
  
  public SerialDate getDate()
  {
    return date;
  }
  
  public void actionPerformed(ActionEvent e)
  {
    if (e.getActionCommand().equals("monthSelectionChanged"))
    {
      JComboBox c = (JComboBox)e.getSource();
      date = SerialDate.createInstance(date.getDayOfMonth(), c.getSelectedIndex() + 1, date.getYYYY());
      
      refreshButtons();
    }
    else if (e.getActionCommand().equals("yearSelectionChanged"))
    {
      if (!refreshing)
      {
        JComboBox c = (JComboBox)e.getSource();
        Integer y = (Integer)c.getSelectedItem();
        date = SerialDate.createInstance(date.getDayOfMonth(), date.getMonth(), y.intValue());
        
        refreshYearSelector();
        refreshButtons();
      }
    }
    else if (e.getActionCommand().equals("todayButtonClicked"))
    {
      setDate(SerialDate.createInstance(new Date()));
    }
    else if (e.getActionCommand().equals("dateButtonClicked"))
    {
      JButton b = (JButton)e.getSource();
      int i = Integer.parseInt(b.getName());
      SerialDate first = getFirstVisibleDate();
      SerialDate selected = SerialDate.addDays(i, first);
      setDate(selected);
    }
  }
  
  private JPanel getCalendarPanel()
  {
    JPanel panel = new JPanel(new GridLayout(7, 7));
    panel.add(new JLabel("Sun", 0));
    panel.add(new JLabel("Mon", 0));
    panel.add(new JLabel("Tue", 0));
    panel.add(new JLabel("Wed", 0));
    panel.add(new JLabel("Thu", 0));
    panel.add(new JLabel("Fri", 0));
    panel.add(new JLabel("Sat", 0));
    
    buttons = new JButton[42];
    for (int i = 0; i < 42; i++)
    {
      JButton button = new JButton("");
      button.setMargin(new Insets(1, 1, 1, 1));
      button.setName(Integer.toString(i));
      button.setFont(dateFont);
      button.setFocusPainted(false);
      button.setActionCommand("dateButtonClicked");
      button.addActionListener(this);
      buttons[i] = button;
      panel.add(button);
    }
    return panel;
  }
  
  protected Color getButtonColor(SerialDate targetDate)
  {
    if (date.equals(date)) {
      return dateButtonColor;
    }
    if (targetDate.getMonth() == date.getMonth()) {
      return monthButtonColor;
    }
    return chosenOtherButtonColor;
  }
  
  protected SerialDate getFirstVisibleDate()
  {
    SerialDate result = SerialDate.createInstance(1, date.getMonth(), date.getYYYY());
    result = SerialDate.addDays(-1, result);
    while (result.getDayOfWeek() != getFirstDayOfWeek()) {
      result = SerialDate.addDays(-1, result);
    }
    return result;
  }
  
  private int getFirstDayOfWeek()
  {
    return firstDayOfWeek;
  }
  
  protected void refreshButtons()
  {
    SerialDate current = getFirstVisibleDate();
    for (int i = 0; i < 42; i++)
    {
      JButton button = buttons[i];
      button.setText(String.valueOf(current.getDayOfWeek()));
      button.setBackground(getButtonColor(current));
      current = SerialDate.addDays(1, current);
    }
  }
  
  private void refreshYearSelector()
  {
    if (!refreshing)
    {
      refreshing = true;
      yearSelector.removeAllItems();
      Vector v = getYears(date.getYYYY());
      for (Enumeration e = v.elements(); e.hasMoreElements();) {
        yearSelector.addItem(e.nextElement());
      }
      yearSelector.setSelectedItem(new Integer(date.getYYYY()));
      refreshing = false;
    }
  }
  
  private Vector getYears(int chosenYear)
  {
    Vector v = new Vector();
    for (int i = chosenYear - yearSelectionRange; i <= chosenYear + yearSelectionRange; i++) {
      v.addElement(new Integer(i));
    }
    return v;
  }
  
  private JPanel constructSelectionPanel()
  {
    JPanel p = new JPanel();
    monthSelector = new JComboBox(SerialDate.getMonths());
    monthSelector.addActionListener(this);
    monthSelector.setActionCommand("monthSelectionChanged");
    p.add(monthSelector);
    
    yearSelector = new JComboBox(getYears(0));
    yearSelector.addActionListener(this);
    yearSelector.setActionCommand("yearSelectionChanged");
    p.add(yearSelector);
    
    return p;
  }
  
  private JPanel constructControlPanel()
  {
    JPanel p = new JPanel();
    p.setBorder(BorderFactory.createEmptyBorder(2, 5, 2, 5));
    todayButton = new JButton("Today");
    todayButton.addActionListener(this);
    todayButton.setActionCommand("todayButtonClicked");
    p.add(todayButton);
    return p;
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.SerialDateChooserPanel
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import java.io.Serializable;
import org.jfree.util.PublicCloneable;

public class Size2D
  implements Cloneable, PublicCloneable, Serializable
{
  private static final long serialVersionUID = 2558191683786418168L;
  public double width;
  public double height;
  
  public Size2D()
  {
    this(0.0D, 0.0D);
  }
  
  public Size2D(double width, double height)
  {
    this.width = width;
    this.height = height;
  }
  
  public double getWidth()
  {
    return width;
  }
  
  public void setWidth(double width)
  {
    this.width = width;
  }
  
  public double getHeight()
  {
    return height;
  }
  
  public void setHeight(double height)
  {
    this.height = height;
  }
  
  public String toString()
  {
    return "Size2D[width=" + width + ", height=" + height + "]";
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!(obj instanceof Size2D)) {
      return false;
    }
    Size2D that = (Size2D)obj;
    if (width != width) {
      return false;
    }
    if (height != height) {
      return false;
    }
    return true;
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.Size2D
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import javax.swing.JTable;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;

public class SortableTable
  extends JTable
{
  private SortableTableHeaderListener headerListener;
  
  public SortableTable(SortableTableModel model)
  {
    super(model);
    
    SortButtonRenderer renderer = new SortButtonRenderer();
    TableColumnModel cm = getColumnModel();
    for (int i = 0; i < cm.getColumnCount(); i++) {
      cm.getColumn(i).setHeaderRenderer(renderer);
    }
    JTableHeader header = getTableHeader();
    headerListener = new SortableTableHeaderListener(model, renderer);
    header.addMouseListener(headerListener);
    header.addMouseMotionListener(headerListener);
    
    model.sortByColumn(0, true);
  }
  
  public void setSortableModel(SortableTableModel model)
  {
    super.setModel(model);
    headerListener.setTableModel(model);
    SortButtonRenderer renderer = new SortButtonRenderer();
    TableColumnModel cm = getColumnModel();
    for (int i = 0; i < cm.getColumnCount(); i++) {
      cm.getColumn(i).setHeaderRenderer(renderer);
    }
    model.sortByColumn(0, true);
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.SortableTable
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.JTable;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellEditor;

public class SortableTableHeaderListener
  implements MouseListener, MouseMotionListener
{
  private SortableTableModel model;
  private SortButtonRenderer renderer;
  private int sortColumnIndex;
  
  public SortableTableHeaderListener(SortableTableModel model, SortButtonRenderer renderer)
  {
    this.model = model;
    this.renderer = renderer;
  }
  
  public void setTableModel(SortableTableModel model)
  {
    this.model = model;
  }
  
  public void mousePressed(MouseEvent e)
  {
    JTableHeader header = (JTableHeader)e.getComponent();
    if ((header.getResizingColumn() == null) && 
      (header.getDraggedDistance() < 1))
    {
      int columnIndex = header.columnAtPoint(e.getPoint());
      int modelColumnIndex = header.getTable().convertColumnIndexToModel(columnIndex);
      if (model.isSortable(modelColumnIndex))
      {
        sortColumnIndex = header.getTable().convertColumnIndexToModel(columnIndex);
        renderer.setPressedColumn(sortColumnIndex);
        header.repaint();
        if (header.getTable().isEditing()) {
          header.getTable().getCellEditor().stopCellEditing();
        }
      }
      else
      {
        sortColumnIndex = -1;
      }
    }
  }
  
  public void mouseDragged(MouseEvent e)
  {
    JTableHeader header = (JTableHeader)e.getComponent();
    if ((header.getDraggedDistance() > 0) || (header.getResizingColumn() != null))
    {
      renderer.setPressedColumn(-1);
      sortColumnIndex = -1;
    }
  }
  
  public void mouseEntered(MouseEvent e) {}
  
  public void mouseClicked(MouseEvent e) {}
  
  public void mouseMoved(MouseEvent e) {}
  
  public void mouseExited(MouseEvent e) {}
  
  public void mouseReleased(MouseEvent e)
  {
    JTableHeader header = (JTableHeader)e.getComponent();
    if ((header.getResizingColumn() == null) && 
      (sortColumnIndex != -1))
    {
      SortableTableModel model = (SortableTableModel)header.getTable().getModel();
      boolean ascending = !model.isAscending();
      model.setAscending(ascending);
      model.sortByColumn(sortColumnIndex, ascending);
      
      renderer.setPressedColumn(-1);
      header.repaint();
    }
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.SortableTableHeaderListener
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import javax.swing.table.AbstractTableModel;

public abstract class SortableTableModel
  extends AbstractTableModel
{
  private int sortingColumn;
  private boolean ascending;
  
  public SortableTableModel()
  {
    sortingColumn = -1;
    ascending = true;
  }
  
  public int getSortingColumn()
  {
    return sortingColumn;
  }
  
  public boolean isAscending()
  {
    return ascending;
  }
  
  public void setAscending(boolean flag)
  {
    ascending = flag;
  }
  
  public void sortByColumn(int column, boolean ascending)
  {
    if (isSortable(column)) {
      sortingColumn = column;
    }
  }
  
  public boolean isSortable(int column)
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.SortableTableModel
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import java.awt.Component;
import java.awt.Insets;
import javax.swing.ButtonModel;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;

public class SortButtonRenderer
  implements TableCellRenderer
{
  public static final int NONE = 0;
  public static final int DOWN = 1;
  public static final int UP = 2;
  private int pressedColumn = -1;
  private JButton normalButton;
  private JButton ascendingButton;
  private JButton descendingButton;
  private boolean useLabels;
  private JLabel normalLabel;
  private JLabel ascendingLabel;
  private JLabel descendingLabel;
  
  public SortButtonRenderer()
  {
    pressedColumn = -1;
    useLabels = UIManager.getLookAndFeel().getID().equals("Aqua");
    
    Border border = UIManager.getBorder("TableHeader.cellBorder");
    if (useLabels)
    {
      normalLabel = new JLabel();
      normalLabel.setHorizontalAlignment(10);
      
      ascendingLabel = new JLabel();
      ascendingLabel.setHorizontalAlignment(10);
      ascendingLabel.setHorizontalTextPosition(2);
      ascendingLabel.setIcon(new BevelArrowIcon(1, false, false));
      
      descendingLabel = new JLabel();
      descendingLabel.setHorizontalAlignment(10);
      descendingLabel.setHorizontalTextPosition(2);
      descendingLabel.setIcon(new BevelArrowIcon(0, false, false));
      
      normalLabel.setBorder(border);
      ascendingLabel.setBorder(border);
      descendingLabel.setBorder(border);
    }
    else
    {
      normalButton = new JButton();
      normalButton.setMargin(new Insets(0, 0, 0, 0));
      normalButton.setHorizontalAlignment(10);
      
      ascendingButton = new JButton();
      ascendingButton.setMargin(new Insets(0, 0, 0, 0));
      ascendingButton.setHorizontalAlignment(10);
      ascendingButton.setHorizontalTextPosition(2);
      ascendingButton.setIcon(new BevelArrowIcon(1, false, false));
      ascendingButton.setPressedIcon(new BevelArrowIcon(1, false, true));
      
      descendingButton = new JButton();
      descendingButton.setMargin(new Insets(0, 0, 0, 0));
      descendingButton.setHorizontalAlignment(10);
      descendingButton.setHorizontalTextPosition(2);
      descendingButton.setIcon(new BevelArrowIcon(0, false, false));
      descendingButton.setPressedIcon(new BevelArrowIcon(0, false, true));
      
      normalButton.setBorder(border);
      ascendingButton.setBorder(border);
      descendingButton.setBorder(border);
    }
  }
  
  public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
  {
    if (table == null) {
      throw new NullPointerException("Table must not be null.");
    }
    SortableTableModel model = (SortableTableModel)table.getModel();
    int cc = table.convertColumnIndexToModel(column);
    boolean isSorting = model.getSortingColumn() == cc;
    boolean isAscending = model.isAscending();
    
    JTableHeader header = table.getTableHeader();
    boolean isPressed = cc == pressedColumn;
    JComponent component;
    JComponent component;
    if (useLabels)
    {
      JLabel label = getRendererLabel(isSorting, isAscending);
      label.setText(value == null ? "" : value.toString());
      component = label;
    }
    else
    {
      JButton button = getRendererButton(isSorting, isAscending);
      button.setText(value == null ? "" : value.toString());
      button.getModel().setPressed(isPressed);
      button.getModel().setArmed(isPressed);
      component = button;
    }
    if (header != null)
    {
      component.setForeground(header.getForeground());
      component.setBackground(header.getBackground());
      component.setFont(header.getFont());
    }
    return component;
  }
  
  private JButton getRendererButton(boolean isSorting, boolean isAscending)
  {
    if (isSorting)
    {
      if (isAscending) {
        return ascendingButton;
      }
      return descendingButton;
    }
    return normalButton;
  }
  
  private JLabel getRendererLabel(boolean isSorting, boolean isAscending)
  {
    if (isSorting)
    {
      if (isAscending) {
        return ascendingLabel;
      }
      return descendingLabel;
    }
    return normalLabel;
  }
  
  public void setPressedColumn(int column)
  {
    pressedColumn = column;
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.SortButtonRenderer
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class Spinner
  extends JPanel
  implements MouseListener
{
  private int value;
  private JTextField textField;
  private JPanel buttonPanel;
  private ArrowPanel upButton;
  private ArrowPanel downButton;
  
  public Spinner(int value)
  {
    super(new BorderLayout());
    this.value = value;
    textField = new JTextField(Integer.toString(this.value));
    textField.setHorizontalAlignment(4);
    add(textField);
    buttonPanel = new JPanel(new GridLayout(2, 1, 0, 1));
    upButton = new ArrowPanel(0);
    upButton.addMouseListener(this);
    downButton = new ArrowPanel(1);
    downButton.addMouseListener(this);
    buttonPanel.add(upButton);
    buttonPanel.add(downButton);
    add(buttonPanel, "East");
  }
  
  public int getValue()
  {
    return value;
  }
  
  public void mouseClicked(MouseEvent e)
  {
    if (e.getSource() == upButton)
    {
      value += 1;
      textField.setText(Integer.toString(value));
      firePropertyChange("value", value - 1, value);
    }
    else if (e.getSource() == downButton)
    {
      value -= 1;
      textField.setText(Integer.toString(value));
      firePropertyChange("value", value + 1, value);
    }
  }
  
  public void mouseEntered(MouseEvent e) {}
  
  public void mouseExited(MouseEvent e) {}
  
  public void mousePressed(MouseEvent e) {}
  
  public void mouseReleased(MouseEvent e) {}
}

/* Location:
 * Qualified Name:     org.jfree.ui.Spinner
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import java.awt.Dialog;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ResourceBundle;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;

public class StandardDialog
  extends JDialog
  implements ActionListener
{
  private boolean cancelled;
  protected static final ResourceBundle localizationResources = ResourceBundle.getBundle("org.jfree.ui.LocalizationBundle");
  
  public StandardDialog(Frame owner, String title, boolean modal)
  {
    super(owner, title, modal);
    cancelled = false;
  }
  
  public StandardDialog(Dialog owner, String title, boolean modal)
  {
    super(owner, title, modal);
    cancelled = false;
  }
  
  public boolean isCancelled()
  {
    return cancelled;
  }
  
  public void actionPerformed(ActionEvent event)
  {
    String command = event.getActionCommand();
    if (!command.equals("helpButton")) {
      if (command.equals("okButton"))
      {
        cancelled = false;
        setVisible(false);
      }
      else if (command.equals("cancelButton"))
      {
        cancelled = true;
        setVisible(false);
      }
    }
  }
  
  protected JPanel createButtonPanel()
  {
    L1R2ButtonPanel buttons = new L1R2ButtonPanel(localizationResources.getString("Help"), localizationResources.getString("OK"), localizationResources.getString("Cancel"));
    
    JButton helpButton = buttons.getLeftButton();
    helpButton.setActionCommand("helpButton");
    helpButton.addActionListener(this);
    
    JButton okButton = buttons.getRightButton1();
    okButton.setActionCommand("okButton");
    okButton.addActionListener(this);
    
    JButton cancelButton = buttons.getRightButton2();
    cancelButton.setActionCommand("cancelButton");
    cancelButton.addActionListener(this);
    
    buttons.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));
    return buttons;
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.StandardDialog
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import java.awt.GradientPaint;
import java.awt.Shape;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
import org.jfree.util.PublicCloneable;

public class StandardGradientPaintTransformer
  implements GradientPaintTransformer, Cloneable, PublicCloneable, Serializable
{
  private static final long serialVersionUID = -8155025776964678320L;
  private GradientPaintTransformType type;
  
  public StandardGradientPaintTransformer()
  {
    this(GradientPaintTransformType.VERTICAL);
  }
  
  public StandardGradientPaintTransformer(GradientPaintTransformType type)
  {
    if (type == null) {
      throw new IllegalArgumentException("Null 'type' argument.");
    }
    this.type = type;
  }
  
  public GradientPaintTransformType getType()
  {
    return type;
  }
  
  public GradientPaint transform(GradientPaint paint, Shape target)
  {
    GradientPaint result = paint;
    Rectangle2D bounds = target.getBounds2D();
    if (type.equals(GradientPaintTransformType.VERTICAL)) {
      result = new GradientPaint((float)bounds.getCenterX(), (float)bounds.getMinY(), paint.getColor1(), (float)bounds.getCenterX(), (float)bounds.getMaxY(), paint.getColor2());
    } else if (type.equals(GradientPaintTransformType.HORIZONTAL)) {
      result = new GradientPaint((float)bounds.getMinX(), (float)bounds.getCenterY(), paint.getColor1(), (float)bounds.getMaxX(), (float)bounds.getCenterY(), paint.getColor2());
    } else if (type.equals(GradientPaintTransformType.CENTER_HORIZONTAL)) {
      result = new GradientPaint((float)bounds.getCenterX(), (float)bounds.getCenterY(), paint.getColor2(), (float)bounds.getMaxX(), (float)bounds.getCenterY(), paint.getColor1(), true);
    } else if (type.equals(GradientPaintTransformType.CENTER_VERTICAL)) {
      result = new GradientPaint((float)bounds.getCenterX(), (float)bounds.getMinY(), paint.getColor1(), (float)bounds.getCenterX(), (float)bounds.getCenterY(), paint.getColor2(), true);
    }
    return result;
  }
  
  public boolean equals(Object obj)
  {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof StandardGradientPaintTransformer)) {
      return false;
    }
    StandardGradientPaintTransformer that = (StandardGradientPaintTransformer)obj;
    if (type != type) {
      return false;
    }
    return true;
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
  
  public int hashCode()
  {
    return type != null ? type.hashCode() : 0;
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.StandardGradientPaintTransformer
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComboBox;

class StrokeChooserPanel$1
  implements ActionListener
{
  private final StrokeChooserPanel this$0;
  
  StrokeChooserPanel$1(StrokeChooserPanel this$0)
  {
    this.this$0 = this$0;
  }
  
  public void actionPerformed(ActionEvent evt)
  {
    this$0.getSelector().transferFocus();
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.StrokeChooserPanel.1
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Stroke;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComboBox;
import javax.swing.JPanel;

public class StrokeChooserPanel
  extends JPanel
{
  private JComboBox selector;
  
  public StrokeChooserPanel(StrokeSample current, StrokeSample[] available)
  {
    setLayout(new BorderLayout());
    selector = new JComboBox(available);
    selector.setSelectedItem(current);
    selector.setRenderer(new StrokeSample(new BasicStroke(1.0F)));
    add(selector);
    
    selector.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent evt)
      {
        getSelector().transferFocus();
      }
    });
  }
  
  protected final JComboBox getSelector()
  {
    return selector;
  }
  
  public Stroke getSelectedStroke()
  {
    StrokeSample sample = (StrokeSample)selector.getSelectedItem();
    return sample.getStroke();
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.StrokeChooserPanel
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui;

import java.awt.BasicStroke;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.RenderingHints;
import java.awt.Stroke;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Ellipse2D.Double;
import java.awt.geom.Line2D;
import java.awt.geom.Line2D.Double;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

public class StrokeSample
  extends JComponent
  implements ListCellRenderer
{
  private Stroke stroke;
  private Dimension preferredSize;
  
  public StrokeSample(Stroke stroke)
  {
    this.stroke = stroke;
    preferredSize = new Dimension(80, 18);
  }
  
  public Stroke getStroke()
  {
    return stroke;
  }
  
  public void setStroke(Stroke stroke)
  {
    this.stroke = stroke;
    repaint();
  }
  
  public Dimension getPreferredSize()
  {
    return preferredSize;
  }
  
  public void paintComponent(Graphics g)
  {
    Graphics2D g2 = (Graphics2D)g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    Dimension size = getSize();
    Insets insets = getInsets();
    double xx = left;
    double yy = top;
    double ww = size.getWidth() - left - right;
    double hh = size.getHeight() - top - bottom;
    
    Point2D one = new Point2D.Double(xx + 6.0D, yy + hh / 2.0D);
    
    Point2D two = new Point2D.Double(xx + ww - 6.0D, yy + hh / 2.0D);
    
    Ellipse2D circle1 = new Ellipse2D.Double(one.getX() - 5.0D, one.getY() - 5.0D, 10.0D, 10.0D);
    Ellipse2D circle2 = new Ellipse2D.Double(two.getX() - 6.0D, two.getY() - 5.0D, 10.0D, 10.0D);
    
    g2.draw(circle1);
    g2.fill(circle1);
    g2.draw(circle2);
    g2.fill(circle2);
    
    Line2D line = new Line2D.Double(one, two);
    if (stroke != null) {
      g2.setStroke(stroke);
    } else {
      g2.setStroke(new BasicStroke(0.0F));
    }
    g2.draw(line);
  }
  
  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
  {
    if ((value instanceof StrokeSample))
    {
      StrokeSample in = (StrokeSample)value;
      setStroke(in.getStroke());
    }
    return this;
  }
}

/* Location:
 * Qualified Name:     org.jfree.ui.StrokeSample
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.ui.tabbedui;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;

public class AbstractTabbedUI$ExitAction
  extends AbstractAction
{
  private final AbstractTabbedUI this$0;
  
  public AbstractTabbedUI$ExitAction(AbstractTabbedUI this$0)
  {
    this.this$0 = this$0;
    putValue("Name", "Exit");
  }
  
  public void actionPerformed(ActionEvent e)
  {
    this$0.attempExit();
  }
}

/* Locat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

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