l2fprod-common-fontchooser-7.3

16:38:41.175 INFO  jd.cli.Main - Decompiling l2fprod-common-fontchooser-7.3.jar
package com.l2fprod.common;

import java.util.Date;

public class Version
{
  private static Date buildDate = new Date(1174140814898L);
  
  public static final Date getBuildDate()
  {
    return buildDate;
  }
  
  private static String buildTimestamp = new String("03/17/2007 03:13 PM");
  
  public static final String getBuildTimestamp()
  {
    return buildTimestamp;
  }
  
  private static String year = new String("2005-2007");
  
  public static final String getYear()
  {
    return year;
  }
  
  private static String version = new String("7.3");
  
  public static final String getVersion()
  {
    return version;
  }
  
  private static String project = new String("l2fprod-common");
  
  public static final String getProject()
  {
    return project;
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.Version
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.beans;

import java.beans.BeanInfo;

public abstract interface BeanInfoResolver
{
  public abstract BeanInfo getBeanInfo(Object paramObject);
  
  public abstract BeanInfo getBeanInfo(Class paramClass);
}

/* Location:
 * Qualified Name:     com.l2fprod.common.beans.BeanInfoResolver
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.beans.editor;

import java.awt.Component;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyEditor;

public class AbstractPropertyEditor
  implements PropertyEditor
{
  protected Component editor;
  private PropertyChangeSupport listeners = new PropertyChangeSupport(this);
  
  public boolean isPaintable()
  {
    return false;
  }
  
  public boolean supportsCustomEditor()
  {
    return false;
  }
  
  public Component getCustomEditor()
  {
    return editor;
  }
  
  public void addPropertyChangeListener(PropertyChangeListener listener)
  {
    listeners.addPropertyChangeListener(listener);
  }
  
  public void removePropertyChangeListener(PropertyChangeListener listener)
  {
    listeners.removePropertyChangeListener(listener);
  }
  
  protected void firePropertyChange(Object oldValue, Object newValue)
  {
    listeners.firePropertyChange("value", oldValue, newValue);
  }
  
  public Object getValue()
  {
    return null;
  }
  
  public void setValue(Object value) {}
  
  public String getAsText()
  {
    return null;
  }
  
  public String getJavaInitializationString()
  {
    return null;
  }
  
  public String[] getTags()
  {
    return null;
  }
  
  public void setAsText(String text)
    throws IllegalArgumentException
  {}
  
  public void paintValue(Graphics gfx, Rectangle box) {}
}

/* Location:
 * Qualified Name:     com.l2fprod.common.beans.editor.AbstractPropertyEditor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.beans.editor;

import com.l2fprod.common.util.OS;
import java.awt.Dimension;
import java.awt.Insets;
import javax.swing.JButton;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;

public final class FixedButton
  extends JButton
{
  public FixedButton()
  {
    super("...");
    if ((OS.isMacOSX()) && (UIManager.getLookAndFeel().isNativeLookAndFeel())) {
      setPreferredSize(new Dimension(16, 30));
    }
    setMargin(new Insets(0, 0, 0, 0));
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.beans.editor.FixedButton
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.beans.editor;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class FontPropertyEditor$1
  implements ActionListener
{
  private final FontPropertyEditor this$0;
  
  FontPropertyEditor$1(FontPropertyEditor this$0)
  {
    this.this$0 = this$0;
  }
  
  public void actionPerformed(ActionEvent e)
  {
    this$0.selectFont();
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.beans.editor.FontPropertyEditor.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.beans.editor;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class FontPropertyEditor$2
  implements ActionListener
{
  private final FontPropertyEditor this$0;
  
  FontPropertyEditor$2(FontPropertyEditor this$0)
  {
    this.this$0 = this$0;
  }
  
  public void actionPerformed(ActionEvent e)
  {
    this$0.selectNull();
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.beans.editor.FontPropertyEditor.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.beans.editor;

import com.l2fprod.common.swing.ComponentFactory;
import com.l2fprod.common.swing.ComponentFactory.Helper;
import com.l2fprod.common.swing.JFontChooser;
import com.l2fprod.common.swing.PercentLayout;
import com.l2fprod.common.swing.renderer.DefaultCellRenderer;
import com.l2fprod.common.util.ResourceManager;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;

public class FontPropertyEditor
  extends AbstractPropertyEditor
{
  private DefaultCellRenderer label;
  private JButton button;
  private Font font;
  
  public FontPropertyEditor()
  {
    editor = new JPanel(new PercentLayout(0, 0));
    ((JPanel)editor).add("*", label = new DefaultCellRenderer());
    label.setOpaque(false);
    ((JPanel)editor).add(button = ComponentFactory.Helper.getFactory().createMiniButton());
    
    button.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        selectFont();
      }
    });
    ((JPanel)editor).add(button = ComponentFactory.Helper.getFactory().createMiniButton());
    
    button.setText("X");
    button.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        selectNull();
      }
    });
    ((JPanel)editor).setOpaque(false);
  }
  
  public Object getValue()
  {
    return font;
  }
  
  public void setValue(Object value)
  {
    font = ((Font)value);
    label.setValue(value);
  }
  
  protected void selectFont()
  {
    ResourceManager rm = ResourceManager.all(FontPropertyEditor.class);
    String title = rm.getString("FontPropertyEditor.title");
    
    Font selectedFont = JFontChooser.showDialog(editor, title, font);
    if (selectedFont != null)
    {
      Font oldFont = font;
      Font newFont = selectedFont;
      label.setValue(newFont);
      font = newFont;
      firePropertyChange(oldFont, newFont);
    }
  }
  
  protected void selectNull()
  {
    Object oldFont = font;
    label.setValue(null);
    font = null;
    firePropertyChange(oldFont, null);
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.beans.editor.FontPropertyEditor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.demo;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class ChooseFont$1
  implements ActionListener
{
  private final ChooseFont this$0;
  
  ChooseFont$1(ChooseFont this$0)
  {
    this.this$0 = this$0;
  }
  
  public void actionPerformed(ActionEvent e)
  {
    ChooseFont.access$000(this$0);
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.demo.ChooseFont.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.demo;

import com.l2fprod.common.swing.JFontChooser;
import com.l2fprod.common.swing.PercentLayout;
import java.awt.Component;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UIManager;

public class ChooseFont
  extends JPanel
{
  public ChooseFont()
  {
    setLayout(new PercentLayout(1, 3));
    
    JFontChooser chooser = new JFontChooser();
    chooser.setSelectedFont(new Font("Dialog", 3, 56));
    add("*", chooser);
    
    JButton button = new JButton("Click here to show JFontChooser");
    button.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        ChooseFont.selectFont(ChooseFont.this);
      }
    });
    add(button);
  }
  
  private static void selectFont(Component parent)
  {
    Font selectedFont = JFontChooser.showDialog(parent, "Choose Font", null);
    if (selectedFont == null) {
      JOptionPane.showMessageDialog(parent, "You clicked 'Cancel'");
    } else {
      JOptionPane.showMessageDialog(parent, "You selected '" + selectedFont.getName() + "'");
    }
  }
  
  public static void main(String[] args)
    throws Exception
  {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    selectFont(null);
    System.exit(0);
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.demo.ChooseFont
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.demo;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.JEditorPane;

class Main$1
  extends JEditorPane
{
  private final Main this$0;
  
  Main$1(Main this$0, String x0, String x1)
  {
    super(x0, x1);this.this$0 = this$0;
  }
  
  protected void paintComponent(Graphics g)
  {
    Graphics2D g2d = (Graphics2D)g;
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    
    super.paintComponent(g);
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.demo.Main.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.demo;

import com.l2fprod.common.Version;
import com.l2fprod.common.swing.plaf.LookAndFeelAddons;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;

public class Main
  extends JPanel
{
  public Main()
  {
    setLayout(new BorderLayout());
    
    JTabbedPane tabs = new JTabbedPane();
    add("Center", tabs);
    
    addDemo(tabs, "JButtonBar", "ButtonBarMain");
    addDemo(tabs, "JDirectoryChooser", "ChooseDirectory");
    addDemo(tabs, "JFontChooser", "ChooseFont");
    addDemo(tabs, "JOutlookBar", "OutlookBarMain");
    addDemo(tabs, "JTaskPane", "TaskPaneMain");
    addDemo(tabs, "PropertySheet", "PropertySheetMain");
    addDemo(tabs, "JTipOfTheDay", "TOTDTest");
    try
    {
      JEditorPane pane = new JEditorPane("text/html", "<html>")
      {
        protected void paintComponent(Graphics g)
        {
          Graphics2D g2d = (Graphics2D)g;
          g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
          
          super.paintComponent(g);
        }
      };
      pane.setPage(Main.class.getResource("demo.html"));
      pane.setBackground(Color.white);
      pane.setEditable(false);
      pane.setOpaque(true);
      add("South", pane);
    }
    catch (Exception e) {}
  }
  
  void addDemo(JTabbedPane tabs, String title, String demoClass)
  {
    String prefix = "com.l2fprod.common.demo.";
    LookAndFeelAddons addon = LookAndFeelAddons.getAddon();
    try
    {
      JComponent component = (JComponent)Class.forName(prefix + demoClass).newInstance();
      
      component.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
      tabs.addTab(title, component);
    }
    catch (Exception e) {}finally
    {
      try
      {
        LookAndFeelAddons.setAddon(addon.getClass());
      }
      catch (InstantiationException e1)
      {
        e1.printStackTrace();
      }
      catch (IllegalAccessException e1)
      {
        e1.printStackTrace();
      }
    }
  }
  
  public static void main(String[] args)
    throws Exception
  {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    
    JFrame frame = new JFrame("L2FProd.com Common Components " + Version.getVersion() + " (build " + Version.getBuildTimestamp() + ")");
    
    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add("Center", new Main());
    frame.setDefaultCloseOperation(3);
    frame.setSize(450, 550);
    frame.setLocation(100, 100);
    frame.setVisible(true);
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.demo.Main
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.model;

import java.util.Observable;

public class BaseObject
  extends Observable
  implements HasId
{
  private Object id;
  
  public void setId(Object id)
  {
    this.id = id;
  }
  
  public Object getId()
  {
    return id;
  }
  
  public String toString()
  {
    return super.toString() + "[" + paramString() + "]";
  }
  
  protected String paramString()
  {
    return "id=" + getId();
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.model.BaseObject
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.model;

import com.l2fprod.common.beans.BeanInfoResolver;
import java.beans.BeanInfo;

public class DefaultBeanInfoResolver
  implements BeanInfoResolver
{
  public BeanInfo getBeanInfo(Object object)
  {
    if (object == null) {
      return null;
    }
    return getBeanInfo(object.getClass());
  }
  
  public BeanInfo getBeanInfo(Class clazz)
  {
    if (clazz == null) {
      return null;
    }
    String classname = clazz.getName();
    
    int index = classname.indexOf(".impl.basic");
    if ((index != -1) && (classname.endsWith("Basic")))
    {
      classname = classname.substring(0, index) + classname.substring(index + ".impl.basic".length(), classname.lastIndexOf("Basic"));
      try
      {
        return getBeanInfo(Class.forName(classname));
      }
      catch (ClassNotFoundException e)
      {
        return null;
      }
    }
    try
    {
      return (BeanInfo)Class.forName(classname + "BeanInfo").newInstance();
    }
    catch (Exception e) {}
    return null;
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.model.DefaultBeanInfoResolver
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.model;

import com.l2fprod.common.util.ResourceManager;
import com.l2fprod.common.util.converter.ConverterRegistry;
import java.io.File;

public class DefaultObjectRenderer
  implements ObjectRenderer
{
  private boolean idVisible = false;
  
  public void setIdVisible(boolean b)
  {
    idVisible = b;
  }
  
  public String getText(Object object)
  {
    if (object == null) {
      return null;
    }
    try
    {
      return (String)ConverterRegistry.instance().convert(String.class, object);
    }
    catch (IllegalArgumentException e)
    {
      if ((object instanceof Boolean)) {
        return Boolean.TRUE.equals(object) ? ResourceManager.common().getString("true") : ResourceManager.common().getString("false");
      }
      if ((object instanceof File)) {
        return ((File)object).getAbsolutePath();
      }
      StringBuffer buffer = new StringBuffer();
      if ((idVisible) && ((object instanceof HasId))) {
        buffer.append(((HasId)object).getId());
      }
      if ((object instanceof TitledObject)) {
        buffer.append(((TitledObject)object).getTitle());
      }
      if ((!(object instanceof HasId)) && (!(object instanceof TitledObject))) {
        buffer.append(String.valueOf(object));
      }
      return buffer.toString();
    }
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.model.DefaultObjectRenderer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.model;

public abstract interface HasId
{
  public abstract void setId(Object paramObject);
  
  public abstract Object getId();
}

/* Location:
 * Qualified Name:     com.l2fprod.common.model.HasId
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.model;

public abstract interface ObjectRenderer
{
  public abstract String getText(Object paramObject);
}

/* Location:
 * Qualified Name:     com.l2fprod.common.model.ObjectRenderer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.model;

public abstract interface Openable
{
  public abstract void open();
}

/* Location:
 * Qualified Name:     com.l2fprod.common.model.Openable
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.model;

public abstract interface TitledObject
{
  public abstract String getTitle();
  
  public abstract void setTitle(String paramString);
}

/* Location:
 * Qualified Name:     com.l2fprod.common.model.TitledObject
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.Icon;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.text.JTextComponent;

public class BannerPanel
  extends JPanel
{
  private JLabel titleLabel;
  private JTextComponent subtitleLabel;
  private JLabel iconLabel;
  
  public BannerPanel()
  {
    setBorder(new CompoundBorder(new EtchedBorder(), LookAndFeelTweaks.PANEL_BORDER));
    
    setOpaque(true);
    setBackground(UIManager.getColor("Table.background"));
    
    titleLabel = new JLabel();
    titleLabel.setOpaque(false);
    
    subtitleLabel = new JEditorPane("text/html", "<html>");
    subtitleLabel.setFont(titleLabel.getFont());
    
    LookAndFeelTweaks.makeBold(titleLabel);
    LookAndFeelTweaks.makeMultilineLabel(subtitleLabel);
    LookAndFeelTweaks.htmlize(subtitleLabel);
    
    iconLabel = new JLabel();
    iconLabel.setPreferredSize(new Dimension(50, 50));
    
    setLayout(new BorderLayout());
    
    JPanel nestedPane = new JPanel(new BorderLayout());
    nestedPane.setOpaque(false);
    nestedPane.add("North", titleLabel);
    nestedPane.add("Center", subtitleLabel);
    add("Center", nestedPane);
    add("East", iconLabel);
  }
  
  public void setTitleColor(Color color)
  {
    titleLabel.setForeground(color);
  }
  
  public Color getTitleColor()
  {
    return titleLabel.getForeground();
  }
  
  public void setSubtitleColor(Color color)
  {
    subtitleLabel.setForeground(color);
  }
  
  public Color getSubtitleColor()
  {
    return subtitleLabel.getForeground();
  }
  
  public void setTitle(String title)
  {
    titleLabel.setText(title);
  }
  
  public String getTitle()
  {
    return titleLabel.getText();
  }
  
  public void setSubtitle(String subtitle)
  {
    subtitleLabel.setText(subtitle);
  }
  
  public String getSubtitle()
  {
    return subtitleLabel.getText();
  }
  
  public void setSubtitleVisible(boolean b)
  {
    subtitleLabel.setVisible(b);
  }
  
  public boolean isSubtitleVisible()
  {
    return subtitleLabel.isVisible();
  }
  
  public void setIcon(Icon icon)
  {
    iconLabel.setIcon(icon);
  }
  
  public Icon getIcon()
  {
    return iconLabel.getIcon();
  }
  
  public void setIconVisible(boolean b)
  {
    iconLabel.setVisible(b);
  }
  
  public boolean isIconVisible()
  {
    return iconLabel.isVisible();
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.BannerPanel
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

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

class BaseDialog$1
  extends AbstractAction
{
  private final BaseDialog this$0;
  
  BaseDialog$1(BaseDialog this$0)
  {
    this.this$0 = this$0;
  }
  
  public void actionPerformed(ActionEvent e)
  {
    this$0.ok();
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.BaseDialog.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

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

class BaseDialog$2
  extends AbstractAction
{
  private final BaseDialog this$0;
  
  BaseDialog$2(BaseDialog this$0)
  {
    this.this$0 = this$0;
  }
  
  public void actionPerformed(ActionEvent e)
  {
    this$0.cancel();
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.BaseDialog.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

class BaseDialog$3
  extends WindowAdapter
{
  private final BaseDialog this$0;
  
  BaseDialog$3(BaseDialog this$0)
  {
    this.this$0 = this$0;
  }
  
  public void windowClosing(WindowEvent e)
  {
    this$0.cancel();
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.BaseDialog.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

import com.l2fprod.common.util.ResourceManager;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.awt.HeadlessException;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;

public class BaseDialog
  extends JDialog
{
  public static final int OK_CANCEL_DIALOG = 0;
  public static final int CLOSE_DIALOG = 1;
  private BannerPanel banner;
  private JPanel contentPane;
  private JPanel buttonPane;
  private boolean cancelClicked;
  private JButton okButton;
  private JButton cancelOrCloseButton;
  private int mode;
  private Action okAction = new AbstractAction()
  {
    public void actionPerformed(ActionEvent e)
    {
      ok();
    }
  };
  private Action cancelOrCloseAction = new AbstractAction()
  {
    public void actionPerformed(ActionEvent e)
    {
      cancel();
    }
  };
  
  public BaseDialog()
    throws HeadlessException
  {
    buildUI();
  }
  
  public BaseDialog(Dialog owner)
    throws HeadlessException
  {
    super(owner);
    buildUI();
  }
  
  public static BaseDialog newBaseDialog(Component parent)
  {
    Window window = (parent instanceof Window) ? (Window)parent : (Window)SwingUtilities.getAncestorOfClass(Window.class, parent);
    if ((window instanceof Frame)) {
      return new BaseDialog((Frame)window);
    }
    if ((window instanceof Dialog)) {
      return new BaseDialog((Dialog)window);
    }
    return new BaseDialog();
  }
  
  public BaseDialog(Dialog owner, boolean modal)
    throws HeadlessException
  {
    super(owner, modal);
    buildUI();
  }
  
  public BaseDialog(Frame owner)
    throws HeadlessException
  {
    super(owner);
    buildUI();
  }
  
  public BaseDialog(Frame owner, boolean modal)
    throws HeadlessException
  {
    super(owner, modal);
    buildUI();
  }
  
  public BaseDialog(Dialog owner, String title)
    throws HeadlessException
  {
    super(owner, title);
    buildUI();
  }
  
  public BaseDialog(Dialog owner, String title, boolean modal)
    throws HeadlessException
  {
    super(owner, title, modal);
    buildUI();
  }
  
  public BaseDialog(Frame owner, String title)
    throws HeadlessException
  {
    super(owner, title);
    buildUI();
  }
  
  public BaseDialog(Frame owner, String title, boolean modal)
    throws HeadlessException
  {
    super(owner, title, modal);
    buildUI();
  }
  
  public BaseDialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc)
    throws HeadlessException
  {
    super(owner, title, modal, gc);
    buildUI();
  }
  
  public BaseDialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc)
  {
    super(owner, title, modal, gc);
    buildUI();
  }
  
  public final BannerPanel getBanner()
  {
    return banner;
  }
  
  public final Container getContentPane()
  {
    return contentPane;
  }
  
  public final Container getButtonPane()
  {
    return buttonPane;
  }
  
  public boolean ask()
  {
    setVisible(true);
    dispose();
    return !cancelClicked;
  }
  
  public void ok()
  {
    cancelClicked = false;
    setVisible(false);
  }
  
  public void cancel()
  {
    cancelClicked = true;
    setVisible(false);
  }
  
  public void setDialogMode(int mode)
  {
    if ((mode != 0) && (mode != 1)) {
      throw new IllegalArgumentException("invalid dialog mode");
    }
    if (okButton != null)
    {
      buttonPane.remove(okButton);
      okButton = null;
    }
    if (cancelOrCloseButton != null)
    {
      buttonPane.remove(cancelOrCloseButton);
      cancelOrCloseButton = null;
    }
    switch (mode)
    {
    case 0: 
      okButton = new JButton(ResourceManager.all(BaseDialog.class).getString("ok"));
      
      okButton.addActionListener(okAction);
      buttonPane.add(okButton);
      cancelOrCloseButton = new JButton(ResourceManager.all(BaseDialog.class).getString("cancel"));
      
      cancelOrCloseButton.addActionListener(cancelOrCloseAction);
      buttonPane.add(cancelOrCloseButton);
      getRootPane().setDefaultButton(okButton);
      break;
    case 1: 
      cancelOrCloseButton = new JButton(ResourceManager.all(BaseDialog.class).getString("close"));
      
      cancelOrCloseButton.addActionListener(cancelOrCloseAction);
      buttonPane.add(cancelOrCloseButton);
    }
    this.mode = mode;
  }
  
  public int getDialogMode()
  {
    return mode;
  }
  
  public void centerOnScreen()
  {
    UIUtilities.centerOnScreen(this);
  }
  
  protected String paramString()
  {
    return super.paramString() + ",dialogMode=" + (mode == 0 ? "OK_CANCEL_DIALOG" : "CLOSE_DIALOG");
  }
  
  private void buildUI()
  {
    Container container = super.getContentPane();
    container.setLayout(new BorderLayout(0, 0));
    
    banner = new BannerPanel();
    container.add("North", banner);
    
    JPanel contentPaneAndButtons = new JPanel();
    contentPaneAndButtons.setLayout(LookAndFeelTweaks.createVerticalPercentLayout());
    
    contentPaneAndButtons.setBorder(LookAndFeelTweaks.WINDOW_BORDER);
    container.add("Center", contentPaneAndButtons);
    
    contentPane = new JPanel();
    LookAndFeelTweaks.setBorderLayout(contentPane);
    LookAndFeelTweaks.setBorder(contentPane);
    contentPaneAndButtons.add(contentPane, "*");
    
    buttonPane = new JPanel();
    buttonPane.setLayout(LookAndFeelTweaks.createButtonAreaLayout());
    LookAndFeelTweaks.setBorder(buttonPane);
    contentPaneAndButtons.add(buttonPane);
    
    setDefaultCloseOperation(0);
    
    ((JComponent)container).registerKeyboardAction(cancelOrCloseAction, KeyStroke.getKeyStroke(27, 0), 2);
    
    addWindowListener(new WindowAdapter()
    {
      public void windowClosing(WindowEvent e)
      {
        cancel();
      }
    });
    setDialogMode(0);
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.BaseDialog
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

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

public final class ButtonAreaLayout
  implements LayoutManager
{
  private int gap;
  
  public ButtonAreaLayout(int gap)
  {
    this.gap = gap;
  }
  
  public void addLayoutComponent(String string, Component comp) {}
  
  public void layoutContainer(Container container)
  {
    Insets insets = container.getInsets();
    Component[] children = container.getComponents();
    
    int maxWidth = 0;
    int maxHeight = 0;
    int visibleCount = 0;
    
    int i = 0;
    for (int c = children.length; i < c; i++) {
      if (children[i].isVisible())
      {
        Dimension componentPreferredSize = children[i].getPreferredSize();
        maxWidth = Math.max(maxWidth, width);
        maxHeight = Math.max(maxHeight, height);
        visibleCount++;
      }
    }
    int usedWidth = maxWidth * visibleCount + gap * (visibleCount - 1);
    
    visibleCount = 0;
    int i = 0;
    for (int c = children.length; i < c; i++) {
      if (children[i].isVisible())
      {
        children[i].setBounds(container.getWidth() - right - usedWidth + (maxWidth + gap) * visibleCount, top, maxWidth, maxHeight);
        
        visibleCount++;
      }
    }
  }
  
  public Dimension minimumLayoutSize(Container c)
  {
    return preferredLayoutSize(c);
  }
  
  public Dimension preferredLayoutSize(Container container)
  {
    Insets insets = container.getInsets();
    Component[] children = container.getComponents();
    
    int maxWidth = 0;
    int maxHeight = 0;
    int visibleCount = 0;
    
    int i = 0;
    for (int c = children.length; i < c; i++) {
      if (children[i].isVisible())
      {
        Dimension componentPreferredSize = children[i].getPreferredSize();
        maxWidth = Math.max(maxWidth, width);
        maxHeight = Math.max(maxHeight, height);
        visibleCount++;
      }
    }
    int usedWidth = maxWidth * visibleCount + gap * (visibleCount - 1);
    
    return new Dimension(left + usedWidth + right, top + maxHeight + bottom);
  }
  
  public void removeLayoutComponent(Component c) {}
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.ButtonAreaLayout
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

import com.l2fprod.common.beans.editor.FixedButton;
import javax.swing.JButton;
import javax.swing.JComboBox;

public class ComponentFactory$DefaultComponentFactory
  implements ComponentFactory
{
  public JButton createMiniButton()
  {
    return new FixedButton();
  }
  
  public JComboBox createComboBox()
  {
    return new JComboBox();
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.ComponentFactory.DefaultComponentFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

public class ComponentFactory$Helper
{
  static ComponentFactory factory = new ComponentFactory.DefaultComponentFactory();
  
  public static ComponentFactory getFactory()
  {
    return factory;
  }
  
  public static void setFactory(ComponentFactory factory)
  {
    factory = factory;
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.ComponentFactory.Helper
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

import com.l2fprod.common.beans.editor.FixedButton;
import javax.swing.JButton;
import javax.swing.JComboBox;

public abstract interface ComponentFactory
{
  public abstract JButton createMiniButton();
  
  public abstract JComboBox createComboBox();
  
  public static class Helper
  {
    static ComponentFactory factory = new ComponentFactory.DefaultComponentFactory();
    
    public static ComponentFactory getFactory()
    {
      return factory;
    }
    
    public static void setFactory(ComponentFactory factory)
    {
      factory = factory;
    }
  }
  
  public static class DefaultComponentFactory
    implements ComponentFactory
  {
    public JButton createMiniButton()
    {
      return new FixedButton();
    }
    
    public JComboBox createComboBox()
    {
      return new JComboBox();
    }
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.ComponentFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

import com.l2fprod.common.swing.plaf.FontChooserUI;
import java.awt.GraphicsEnvironment;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Iterator;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.SortedMap;

public class DefaultFontChooserModel
  implements FontChooserModel
{
  public static final int[] DEFAULT_FONT_SIZES = { 6, 8, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 32, 40, 48, 56, 64, 72 };
  protected String[] fontFamilies;
  private String[] charSets;
  private int[] defaultFontSizes;
  private String previewMessage;
  
  public DefaultFontChooserModel()
  {
    ResourceBundle bundle = ResourceBundle.getBundle(FontChooserUI.class.getName() + "RB");
    
    setPreviewMessage(bundle.getString("FontChooserUI.previewText"));
    
    String[] fontFamilies = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
    
    Arrays.sort(fontFamilies);
    setFontFamilies(fontFamilies);
    
    SortedMap map = Charset.availableCharsets();
    String[] charSets = new String[map.size()];
    int i = 0;
    for (Iterator iter = map.keySet().iterator(); iter.hasNext(); i++) {
      charSets[i] = ((String)iter.next());
    }
    setCharSets(charSets);
    
    setDefaultFontSizes(DEFAULT_FONT_SIZES);
  }
  
  public void setFontFamilies(String[] fontFamilies)
  {
    this.fontFamilies = fontFamilies;
  }
  
  public String[] getFontFamilies(String charSetName)
  {
    return fontFamilies;
  }
  
  public void setDefaultFontSizes(int[] defaultFontSizes)
  {
    this.defaultFontSizes = defaultFontSizes;
  }
  
  public int[] getDefaultSizes()
  {
    return defaultFontSizes;
  }
  
  public void setCharSets(String[] charSets)
  {
    this.charSets = charSets;
  }
  
  public String[] getCharSets()
  {
    return charSets;
  }
  
  public void setPreviewMessage(String previewMessage)
  {
    this.previewMessage = previewMessage;
  }
  
  public String getPreviewMessage(String charSetName)
  {
    return previewMessage;
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.DefaultFontChooserModel
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

public abstract interface FontChooserModel
{
  public abstract String[] getFontFamilies(String paramString);
  
  public abstract int[] getDefaultSizes();
  
  public abstract String[] getCharSets();
  
  public abstract String getPreviewMessage(String paramString);
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.FontChooserModel
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import javax.swing.Icon;
import javax.swing.ImageIcon;

public class IconPool
{
  private static IconPool iconPool = new IconPool();
  private Map pool;
  
  public IconPool()
  {
    pool = new HashMap();
  }
  
  public static IconPool shared()
  {
    return iconPool;
  }
  
  public Icon get(String url)
  {
    StackTraceElement[] stacks = new Exception().getStackTrace();
    try
    {
      Class callerClazz = Class.forName(stacks[1].getClassName());
      return get(callerClazz.getResource(url));
    }
    catch (ClassNotFoundException e)
    {
      throw new RuntimeException(e);
    }
  }
  
  public synchronized Icon get(URL url)
  {
    if (url == null) {
      return null;
    }
    Icon icon = (Icon)pool.get(url.toString());
    if (icon == null)
    {
      icon = new ImageIcon(url);
      pool.put(url.toString(), icon);
    }
    return icon;
  }
  
  public synchronized void clear()
  {
    pool.clear();
  }
}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.IconPool
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

class JCollapsiblePane$1 {}

/* Location:
 * Qualified Name:     com.l2fprod.common.swing.JCollapsiblePane.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.l2fprod.common.swing;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.Timer;

final class JCollapsiblePane$AnimationListener
  implements ActionListener
{
  private final Object ANIMATION_MUTEX;
  private int startHeight;
  private int finalHeight;
  private float animateAlpha;
  private final JCollapsiblePane this$0;
  
  JCollapsiblePane$AnimationListener(JCollapsiblePane x0, JCollapsiblePane.1 x1)
  {
    this(x0);
  }
  
  private JCollapsiblePane$AnimationListener(JCollapsiblePane this$0)
  {
    this.this$0 = this$0;
    
    ANIMATION_MUTEX = "Animation Synchronization Mutex";
    
    startHeight = 0;
    
    finalHeight = 0;
    
    animateAlpha = 1.0F;
  }
  
  public void actionPerformed(ActionEvent e)
  {
    synchronized (ANIMATION_MUTEX)
    {
      if (startHeight == finalHeight)
      {
        JCollapsiblePane.access$200(this$0).stop();
        animateAlpha = access$300this$0).alphaEnd;
        if (finalHeight > 0)
        {
          JCollapsiblePane.access$400(this$0).showContent();
          validate();
          JCollapsiblePane.access$500(this$0, "animationState", null, "expanded");
          
          return;
        }
      }
      boolean contracting = startHeight > finalHeight;
      int delta_y = contracting ? -1 * access$300this$0).deltaY : access$300this$0).deltaY;
      
      int newHeight = JCollapsiblePane.access$400(this$0).getHeight() + delta_y;
      if (contracting)
      {
        if (newHeight < finalHeight) {
          newHeight = finalHeight;
        }
      }
      else if (newHeight > finalHeight) {
        newHeight = finalHeight;
      }
      animateAlpha = (newHeight / access$100access$400this$0)).getPreferredSize().height);
      
      Rectangle bounds = JCollapsiblePane.access$400(this$0).getBounds();
      int oldHeight = height;
      height = newHeight;
      JCollapsiblePane.access$400(this$0).setBounds(bounds);
      bounds = this$0.getBounds();
      height = (height - oldHeight + newHeight);
      JCollapsiblePane.access$602(this$0, height);
      this$0.setBounds(bounds);
      startHeight = newHeight;
      if (contracting)
      {
        if (animateAlpha < access$300this$0).alphaEnd) {
          animateAlpha = access$300this$0).alphaEnd;
        }
        if (animateAlpha > access$300this$0).alphaStart) {
          animateAlpha = access$300this$0).alphaStart;
        }
      }
      else
      {
        if (animateAlpha > access$300this$0).alphaEnd) {
          animateAlpha = access$300this$0).alphaEnd;
        }
        if (animateAlpha < access$300this$0).alphaStart) {
          animateAlpha = access$300this$0).alphaStart;
        }
      }
      access$400this$0).alpha = animateAlpha;
      
      validate();
    }
  }
  
  void validate()
  {
    Container parent = SwingUtilities.getAncestorOfClass(JCollapsiblePane.class$com$l2fprod$common$swing$JCollapsiblePane$JCollapsiblePaneContainer == null ? (JCollapsiblePane.class$com$l2fprod$common$swing$JCollapsiblePane$JCollapsiblePaneContainer = JCollapsiblePane.class$("com.l2fprod.common.swing.JCollapsiblePane$JCollapsiblePaneContainer")) : JCollapsiblePane.class$com$l2fprod$common$swing$JCollapsiblePane$JCollapsiblePaneContainer, this$0);
    if (parent != null) {
      parent = ((JCollapsiblePane.JCollapsiblePaneContainer)parent).getValidatingContainer();
    } else {
      parent = this$0.getParent();
    }
    if (parent != null)
    {
      if ((parent instanceof JComponent)) {
        ((JComponent)parent).revalidate();
      } else {
        parent.invalidate();
      }
      parent.doLayout();
      parent.repaint();
    }
  }
  
  public void reinit(int startHeight, int stopHeight)
  {
    synchronized (ANIMATION_MUTEX)
    {
      JCollapsible
1 2 3 4 5

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