jcommon-1.0.12

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

import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

class AbstractTabbedUI$TabChangeHandler
  implements ChangeListener
{
  private final JTabbedPane pane;
  private final AbstractTabbedUI this$0;
  
  public AbstractTabbedUI$TabChangeHandler(AbstractTabbedUI this$0, JTabbedPane pane)
  {
    this.this$0 = this$0;
    this.pane = pane;
  }
  
  public void stateChanged(ChangeEvent e)
  {
    this$0.setSelectedEditor(pane.getSelectedIndex());
  }
}

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

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import org.jfree.util.Log;

class AbstractTabbedUI$TabEnableChangeListener
  implements PropertyChangeListener
{
  private final AbstractTabbedUI this$0;
  
  public AbstractTabbedUI$TabEnableChangeListener(AbstractTabbedUI this$0)
  {
    this.this$0 = this$0;
  }
  
  public void propertyChange(PropertyChangeEvent evt)
  {
    if (!evt.getPropertyName().equals("enabled"))
    {
      Log.debug("PropertyName");
      return;
    }
    if (!(evt.getSource() instanceof RootEditor))
    {
      Log.debug("Source");
      return;
    }
    RootEditor editor = (RootEditor)evt.getSource();
    this$0.updateRootEditorEnabled(editor);
  }
}

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

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.jfree.util.Log;

public abstract class AbstractTabbedUI
  extends JComponent
{
  public static final String JMENUBAR_PROPERTY = "jMenuBar";
  public static final String GLOBAL_MENU_PROPERTY = "globalMenu";
  private ArrayList rootEditors;
  private JTabbedPane tabbedPane;
  private int selectedRootEditor;
  private JComponent currentToolbar;
  private JPanel toolbarContainer;
  private Action closeAction;
  private JMenuBar jMenuBar;
  private boolean globalMenu;
  
  protected class ExitAction
    extends AbstractAction
  {
    public ExitAction()
    {
      putValue("Name", "Exit");
    }
    
    public void actionPerformed(ActionEvent e)
    {
      attempExit();
    }
  }
  
  private class TabChangeHandler
    implements ChangeListener
  {
    private final JTabbedPane pane;
    
    public TabChangeHandler(JTabbedPane pane)
    {
      this.pane = pane;
    }
    
    public void stateChanged(ChangeEvent e)
    {
      setSelectedEditor(pane.getSelectedIndex());
    }
  }
  
  private class TabEnableChangeListener
    implements PropertyChangeListener
  {
    public TabEnableChangeListener() {}
    
    public void propertyChange(PropertyChangeEvent evt)
    {
      if (!evt.getPropertyName().equals("enabled"))
      {
        Log.debug("PropertyName");
        return;
      }
      if (!(evt.getSource() instanceof RootEditor))
      {
        Log.debug("Source");
        return;
      }
      RootEditor editor = (RootEditor)evt.getSource();
      updateRootEditorEnabled(editor);
    }
  }
  
  public AbstractTabbedUI()
  {
    selectedRootEditor = -1;
    
    toolbarContainer = new JPanel();
    toolbarContainer.setLayout(new BorderLayout());
    
    tabbedPane = new JTabbedPane(3);
    tabbedPane.addChangeListener(new TabChangeHandler(tabbedPane));
    
    rootEditors = new ArrayList();
    
    setLayout(new BorderLayout());
    add(toolbarContainer, "North");
    add(tabbedPane, "Center");
    
    closeAction = createCloseAction();
  }
  
  protected JTabbedPane getTabbedPane()
  {
    return tabbedPane;
  }
  
  public boolean isGlobalMenu()
  {
    return globalMenu;
  }
  
  public void setGlobalMenu(boolean globalMenu)
  {
    this.globalMenu = globalMenu;
    if (isGlobalMenu()) {
      setJMenuBar(updateGlobalMenubar());
    } else if (getRootEditorCount() > 0) {
      setJMenuBar(createEditorMenubar(getRootEditor(getSelectedEditor())));
    }
  }
  
  public JMenuBar getJMenuBar()
  {
    return jMenuBar;
  }
  
  protected void setJMenuBar(JMenuBar menuBar)
  {
    JMenuBar oldMenuBar = jMenuBar;
    jMenuBar = menuBar;
    firePropertyChange("jMenuBar", oldMenuBar, menuBar);
  }
  
  protected Action createCloseAction()
  {
    return new ExitAction();
  }
  
  public Action getCloseAction()
  {
    return closeAction;
  }
  
  protected abstract JMenu[] getPrefixMenus();
  
  protected abstract JMenu[] getPostfixMenus();
  
  private void addMenus(JMenuBar menuBar, JMenu[] customMenus)
  {
    for (int i = 0; i < customMenus.length; i++) {
      menuBar.add(customMenus[i]);
    }
  }
  
  private JMenuBar updateGlobalMenubar()
  {
    JMenuBar menuBar = getJMenuBar();
    if (menuBar == null) {
      menuBar = new JMenuBar();
    } else {
      menuBar.removeAll();
    }
    addMenus(menuBar, getPrefixMenus());
    for (int i = 0; i < rootEditors.size(); i++)
    {
      RootEditor editor = (RootEditor)rootEditors.get(i);
      addMenus(menuBar, editor.getMenus());
    }
    addMenus(menuBar, getPostfixMenus());
    return menuBar;
  }
  
  private JMenuBar createEditorMenubar(RootEditor root)
  {
    JMenuBar menuBar = getJMenuBar();
    if (menuBar == null) {
      menuBar = new JMenuBar();
    } else {
      menuBar.removeAll();
    }
    addMenus(menuBar, getPrefixMenus());
    if (isGlobalMenu()) {
      for (int i = 0; i < rootEditors.size(); i++)
      {
        RootEditor editor = (RootEditor)rootEditors.get(i);
        addMenus(menuBar, editor.getMenus());
      }
    } else {
      addMenus(menuBar, root.getMenus());
    }
    addMenus(menuBar, getPostfixMenus());
    return menuBar;
  }
  
  public void addRootEditor(RootEditor rootPanel)
  {
    rootEditors.add(rootPanel);
    tabbedPane.add(rootPanel.getEditorName(), rootPanel.getMainPanel());
    rootPanel.addPropertyChangeListener("enabled", new TabEnableChangeListener());
    updateRootEditorEnabled(rootPanel);
    if (getRootEditorCount() == 1) {
      setSelectedEditor(0);
    } else if (isGlobalMenu()) {
      setJMenuBar(updateGlobalMenubar());
    }
  }
  
  public int getRootEditorCount()
  {
    return rootEditors.size();
  }
  
  public RootEditor getRootEditor(int pos)
  {
    return (RootEditor)rootEditors.get(pos);
  }
  
  public int getSelectedEditor()
  {
    return selectedRootEditor;
  }
  
  public void setSelectedEditor(int selectedEditor)
  {
    int oldEditor = selectedRootEditor;
    if (oldEditor == selectedEditor) {
      return;
    }
    selectedRootEditor = selectedEditor;
    for (int i = 0; i < rootEditors.size(); i++)
    {
      boolean shouldBeActive = i == selectedEditor;
      RootEditor container = (RootEditor)rootEditors.get(i);
      if ((container.isActive()) && (!shouldBeActive)) {
        container.setActive(false);
      }
    }
    if (currentToolbar != null)
    {
      closeToolbar();
      toolbarContainer.removeAll();
      currentToolbar = null;
    }
    for (int i = 0; i < rootEditors.size(); i++)
    {
      boolean shouldBeActive = i == selectedEditor;
      RootEditor container = (RootEditor)rootEditors.get(i);
      if ((!container.isActive()) && (shouldBeActive == true))
      {
        container.setActive(true);
        setJMenuBar(createEditorMenubar(container));
        currentToolbar = container.getToolbar();
        if (currentToolbar != null)
        {
          toolbarContainer.add(currentToolbar, "Center");
          
          toolbarContainer.setVisible(true);
          currentToolbar.setVisible(true);
        }
        else
        {
          toolbarContainer.setVisible(false);
        }
        getJMenuBar().repaint();
      }
    }
  }
  
  private void closeToolbar()
  {
    if (currentToolbar != null)
    {
      if (currentToolbar.getParent() != toolbarContainer)
      {
        Window w = SwingUtilities.windowForComponent(currentToolbar);
        if (w != null)
        {
          w.setVisible(false);
          w.dispose();
        }
      }
      currentToolbar.setVisible(false);
    }
  }
  
  protected abstract void attempExit();
  
  protected void updateRootEditorEnabled(RootEditor editor)
  {
    boolean enabled = editor.isEnabled();
    for (int i = 0; i < tabbedPane.getTabCount(); i++)
    {
      Component tab = tabbedPane.getComponentAt(i);
      if (tab == editor.getMainPanel())
      {
        tabbedPane.setEnabledAt(i, enabled);
        return;
      }
    }
  }
}

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

import javax.swing.JComponent;

public abstract class DetailEditor
  extends JComponent
{
  private Object object;
  private boolean confirmed;
  
  public void update()
  {
    if (object == null) {
      throw new IllegalStateException();
    }
    updateObject(object);
    
    setConfirmed(false);
  }
  
  public Object getObject()
  {
    return object;
  }
  
  public void setObject(Object object)
  {
    if (object == null) {
      throw new NullPointerException();
    }
    this.object = object;
    setConfirmed(false);
    fillObject();
  }
  
  protected static int parseInt(String text, int def)
  {
    try
    {
      return Integer.parseInt(text);
    }
    catch (NumberFormatException fe) {}
    return def;
  }
  
  public abstract void clear();
  
  protected abstract void fillObject();
  
  protected abstract void updateObject(Object paramObject);
  
  public boolean isConfirmed()
  {
    return confirmed;
  }
  
  protected void setConfirmed(boolean confirmed)
  {
    boolean oldConfirmed = this.confirmed;
    this.confirmed = confirmed;
    firePropertyChange("confirmed", oldConfirmed, confirmed);
  }
}

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

import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JMenu;

public abstract interface RootEditor
{
  public abstract void setActive(boolean paramBoolean);
  
  public abstract boolean isActive();
  
  public abstract String getEditorName();
  
  public abstract JMenu[] getMenus();
  
  public abstract JComponent getToolbar();
  
  public abstract JComponent getMainPanel();
  
  public abstract boolean isEnabled();
  
  public abstract void addPropertyChangeListener(String paramString, PropertyChangeListener paramPropertyChangeListener);
  
  public abstract void removePropertyChangeListener(String paramString, PropertyChangeListener paramPropertyChangeListener);
  
  public abstract void addPropertyChangeListener(PropertyChangeListener paramPropertyChangeListener);
  
  public abstract void removePropertyChangeListener(PropertyChangeListener paramPropertyChangeListener);
}

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

import javax.swing.JComponent;

public abstract class RootPanel
  extends JComponent
  implements RootEditor
{
  private boolean active;
  
  public final boolean isActive()
  {
    return active;
  }
  
  protected void panelActivated() {}
  
  protected void panelDeactivated() {}
  
  public final void setActive(boolean active)
  {
    if (this.active == active) {
      return;
    }
    this.active = active;
    if (active) {
      panelActivated();
    } else {
      panelDeactivated();
    }
  }
  
  public JComponent getMainPanel()
  {
    return this;
  }
  
  public JComponent getToolbar()
  {
    return null;
  }
}

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

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

class TabbedApplet$MenuBarChangeListener
  implements PropertyChangeListener
{
  private final TabbedApplet this$0;
  
  public TabbedApplet$MenuBarChangeListener(TabbedApplet this$0)
  {
    this.this$0 = this$0;
  }
  
  public void propertyChange(PropertyChangeEvent evt)
  {
    if (evt.getPropertyName().equals("jMenuBar")) {
      this$0.setJMenuBar(this$0.getTabbedUI().getJMenuBar());
    }
  }
}

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

import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JApplet;
import javax.swing.JPanel;

public class TabbedApplet
  extends JApplet
{
  private AbstractTabbedUI tabbedUI;
  
  private class MenuBarChangeListener
    implements PropertyChangeListener
  {
    public MenuBarChangeListener() {}
    
    public void propertyChange(PropertyChangeEvent evt)
    {
      if (evt.getPropertyName().equals("jMenuBar")) {
        setJMenuBar(getTabbedUI().getJMenuBar());
      }
    }
  }
  
  protected final AbstractTabbedUI getTabbedUI()
  {
    return tabbedUI;
  }
  
  public void init(AbstractTabbedUI tabbedUI)
  {
    this.tabbedUI = tabbedUI;
    this.tabbedUI.addPropertyChangeListener("jMenuBar", new MenuBarChangeListener());
    
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(tabbedUI, "Center");
    setContentPane(panel);
    setJMenuBar(tabbedUI.getJMenuBar());
  }
}

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

import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.Action;

class TabbedDialog$1
  extends WindowAdapter
{
  private final TabbedDialog this$0;
  
  TabbedDialog$1(TabbedDialog this$0)
  {
    this.this$0 = this$0;
  }
  
  public void windowClosing(WindowEvent e)
  {
    this$0.getTabbedUI().getCloseAction().actionPerformed(new ActionEvent(this, 1001, null, 0));
  }
}

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

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

class TabbedDialog$MenuBarChangeListener
  implements PropertyChangeListener
{
  private final TabbedDialog this$0;
  
  public TabbedDialog$MenuBarChangeListener(TabbedDialog this$0)
  {
    this.this$0 = this$0;
  }
  
  public void propertyChange(PropertyChangeEvent evt)
  {
    if (evt.getPropertyName().equals("jMenuBar")) {
      this$0.setJMenuBar(this$0.getTabbedUI().getJMenuBar());
    }
  }
}

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

import java.awt.BorderLayout;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.Action;
import javax.swing.JDialog;
import javax.swing.JPanel;

public class TabbedDialog
  extends JDialog
{
  private AbstractTabbedUI tabbedUI;
  public TabbedDialog() {}
  
  private class MenuBarChangeListener
    implements PropertyChangeListener
  {
    public MenuBarChangeListener() {}
    
    public void propertyChange(PropertyChangeEvent evt)
    {
      if (evt.getPropertyName().equals("jMenuBar")) {
        setJMenuBar(getTabbedUI().getJMenuBar());
      }
    }
  }
  
  public TabbedDialog(Dialog owner)
  {
    super(owner);
  }
  
  public TabbedDialog(Dialog owner, boolean modal)
  {
    super(owner, modal);
  }
  
  public TabbedDialog(Dialog owner, String title)
  {
    super(owner, title);
  }
  
  public TabbedDialog(Dialog owner, String title, boolean modal)
  {
    super(owner, title, modal);
  }
  
  public TabbedDialog(Frame owner)
  {
    super(owner);
  }
  
  public TabbedDialog(Frame owner, boolean modal)
  {
    super(owner, modal);
  }
  
  public TabbedDialog(Frame owner, String title)
  {
    super(owner, title);
  }
  
  public TabbedDialog(Frame owner, String title, boolean modal)
  {
    super(owner, title, modal);
  }
  
  protected final AbstractTabbedUI getTabbedUI()
  {
    return tabbedUI;
  }
  
  public void init(AbstractTabbedUI tabbedUI)
  {
    this.tabbedUI = tabbedUI;
    this.tabbedUI.addPropertyChangeListener("jMenuBar", new MenuBarChangeListener());
    
    addWindowListener(new WindowAdapter()
    {
      public void windowClosing(WindowEvent e)
      {
        getTabbedUI().getCloseAction().actionPerformed(new ActionEvent(this, 1001, null, 0));
      }
    });
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(tabbedUI, "Center");
    setContentPane(panel);
    setJMenuBar(tabbedUI.getJMenuBar());
  }
}

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

import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.Action;

class TabbedFrame$1
  extends WindowAdapter
{
  private final TabbedFrame this$0;
  
  TabbedFrame$1(TabbedFrame this$0)
  {
    this.this$0 = this$0;
  }
  
  public void windowClosing(WindowEvent e)
  {
    this$0.getTabbedUI().getCloseAction().actionPerformed(new ActionEvent(this, 1001, null, 0));
  }
}

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

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

class TabbedFrame$MenuBarChangeListener
  implements PropertyChangeListener
{
  private final TabbedFrame this$0;
  
  public TabbedFrame$MenuBarChangeListener(TabbedFrame this$0)
  {
    this.this$0 = this$0;
  }
  
  public void propertyChange(PropertyChangeEvent evt)
  {
    if (evt.getPropertyName().equals("jMenuBar")) {
      this$0.setJMenuBar(this$0.getTabbedUI().getJMenuBar());
    }
  }
}

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

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.Action;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class TabbedFrame
  extends JFrame
{
  private AbstractTabbedUI tabbedUI;
  public TabbedFrame() {}
  
  private class MenuBarChangeListener
    implements PropertyChangeListener
  {
    public MenuBarChangeListener() {}
    
    public void propertyChange(PropertyChangeEvent evt)
    {
      if (evt.getPropertyName().equals("jMenuBar")) {
        setJMenuBar(getTabbedUI().getJMenuBar());
      }
    }
  }
  
  public TabbedFrame(String title)
  {
    super(title);
  }
  
  protected final AbstractTabbedUI getTabbedUI()
  {
    return tabbedUI;
  }
  
  public void init(AbstractTabbedUI tabbedUI)
  {
    this.tabbedUI = tabbedUI;
    this.tabbedUI.addPropertyChangeListener("jMenuBar", new MenuBarChangeListener());
    
    addWindowListener(new WindowAdapter()
    {
      public void windowClosing(WindowEvent e)
      {
        getTabbedUI().getCloseAction().actionPerformed(new ActionEvent(this, 1001, null, 0));
      }
    });
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(tabbedUI, "Center");
    setContentPane(panel);
    setJMenuBar(tabbedUI.getJMenuBar());
  }
}

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

import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Rectangle;

public class VerticalLayout
  implements LayoutManager
{
  private final boolean useSizeFromParent;
  
  public VerticalLayout()
  {
    this(true);
  }
  
  public VerticalLayout(boolean useParent)
  {
    useSizeFromParent = useParent;
  }
  
  public void addLayoutComponent(String name, Component comp) {}
  
  public void removeLayoutComponent(Component comp) {}
  
  public Dimension preferredLayoutSize(Container parent)
  {
    synchronized (parent.getTreeLock())
    {
      Insets ins = parent.getInsets();
      Component[] comps = parent.getComponents();
      int height = top + bottom;
      int width = left + right;
      for (int i = 0; i < comps.length; i++) {
        if (comps[i].isVisible())
        {
          Dimension pref = comps[i].getPreferredSize();
          height += height;
          if (width > width) {
            width = width;
          }
        }
      }
      return new Dimension(width + left + right, height + top + bottom);
    }
  }
  
  public Dimension minimumLayoutSize(Container parent)
  {
    synchronized (parent.getTreeLock())
    {
      Insets ins = parent.getInsets();
      Component[] comps = parent.getComponents();
      int height = top + bottom;
      int width = left + right;
      for (int i = 0; i < comps.length; i++) {
        if (comps[i].isVisible())
        {
          Dimension min = comps[i].getMinimumSize();
          height += height;
          if (width > width) {
            width = width;
          }
        }
      }
      return new Dimension(width + left + right, height + top + bottom);
    }
  }
  
  public boolean isUseSizeFromParent()
  {
    return useSizeFromParent;
  }
  
  public void layoutContainer(Container parent)
  {
    synchronized (parent.getTreeLock())
    {
      Insets ins = parent.getInsets();
      int insHorizontal = left + right;
      int width;
      int width;
      if (isUseSizeFromParent())
      {
        Rectangle bounds = parent.getBounds();
        width = width - insHorizontal;
      }
      else
      {
        width = preferredLayoutSizewidth - insHorizontal;
      }
      Component[] comps = parent.getComponents();
      
      int y = top;
      for (int i = 0; i < comps.length; i++)
      {
        Component c = comps[i];
        if (c.isVisible())
        {
          Dimension dim = c.getPreferredSize();
          c.setBounds(left, y, width, height);
          y += height;
        }
      }
    }
  }
}

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

import java.io.ObjectStreamException;
import java.io.Serializable;

public final class TextAnchor
  implements Serializable
{
  private static final long serialVersionUID = 8219158940496719660L;
  public static final TextAnchor TOP_LEFT = new TextAnchor("TextAnchor.TOP_LEFT");
  public static final TextAnchor TOP_CENTER = new TextAnchor("TextAnchor.TOP_CENTER");
  public static final TextAnchor TOP_RIGHT = new TextAnchor("TextAnchor.TOP_RIGHT");
  public static final TextAnchor HALF_ASCENT_LEFT = new TextAnchor("TextAnchor.HALF_ASCENT_LEFT");
  public static final TextAnchor HALF_ASCENT_CENTER = new TextAnchor("TextAnchor.HALF_ASCENT_CENTER");
  public static final TextAnchor HALF_ASCENT_RIGHT = new TextAnchor("TextAnchor.HALF_ASCENT_RIGHT");
  public static final TextAnchor CENTER_LEFT = new TextAnchor("TextAnchor.CENTER_LEFT");
  public static final TextAnchor CENTER = new TextAnchor("TextAnchor.CENTER");
  public static final TextAnchor CENTER_RIGHT = new TextAnchor("TextAnchor.CENTER_RIGHT");
  public static final TextAnchor BASELINE_LEFT = new TextAnchor("TextAnchor.BASELINE_LEFT");
  public static final TextAnchor BASELINE_CENTER = new TextAnchor("TextAnchor.BASELINE_CENTER");
  public static final TextAnchor BASELINE_RIGHT = new TextAnchor("TextAnchor.BASELINE_RIGHT");
  public static final TextAnchor BOTTOM_LEFT = new TextAnchor("TextAnchor.BOTTOM_LEFT");
  public static final TextAnchor BOTTOM_CENTER = new TextAnchor("TextAnchor.BOTTOM_CENTER");
  public static final TextAnchor BOTTOM_RIGHT = new TextAnchor("TextAnchor.BOTTOM_RIGHT");
  private String name;
  
  private TextAnchor(String name)
  {
    this.name = name;
  }
  
  public String toString()
  {
    return name;
  }
  
  public boolean equals(Object o)
  {
    if (this == o) {
      return true;
    }
    if (!(o instanceof TextAnchor)) {
      return false;
    }
    TextAnchor order = (TextAnchor)o;
    if (!name.equals(name)) {
      return false;
    }
    return true;
  }
  
  public int hashCode()
  {
    return name.hashCode();
  }
  
  private Object readResolve()
    throws ObjectStreamException
  {
    TextAnchor result = null;
    if (equals(TOP_LEFT)) {
      result = TOP_LEFT;
    } else if (equals(TOP_CENTER)) {
      result = TOP_CENTER;
    } else if (equals(TOP_RIGHT)) {
      result = TOP_RIGHT;
    } else if (equals(BOTTOM_LEFT)) {
      result = BOTTOM_LEFT;
    } else if (equals(BOTTOM_CENTER)) {
      result = BOTTOM_CENTER;
    } else if (equals(BOTTOM_RIGHT)) {
      result = BOTTOM_RIGHT;
    } else if (equals(BASELINE_LEFT)) {
      result = BASELINE_LEFT;
    } else if (equals(BASELINE_CENTER)) {
      result = BASELINE_CENTER;
    } else if (equals(BASELINE_RIGHT)) {
      result = BASELINE_RIGHT;
    } else if (equals(CENTER_LEFT)) {
      result = CENTER_LEFT;
    } else if (equals(CENTER)) {
      result = CENTER;
    } else if (equals(CENTER_RIGHT)) {
      result = CENTER_RIGHT;
    } else if (equals(HALF_ASCENT_LEFT)) {
      result = HALF_ASCENT_LEFT;
    } else if (equals(HALF_ASCENT_CENTER)) {
      result = HALF_ASCENT_CENTER;
    } else if (equals(HALF_ASCENT_RIGHT)) {
      result = HALF_ASCENT_RIGHT;
    }
    return result;
  }
}

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

import java.awt.Color;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.border.MatteBorder;
import javax.swing.plaf.BorderUIResource.CompoundBorderUIResource;
import javax.swing.plaf.BorderUIResource.EmptyBorderUIResource;
import javax.swing.plaf.BorderUIResource.EtchedBorderUIResource;

public class UIUtilities
{
  public static void setupUI()
  {
    try
    {
      String classname = UIManager.getSystemLookAndFeelClassName();
      UIManager.setLookAndFeel(classname);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
    UIDefaults defaults = UIManager.getDefaults();
    
    defaults.put("PopupMenu.border", new BorderUIResource.EtchedBorderUIResource(0, defaults.getColor("controlShadow"), defaults.getColor("controlLtHighlight")));
    
    MatteBorder matteborder = new MatteBorder(1, 1, 1, 1, Color.black);
    EmptyBorder emptyborder = new MatteBorder(2, 2, 2, 2, defaults.getColor("control"));
    BorderUIResource.CompoundBorderUIResource compBorder = new BorderUIResource.CompoundBorderUIResource(emptyborder, matteborder);
    
    BorderUIResource.EmptyBorderUIResource emptyBorderUI = new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0);
    
    defaults.put("SplitPane.border", emptyBorderUI);
    defaults.put("Table.scrollPaneBorder", emptyBorderUI);
    defaults.put("ComboBox.border", compBorder);
    defaults.put("TextField.border", compBorder);
    defaults.put("TextArea.border", compBorder);
    defaults.put("CheckBox.border", compBorder);
    defaults.put("ScrollPane.border", emptyBorderUI);
  }
}

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

import java.io.ObjectStreamException;
import java.io.Serializable;

public final class VerticalAlignment
  implements Serializable
{
  private static final long serialVersionUID = 7272397034325429853L;
  public static final VerticalAlignment TOP = new VerticalAlignment("VerticalAlignment.TOP");
  public static final VerticalAlignment BOTTOM = new VerticalAlignment("VerticalAlignment.BOTTOM");
  public static final VerticalAlignment CENTER = new VerticalAlignment("VerticalAlignment.CENTER");
  private String name;
  
  private VerticalAlignment(String name)
  {
    this.name = name;
  }
  
  public String toString()
  {
    return name;
  }
  
  public boolean equals(Object o)
  {
    if (this == o) {
      return true;
    }
    if (!(o instanceof VerticalAlignment)) {
      return false;
    }
    VerticalAlignment alignment = (VerticalAlignment)o;
    if (!name.equals(name)) {
      return false;
    }
    return true;
  }
  
  public int hashCode()
  {
    return name.hashCode();
  }
  
  private Object readResolve()
    throws ObjectStreamException
  {
    if (equals(TOP)) {
      return TOP;
    }
    if (equals(BOTTOM)) {
      return BOTTOM;
    }
    if (equals(CENTER)) {
      return CENTER;
    }
    return null;
  }
}

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

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class WizardDialog
  extends JDialog
  implements ActionListener
{
  private Object result;
  private int step;
  private WizardPanel currentPanel;
  private List panels;
  private JButton previousButton;
  private JButton nextButton;
  private JButton finishButton;
  private JButton helpButton;
  
  public WizardDialog(JDialog owner, boolean modal, String title, WizardPanel firstPanel)
  {
    super(owner, title + " : step 1", modal);
    result = null;
    currentPanel = firstPanel;
    step = 0;
    panels = new ArrayList();
    panels.add(firstPanel);
    setContentPane(createContent());
  }
  
  public WizardDialog(JFrame owner, boolean modal, String title, WizardPanel firstPanel)
  {
    super(owner, title + " : step 1", modal);
    result = null;
    currentPanel = firstPanel;
    step = 0;
    panels = new ArrayList();
    panels.add(firstPanel);
    setContentPane(createContent());
  }
  
  public Object getResult()
  {
    return result;
  }
  
  public int getStepCount()
  {
    return 0;
  }
  
  public boolean canDoPreviousPanel()
  {
    return step > 0;
  }
  
  public boolean canDoNextPanel()
  {
    return currentPanel.hasNextPanel();
  }
  
  public boolean canFinish()
  {
    return currentPanel.canFinish();
  }
  
  public WizardPanel getWizardPanel(int step)
  {
    if (step < panels.size()) {
      return (WizardPanel)panels.get(step);
    }
    return null;
  }
  
  public void actionPerformed(ActionEvent event)
  {
    String command = event.getActionCommand();
    if (command.equals("nextButton")) {
      next();
    } else if (command.equals("previousButton")) {
      previous();
    } else if (command.equals("finishButton")) {
      finish();
    }
  }
  
  public void previous()
  {
    if (step > 0)
    {
      WizardPanel previousPanel = getWizardPanel(step - 1);
      
      previousPanel.returnFromLaterStep();
      Container content = getContentPane();
      content.remove(currentPanel);
      content.add(previousPanel);
      step -= 1;
      currentPanel = previousPanel;
      setTitle("Step " + (step + 1));
      enableButtons();
      pack();
    }
  }
  
  public void next()
  {
    WizardPanel nextPanel = getWizardPanel(step + 1);
    if (nextPanel != null)
    {
      if (!currentPanel.canRedisplayNextPanel()) {
        nextPanel = currentPanel.getNextPanel();
      }
    }
    else {
      nextPanel = currentPanel.getNextPanel();
    }
    step += 1;
    if (step < panels.size()) {
      panels.set(step, nextPanel);
    } else {
      panels.add(nextPanel);
    }
    Container content = getContentPane();
    content.remove(currentPanel);
    content.add(nextPanel);
    
    currentPanel = nextPanel;
    setTitle("Step " + (step + 1));
    enableButtons();
    pack();
  }
  
  public void finish()
  {
    result = currentPanel.getResult();
    setVisible(false);
  }
  
  private void enableButtons()
  {
    previousButton.setEnabled(step > 0);
    nextButton.setEnabled(canDoNextPanel());
    finishButton.setEnabled(canFinish());
    helpButton.setEnabled(false);
  }
  
  public boolean isCancelled()
  {
    return false;
  }
  
  public JPanel createContent()
  {
    JPanel content = new JPanel(new BorderLayout());
    content.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    content.add((JPanel)panels.get(0));
    L1R3ButtonPanel buttons = new L1R3ButtonPanel("Help", "Previous", "Next", "Finish");
    
    helpButton = buttons.getLeftButton();
    helpButton.setEnabled(false);
    
    previousButton = buttons.getRightButton1();
    previousButton.setActionCommand("previousButton");
    previousButton.addActionListener(this);
    previousButton.setEnabled(false);
    
    nextButton = buttons.getRightButton2();
    nextButton.setActionCommand("nextButton");
    nextButton.addActionListener(this);
    nextButton.setEnabled(true);
    
    finishButton = buttons.getRightButton3();
    finishButton.setActionCommand("finishButton");
    finishButton.addActionListener(this);
    finishButton.setEnabled(false);
    
    buttons.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));
    content.add(buttons, "South");
    
    return content;
  }
}

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

import java.awt.LayoutManager;
import javax.swing.JPanel;

public abstract class WizardPanel
  extends JPanel
{
  private WizardDialog owner;
  
  protected WizardPanel(LayoutManager layout)
  {
    super(layout);
  }
  
  public WizardDialog getOwner()
  {
    return owner;
  }
  
  public void setOwner(WizardDialog owner)
  {
    this.owner = owner;
  }
  
  public Object getResult()
  {
    return null;
  }
  
  public abstract void returnFromLaterStep();
  
  public abstract boolean canRedisplayNextPanel();
  
  public abstract boolean hasNextPanel();
  
  public abstract boolean canFinish();
  
  public abstract WizardPanel getNextPanel();
}

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

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Arrays;

public class AbstractObjectList
  implements Cloneable, Serializable
{
  private static final long serialVersionUID = 7789833772597351595L;
  public static final int DEFAULT_INITIAL_CAPACITY = 8;
  private transient Object[] objects;
  private int size = 0;
  private int increment = 8;
  
  protected AbstractObjectList()
  {
    this(8);
  }
  
  protected AbstractObjectList(int initialCapacity)
  {
    this(initialCapacity, initialCapacity);
  }
  
  protected AbstractObjectList(int initialCapacity, int increment)
  {
    objects = new Object[initialCapacity];
    this.increment = increment;
  }
  
  protected Object get(int index)
  {
    Object result = null;
    if ((index >= 0) && (index < size)) {
      result = objects[index];
    }
    return result;
  }
  
  protected void set(int index, Object object)
  {
    if (index < 0) {
      throw new IllegalArgumentException("Requires index >= 0.");
    }
    if (index >= objects.length)
    {
      Object[] enlarged = new Object[index + increment];
      System.arraycopy(objects, 0, enlarged, 0, objects.length);
      objects = enlarged;
    }
    objects[index] = object;
    size = Math.max(size, index + 1);
  }
  
  public void clear()
  {
    Arrays.fill(objects, null);
    size = 0;
  }
  
  public int size()
  {
    return size;
  }
  
  protected int indexOf(Object object)
  {
    for (int index = 0; index < size; index++) {
      if (objects[index] == object) {
        return index;
      }
    }
    return -1;
  }
  
  public boolean equals(Object obj)
  {
    if (obj == null) {
      return false;
    }
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof AbstractObjectList)) {
      return false;
    }
    AbstractObjectList other = (AbstractObjectList)obj;
    int listSize = size();
    for (int i = 0; i < listSize; i++) {
      if (!ObjectUtilities.equal(get(i), other.get(i))) {
        return false;
      }
    }
    return true;
  }
  
  public int hashCode()
  {
    return super.hashCode();
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    AbstractObjectList clone = (AbstractObjectList)super.clone();
    if (objects != null)
    {
      objects = new Object[objects.length];
      System.arraycopy(objects, 0, objects, 0, objects.length);
    }
    return clone;
  }
  
  private void writeObject(ObjectOutputStream stream)
    throws IOException
  {
    stream.defaultWriteObject();
    int count = size();
    stream.writeInt(count);
    for (int i = 0; i < count; i++)
    {
      Object object = get(i);
      if ((object != null) && ((object instanceof Serializable)))
      {
        stream.writeInt(i);
        stream.writeObject(object);
      }
      else
      {
        stream.writeInt(-1);
      }
    }
  }
  
  private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException
  {
    stream.defaultReadObject();
    objects = new Object[size];
    int count = stream.readInt();
    for (int i = 0; i < count; i++)
    {
      int index = stream.readInt();
      if (index != -1) {
        set(index, stream.readObject());
      }
    }
  }
}

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

import java.util.Arrays;

public class ArrayUtilities
{
  public static float[][] clone(float[][] array)
  {
    if (array == null) {
      return (float[][])null;
    }
    float[][] result = new float[array.length][];
    System.arraycopy(array, 0, result, 0, array.length);
    for (int i = 0; i < array.length; i++)
    {
      float[] child = array[i];
      float[] copychild = new float[child.length];
      System.arraycopy(child, 0, copychild, 0, child.length);
      result[i] = copychild;
    }
    return result;
  }
  
  public static boolean equalReferencesInArrays(Object[] array1, Object[] array2)
  {
    if (array1 == null) {
      return array2 == null;
    }
    if (array2 == null) {
      return false;
    }
    if (array1.length != array2.length) {
      return false;
    }
    for (int i = 0; i < array
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-2019. Infinite Loop Ltd