org.apache.batik.util.gui_1.6.0.v201011041432

16:40:56.590 INFO  jd.cli.Main - Decompiling org.apache.batik.util.gui_1.6.0.v201011041432.jar
package org.apache.batik.util.gui;

import java.awt.Dialog;
import java.awt.Window;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.DefaultListModel;

public class CSSMediaPanel$AddButtonAction
  extends AbstractAction
{
  private final CSSMediaPanel this$0;
  
  protected CSSMediaPanel$AddButtonAction(CSSMediaPanel paramCSSMediaPanel)
  {
    this$0 = paramCSSMediaPanel;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    CSSMediaPanel.AddMediumDialog localAddMediumDialog = new CSSMediaPanel.AddMediumDialog(this$0);
    localAddMediumDialog.pack();
    localAddMediumDialog.show();
    if ((localAddMediumDialog.getReturnCode() == 1) || (localAddMediumDialog.getMedium() == null)) {
      return;
    }
    String str1 = localAddMediumDialog.getMedium().trim();
    if ((str1.length() == 0) || (this$0.listModel.contains(str1))) {
      return;
    }
    for (int i = 0; (i < this$0.listModel.size()) && (str1 != null); i++)
    {
      String str2 = (String)this$0.listModel.getElementAt(i);
      int j = str1.compareTo(str2);
      if (j == 0)
      {
        str1 = null;
      }
      else if (j < 0)
      {
        this$0.listModel.insertElementAt(str1, i);
        str1 = null;
      }
    }
    if (str1 != null) {
      this$0.listModel.addElement(str1);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel.AddButtonAction
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

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

public class CSSMediaPanel$AddMediumDialog$CancelButtonAction
  extends AbstractAction
{
  private final CSSMediaPanel.AddMediumDialog this$0;
  
  protected CSSMediaPanel$AddMediumDialog$CancelButtonAction(CSSMediaPanel.AddMediumDialog paramAddMediumDialog)
  {
    this$0 = paramAddMediumDialog;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    this$0.returnCode = 1;
    this$0.dispose();
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel.AddMediumDialog.CancelButtonAction
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

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

public class CSSMediaPanel$AddMediumDialog$OKButtonAction
  extends AbstractAction
{
  private final CSSMediaPanel.AddMediumDialog this$0;
  
  protected CSSMediaPanel$AddMediumDialog$OKButtonAction(CSSMediaPanel.AddMediumDialog paramAddMediumDialog)
  {
    this$0 = paramAddMediumDialog;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    this$0.returnCode = 0;
    this$0.dispose();
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel.AddMediumDialog.OKButtonAction
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import org.apache.batik.util.gui.resource.ActionMap;
import org.apache.batik.util.gui.resource.ButtonFactory;
import org.apache.batik.util.gui.resource.MissingListenerException;
import org.apache.batik.util.gui.resource.ResourceManager;

public class CSSMediaPanel$AddMediumDialog
  extends JDialog
  implements ActionMap
{
  public static final int OK_OPTION = 0;
  public static final int CANCEL_OPTION = 1;
  protected JComboBox medium;
  protected int returnCode;
  protected Map listeners = new HashMap();
  
  public CSSMediaPanel$AddMediumDialog(Component paramComponent)
  {
    super(JOptionPane.getFrameForComponent(paramComponent), CSSMediaPanel.resources.getString("AddMediumDialog.title"));
    setModal(true);
    listeners.put("OKButtonAction", new OKButtonAction());
    listeners.put("CancelButtonAction", new CancelButtonAction());
    getContentPane().add(createContentPanel(), "Center");
    getContentPane().add(createButtonsPanel(), "South");
  }
  
  public String getMedium()
  {
    return (String)medium.getSelectedItem();
  }
  
  protected Component createContentPanel()
  {
    JPanel localJPanel = new JPanel(new BorderLayout());
    localJPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    localJPanel.add(new JLabel(CSSMediaPanel.resources.getString("AddMediumDialog.label")), "West");
    medium = new JComboBox();
    medium.setEditable(true);
    String str = CSSMediaPanel.resources.getString("Media.list");
    StringTokenizer localStringTokenizer = new StringTokenizer(str, " ");
    while (localStringTokenizer.hasMoreTokens()) {
      medium.addItem(localStringTokenizer.nextToken());
    }
    localJPanel.add(medium, "Center");
    return localJPanel;
  }
  
  protected Component createButtonsPanel()
  {
    JPanel localJPanel = new JPanel(new FlowLayout(2));
    ButtonFactory localButtonFactory = new ButtonFactory(CSSMediaPanel.bundle, this);
    localJPanel.add(localButtonFactory.createJButton("OKButton"));
    localJPanel.add(localButtonFactory.createJButton("CancelButton"));
    return localJPanel;
  }
  
  public int getReturnCode()
  {
    return returnCode;
  }
  
  public Action getAction(String paramString)
    throws MissingListenerException
  {
    return (Action)listeners.get(paramString);
  }
  
  protected class CancelButtonAction
    extends AbstractAction
  {
    protected CancelButtonAction() {}
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      returnCode = 1;
      dispose();
    }
  }
  
  protected class OKButtonAction
    extends AbstractAction
  {
    protected OKButtonAction() {}
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      returnCode = 0;
      dispose();
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel.AddMediumDialog
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

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

public class CSSMediaPanel$ClearButtonAction
  extends AbstractAction
{
  private final CSSMediaPanel this$0;
  
  protected CSSMediaPanel$ClearButtonAction(CSSMediaPanel paramCSSMediaPanel)
  {
    this$0 = paramCSSMediaPanel;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    this$0.mediaList.clearSelection();
    this$0.listModel.removeAllElements();
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel.ClearButtonAction
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

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

public class CSSMediaPanel$Dialog$CancelButtonAction
  extends AbstractAction
{
  private final CSSMediaPanel.Dialog this$0;
  
  protected CSSMediaPanel$Dialog$CancelButtonAction(CSSMediaPanel.Dialog paramDialog)
  {
    this$0 = paramDialog;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    this$0.returnCode = 1;
    this$0.dispose();
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel.Dialog.CancelButtonAction
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

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

public class CSSMediaPanel$Dialog$OKButtonAction
  extends AbstractAction
{
  private final CSSMediaPanel.Dialog this$0;
  
  protected CSSMediaPanel$Dialog$OKButtonAction(CSSMediaPanel.Dialog paramDialog)
  {
    this$0 = paramDialog;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    this$0.returnCode = 0;
    this$0.dispose();
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel.Dialog.OKButtonAction
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import java.awt.Component;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import org.apache.batik.util.gui.resource.ActionMap;
import org.apache.batik.util.gui.resource.ButtonFactory;
import org.apache.batik.util.gui.resource.MissingListenerException;

public class CSSMediaPanel$Dialog
  extends JDialog
  implements ActionMap
{
  public static final int OK_OPTION = 0;
  public static final int CANCEL_OPTION = 1;
  protected int returnCode;
  protected Map listeners = new HashMap();
  
  public CSSMediaPanel$Dialog()
  {
    this(null, "", "");
  }
  
  public CSSMediaPanel$Dialog(Component paramComponent, String paramString, List paramList)
  {
    super(JOptionPane.getFrameForComponent(paramComponent), paramString);
    listeners.put("OKButtonAction", new OKButtonAction());
    listeners.put("CancelButtonAction", new CancelButtonAction());
    CSSMediaPanel localCSSMediaPanel = new CSSMediaPanel();
    localCSSMediaPanel.setMedia(paramList);
    getContentPane().add(localCSSMediaPanel, "Center");
    getContentPane().add(createButtonsPanel(), "South");
  }
  
  public CSSMediaPanel$Dialog(Component paramComponent, String paramString1, String paramString2)
  {
    super(JOptionPane.getFrameForComponent(paramComponent), paramString1);
    listeners.put("OKButtonAction", new OKButtonAction());
    listeners.put("CancelButtonAction", new CancelButtonAction());
    CSSMediaPanel localCSSMediaPanel = new CSSMediaPanel();
    localCSSMediaPanel.setMedia(paramString2);
    getContentPane().add(localCSSMediaPanel, "Center");
    getContentPane().add(createButtonsPanel(), "South");
  }
  
  public int getReturnCode()
  {
    return returnCode;
  }
  
  protected JPanel createButtonsPanel()
  {
    JPanel localJPanel = new JPanel(new FlowLayout(2));
    ButtonFactory localButtonFactory = new ButtonFactory(CSSMediaPanel.bundle, this);
    localJPanel.add(localButtonFactory.createJButton("OKButton"));
    localJPanel.add(localButtonFactory.createJButton("CancelButton"));
    return localJPanel;
  }
  
  public Action getAction(String paramString)
    throws MissingListenerException
  {
    return (Action)listeners.get(paramString);
  }
  
  protected class CancelButtonAction
    extends AbstractAction
  {
    protected CancelButtonAction() {}
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      returnCode = 1;
      dispose();
    }
  }
  
  protected class OKButtonAction
    extends AbstractAction
  {
    protected OKButtonAction() {}
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      returnCode = 0;
      dispose();
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel.Dialog
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;

public class CSSMediaPanel$MediaListDataListener
  implements ListDataListener
{
  private final CSSMediaPanel this$0;
  
  protected CSSMediaPanel$MediaListDataListener(CSSMediaPanel paramCSSMediaPanel)
  {
    this$0 = paramCSSMediaPanel;
  }
  
  public void contentsChanged(ListDataEvent paramListDataEvent)
  {
    this$0.updateButtons();
  }
  
  public void intervalAdded(ListDataEvent paramListDataEvent)
  {
    this$0.updateButtons();
  }
  
  public void intervalRemoved(ListDataEvent paramListDataEvent)
  {
    this$0.updateButtons();
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel.MediaListDataListener
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

public class CSSMediaPanel$MediaListSelectionListener
  implements ListSelectionListener
{
  private final CSSMediaPanel this$0;
  
  protected CSSMediaPanel$MediaListSelectionListener(CSSMediaPanel paramCSSMediaPanel)
  {
    this$0 = paramCSSMediaPanel;
  }
  
  public void valueChanged(ListSelectionEvent paramListSelectionEvent)
  {
    this$0.updateButtons();
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel.MediaListSelectionListener
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

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

public class CSSMediaPanel$RemoveButtonAction
  extends AbstractAction
{
  private final CSSMediaPanel this$0;
  
  protected CSSMediaPanel$RemoveButtonAction(CSSMediaPanel paramCSSMediaPanel)
  {
    this$0 = paramCSSMediaPanel;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    int i = this$0.mediaList.getSelectedIndex();
    this$0.mediaList.clearSelection();
    if (i >= 0) {
      this$0.listModel.removeElementAt(i);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel.RemoveButtonAction
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.FlowLayout;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
import javax.swing.AbstractListModel;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.apache.batik.util.gui.resource.ActionMap;
import org.apache.batik.util.gui.resource.ButtonFactory;
import org.apache.batik.util.gui.resource.MissingListenerException;
import org.apache.batik.util.gui.resource.ResourceManager;

public class CSSMediaPanel
  extends JPanel
  implements ActionMap
{
  protected static final String RESOURCES = "org.apache.batik.util.gui.resources.CSSMediaPanel";
  protected static ResourceBundle bundle = ResourceBundle.getBundle("org.apache.batik.util.gui.resources.CSSMediaPanel", Locale.getDefault());
  protected static ResourceManager resources = new ResourceManager(bundle);
  protected JButton removeButton;
  protected JButton addButton;
  protected JButton clearButton;
  protected DefaultListModel listModel = new DefaultListModel();
  protected JList mediaList;
  protected Map listeners = new HashMap();
  
  public CSSMediaPanel()
  {
    super(new GridBagLayout());
    listeners.put("AddButtonAction", new AddButtonAction());
    listeners.put("RemoveButtonAction", new RemoveButtonAction());
    listeners.put("ClearButtonAction", new ClearButtonAction());
    setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), resources.getString("Panel.title")));
    ExtendedGridBagConstraints localExtendedGridBagConstraints = new ExtendedGridBagConstraints();
    insets = new Insets(5, 5, 5, 5);
    mediaList = new JList();
    mediaList.setSelectionMode(0);
    mediaList.setModel(listModel);
    mediaList.addListSelectionListener(new MediaListSelectionListener());
    listModel.addListDataListener(new MediaListDataListener());
    JScrollPane localJScrollPane = new JScrollPane();
    localJScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
    weightx = 1.0D;
    weighty = 1.0D;
    fill = 1;
    localExtendedGridBagConstraints.setGridBounds(0, 0, 1, 3);
    localJScrollPane.getViewport().add(mediaList);
    add(localJScrollPane, localExtendedGridBagConstraints);
    ButtonFactory localButtonFactory = new ButtonFactory(bundle, this);
    weightx = 0.0D;
    weighty = 0.0D;
    fill = 2;
    anchor = 11;
    addButton = localButtonFactory.createJButton("AddButton");
    localExtendedGridBagConstraints.setGridBounds(1, 0, 1, 1);
    add(addButton, localExtendedGridBagConstraints);
    removeButton = localButtonFactory.createJButton("RemoveButton");
    localExtendedGridBagConstraints.setGridBounds(1, 1, 1, 1);
    add(removeButton, localExtendedGridBagConstraints);
    clearButton = localButtonFactory.createJButton("ClearButton");
    localExtendedGridBagConstraints.setGridBounds(1, 2, 1, 1);
    add(clearButton, localExtendedGridBagConstraints);
    updateButtons();
  }
  
  protected void updateButtons()
  {
    removeButton.setEnabled(!mediaList.isSelectionEmpty());
    clearButton.setEnabled(!listModel.isEmpty());
  }
  
  public void setMedia(List paramList)
  {
    listModel.removeAllElements();
    Iterator localIterator = paramList.iterator();
    while (localIterator.hasNext()) {
      listModel.addElement(localIterator.next());
    }
  }
  
  public void setMedia(String paramString)
  {
    listModel.removeAllElements();
    StringTokenizer localStringTokenizer = new StringTokenizer(paramString, " ");
    while (localStringTokenizer.hasMoreTokens()) {
      listModel.addElement(localStringTokenizer.nextToken());
    }
  }
  
  public List getMedia()
  {
    ArrayList localArrayList = new ArrayList(listModel.size());
    Enumeration localEnumeration = listModel.elements();
    while (localEnumeration.hasMoreElements()) {
      localArrayList.add(localEnumeration.nextElement());
    }
    return localArrayList;
  }
  
  public String getMediaAsString()
  {
    StringBuffer localStringBuffer = new StringBuffer();
    Enumeration localEnumeration = listModel.elements();
    while (localEnumeration.hasMoreElements())
    {
      localStringBuffer.append((String)localEnumeration.nextElement());
      localStringBuffer.append(" ");
    }
    return localStringBuffer.toString();
  }
  
  public static int showDialog(Component paramComponent, String paramString)
  {
    return showDialog(paramComponent, paramString, "");
  }
  
  public static int showDialog(Component paramComponent, String paramString, List paramList)
  {
    Dialog localDialog = new Dialog(paramComponent, paramString, paramList);
    localDialog.setModal(true);
    localDialog.pack();
    localDialog.show();
    return localDialog.getReturnCode();
  }
  
  public static int showDialog(Component paramComponent, String paramString1, String paramString2)
  {
    Dialog localDialog = new Dialog(paramComponent, paramString1, paramString2);
    localDialog.setModal(true);
    localDialog.pack();
    localDialog.show();
    return localDialog.getReturnCode();
  }
  
  public Action getAction(String paramString)
    throws MissingListenerException
  {
    return (Action)listeners.get(paramString);
  }
  
  public static void main(String[] paramArrayOfString)
  {
    String str = "all aural braille embossed handheld print projection screen tty tv";
    int i = showDialog(null, "Test", str);
    System.out.println(i);
    System.exit(0);
  }
  
  protected class AddButtonAction
    extends AbstractAction
  {
    protected AddButtonAction() {}
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      CSSMediaPanel.AddMediumDialog localAddMediumDialog = new CSSMediaPanel.AddMediumDialog(CSSMediaPanel.this);
      localAddMediumDialog.pack();
      localAddMediumDialog.show();
      if ((localAddMediumDialog.getReturnCode() == 1) || (localAddMediumDialog.getMedium() == null)) {
        return;
      }
      String str1 = localAddMediumDialog.getMedium().trim();
      if ((str1.length() == 0) || (listModel.contains(str1))) {
        return;
      }
      for (int i = 0; (i < listModel.size()) && (str1 != null); i++)
      {
        String str2 = (String)listModel.getElementAt(i);
        int j = str1.compareTo(str2);
        if (j == 0)
        {
          str1 = null;
        }
        else if (j < 0)
        {
          listModel.insertElementAt(str1, i);
          str1 = null;
        }
      }
      if (str1 != null) {
        listModel.addElement(str1);
      }
    }
  }
  
  public static class AddMediumDialog
    extends JDialog
    implements ActionMap
  {
    public static final int OK_OPTION = 0;
    public static final int CANCEL_OPTION = 1;
    protected JComboBox medium;
    protected int returnCode;
    protected Map listeners = new HashMap();
    
    public AddMediumDialog(Component paramComponent)
    {
      super(CSSMediaPanel.resources.getString("AddMediumDialog.title"));
      setModal(true);
      listeners.put("OKButtonAction", new OKButtonAction());
      listeners.put("CancelButtonAction", new CancelButtonAction());
      getContentPane().add(createContentPanel(), "Center");
      getContentPane().add(createButtonsPanel(), "South");
    }
    
    public String getMedium()
    {
      return (String)medium.getSelectedItem();
    }
    
    protected Component createContentPanel()
    {
      JPanel localJPanel = new JPanel(new BorderLayout());
      localJPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
      localJPanel.add(new JLabel(CSSMediaPanel.resources.getString("AddMediumDialog.label")), "West");
      medium = new JComboBox();
      medium.setEditable(true);
      String str = CSSMediaPanel.resources.getString("Media.list");
      StringTokenizer localStringTokenizer = new StringTokenizer(str, " ");
      while (localStringTokenizer.hasMoreTokens()) {
        medium.addItem(localStringTokenizer.nextToken());
      }
      localJPanel.add(medium, "Center");
      return localJPanel;
    }
    
    protected Component createButtonsPanel()
    {
      JPanel localJPanel = new JPanel(new FlowLayout(2));
      ButtonFactory localButtonFactory = new ButtonFactory(CSSMediaPanel.bundle, this);
      localJPanel.add(localButtonFactory.createJButton("OKButton"));
      localJPanel.add(localButtonFactory.createJButton("CancelButton"));
      return localJPanel;
    }
    
    public int getReturnCode()
    {
      return returnCode;
    }
    
    public Action getAction(String paramString)
      throws MissingListenerException
    {
      return (Action)listeners.get(paramString);
    }
    
    protected class CancelButtonAction
      extends AbstractAction
    {
      protected CancelButtonAction() {}
      
      public void actionPerformed(ActionEvent paramActionEvent)
      {
        returnCode = 1;
        dispose();
      }
    }
    
    protected class OKButtonAction
      extends AbstractAction
    {
      protected OKButtonAction() {}
      
      public void actionPerformed(ActionEvent paramActionEvent)
      {
        returnCode = 0;
        dispose();
      }
    }
  }
  
  protected class ClearButtonAction
    extends AbstractAction
  {
    protected ClearButtonAction() {}
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      mediaList.clearSelection();
      listModel.removeAllElements();
    }
  }
  
  public static class Dialog
    extends JDialog
    implements ActionMap
  {
    public static final int OK_OPTION = 0;
    public static final int CANCEL_OPTION = 1;
    protected int returnCode;
    protected Map listeners = new HashMap();
    
    public Dialog()
    {
      this(null, "", "");
    }
    
    public Dialog(Component paramComponent, String paramString, List paramList)
    {
      super(paramString);
      listeners.put("OKButtonAction", new OKButtonAction());
      listeners.put("CancelButtonAction", new CancelButtonAction());
      CSSMediaPanel localCSSMediaPanel = new CSSMediaPanel();
      localCSSMediaPanel.setMedia(paramList);
      getContentPane().add(localCSSMediaPanel, "Center");
      getContentPane().add(createButtonsPanel(), "South");
    }
    
    public Dialog(Component paramComponent, String paramString1, String paramString2)
    {
      super(paramString1);
      listeners.put("OKButtonAction", new OKButtonAction());
      listeners.put("CancelButtonAction", new CancelButtonAction());
      CSSMediaPanel localCSSMediaPanel = new CSSMediaPanel();
      localCSSMediaPanel.setMedia(paramString2);
      getContentPane().add(localCSSMediaPanel, "Center");
      getContentPane().add(createButtonsPanel(), "South");
    }
    
    public int getReturnCode()
    {
      return returnCode;
    }
    
    protected JPanel createButtonsPanel()
    {
      JPanel localJPanel = new JPanel(new FlowLayout(2));
      ButtonFactory localButtonFactory = new ButtonFactory(CSSMediaPanel.bundle, this);
      localJPanel.add(localButtonFactory.createJButton("OKButton"));
      localJPanel.add(localButtonFactory.createJButton("CancelButton"));
      return localJPanel;
    }
    
    public Action getAction(String paramString)
      throws MissingListenerException
    {
      return (Action)listeners.get(paramString);
    }
    
    protected class CancelButtonAction
      extends AbstractAction
    {
      protected CancelButtonAction() {}
      
      public void actionPerformed(ActionEvent paramActionEvent)
      {
        returnCode = 1;
        dispose();
      }
    }
    
    protected class OKButtonAction
      extends AbstractAction
    {
      protected OKButtonAction() {}
      
      public void actionPerformed(ActionEvent paramActionEvent)
      {
        returnCode = 0;
        dispose();
      }
    }
  }
  
  protected class MediaListDataListener
    implements ListDataListener
  {
    protected MediaListDataListener() {}
    
    public void contentsChanged(ListDataEvent paramListDataEvent)
    {
      updateButtons();
    }
    
    public void intervalAdded(ListDataEvent paramListDataEvent)
    {
      updateButtons();
    }
    
    public void intervalRemoved(ListDataEvent paramListDataEvent)
    {
      updateButtons();
    }
  }
  
  protected class MediaListSelectionListener
    implements ListSelectionListener
  {
    protected MediaListSelectionListener() {}
    
    public void valueChanged(ListSelectionEvent paramListSelectionEvent)
    {
      updateButtons();
    }
  }
  
  protected class RemoveButtonAction
    extends AbstractAction
  {
    protected RemoveButtonAction() {}
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      int i = mediaList.getSelectedIndex();
      mediaList.clearSelection();
      if (i >= 0) {
        listModel.removeElementAt(i);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.CSSMediaPanel
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

class DOMViewer$1
  implements ItemListener
{
  private final DOMViewer this$0;
  
  DOMViewer$1(DOMViewer paramDOMViewer)
  {
    this$0 = paramDOMViewer;
  }
  
  public void itemStateChanged(ItemEvent paramItemEvent)
  {
    this$0.setShowWhitespace(paramItemEvent.getStateChange() == 1);
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.DOMViewer.1
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

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

public class DOMViewer$CloseButtonAction
  extends AbstractAction
{
  private final DOMViewer this$0;
  
  protected DOMViewer$CloseButtonAction(DOMViewer paramDOMViewer)
  {
    this$0 = paramDOMViewer;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    this$0.dispose();
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.DOMViewer.CloseButtonAction
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class DOMViewer$NodeInfo
{
  protected Node node;
  
  public DOMViewer$NodeInfo(Node paramNode)
  {
    node = paramNode;
  }
  
  public Node getNode()
  {
    return node;
  }
  
  public String toString()
  {
    if ((node instanceof Element))
    {
      String str = ((Element)node).getAttribute("id");
      if (str.length() != 0) {
        return node.getNodeName() + " \"" + str + "\"";
      }
    }
    return node.getNodeName();
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.DOMViewer.NodeInfo
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import java.awt.Component;
import java.awt.Container;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.text.JTextComponent;
import javax.swing.tree.DefaultMutableTreeNode;
import org.w3c.dom.Document;
import org.w3c.dom.Node;

public class DOMViewer$Panel$DOMTreeSelectionListener
  implements TreeSelectionListener
{
  private final DOMViewer.Panel this$1;
  
  protected DOMViewer$Panel$DOMTreeSelectionListener(DOMViewer.Panel paramPanel)
  {
    this$1 = paramPanel;
  }
  
  public void valueChanged(TreeSelectionEvent paramTreeSelectionEvent)
  {
    DefaultMutableTreeNode localDefaultMutableTreeNode = (DefaultMutableTreeNode)this$1.tree.getLastSelectedPathComponent();
    if (localDefaultMutableTreeNode == null) {
      return;
    }
    if (this$1.rightPanel.getComponentCount() != 0) {
      this$1.rightPanel.remove(0);
    }
    Object localObject = localDefaultMutableTreeNode.getUserObject();
    if ((localObject instanceof DOMViewer.NodeInfo))
    {
      Node localNode = ((DOMViewer.NodeInfo)localObject).getNode();
      switch (localNode.getNodeType())
      {
      case 9: 
        this$1.documentInfo.setText(createDocumentText((Document)localNode));
        this$1.rightPanel.add(this$1.documentInfoPanel);
        break;
      case 1: 
        this$1.attributesTable.setModel(new DOMViewer.Panel.NodeAttributesModel(this$1, localNode));
        this$1.propertiesTable.setModel(new DOMViewer.Panel.NodeCSSValuesModel(this$1, localNode));
        this$1.rightPanel.add(this$1.elementPanel);
        break;
      case 3: 
      case 4: 
      case 8: 
        this$1.characterData.setText(localNode.getNodeValue());
        this$1.rightPanel.add(this$1.characterDataPanel);
      }
    }
    this$1.splitPane.revalidate();
    this$1.splitPane.repaint();
  }
  
  protected String createDocumentText(Document paramDocument)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    localStringBuffer.append("Nodes: ");
    localStringBuffer.append(nodeCount(paramDocument));
    return localStringBuffer.toString();
  }
  
  protected int nodeCount(Node paramNode)
  {
    int i = 1;
    for (Node localNode = paramNode.getFirstChild(); localNode != null; localNode = localNode.getNextSibling()) {
      i += nodeCount(localNode);
    }
    return i;
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.DOMViewer.Panel.DOMTreeSelectionListener
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import javax.swing.table.AbstractTableModel;
import org.apache.batik.util.gui.resource.ResourceManager;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class DOMViewer$Panel$NodeAttributesModel
  extends AbstractTableModel
{
  protected Node node;
  private final DOMViewer.Panel this$1;
  
  public DOMViewer$Panel$NodeAttributesModel(DOMViewer.Panel paramPanel, Node paramNode)
  {
    this$1 = paramPanel;
    node = paramNode;
  }
  
  public String getColumnName(int paramInt)
  {
    if (paramInt == 0) {
      return DOMViewer.resources.getString("AttributesTable.column1");
    }
    return DOMViewer.resources.getString("AttributesTable.column2");
  }
  
  public int getColumnCount()
  {
    return 2;
  }
  
  public int getRowCount()
  {
    return node.getAttributes().getLength();
  }
  
  public boolean isCellEditable(int paramInt1, int paramInt2)
  {
    return false;
  }
  
  public Object getValueAt(int paramInt1, int paramInt2)
  {
    NamedNodeMap localNamedNodeMap = node.getAttributes();
    Node localNode = localNamedNodeMap.item(paramInt1);
    if (paramInt2 == 0) {
      return localNode.getNodeName();
    }
    return localNode.getNodeValue();
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.DOMViewer.Panel.NodeAttributesModel
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import org.apache.batik.util.gui.resource.ResourceManager;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.css.CSSStyleDeclaration;
import org.w3c.dom.css.ViewCSS;

public class DOMViewer$Panel$NodeCSSValuesModel
  extends AbstractTableModel
{
  protected Node node;
  protected CSSStyleDeclaration style;
  protected List propertyNames;
  private final DOMViewer.Panel this$1;
  
  public DOMViewer$Panel$NodeCSSValuesModel(DOMViewer.Panel paramPanel, Node paramNode)
  {
    this$1 = paramPanel;
    node = paramNode;
    if (viewCSS != null)
    {
      style = viewCSS.getComputedStyle((Element)paramNode, null);
      propertyNames = new ArrayList();
      if (style != null)
      {
        for (int i = 0; i < style.getLength(); i++) {
          propertyNames.add(style.item(i));
        }
        Collections.sort(propertyNames);
      }
    }
  }
  
  public String getColumnName(int paramInt)
  {
    if (paramInt == 0) {
      return DOMViewer.resources.getString("CSSValuesTable.column1");
    }
    return DOMViewer.resources.getString("CSSValuesTable.column2");
  }
  
  public int getColumnCount()
  {
    return 2;
  }
  
  public int getRowCount()
  {
    if (style == null) {
      return 0;
    }
    return style.getLength();
  }
  
  public boolean isCellEditable(int paramInt1, int paramInt2)
  {
    return false;
  }
  
  public Object getValueAt(int paramInt1, int paramInt2)
  {
    String str = (String)propertyNames.get(paramInt1);
    if (paramInt2 == 0) {
      return str;
    }
    return style.getPropertyValue(str);
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.DOMViewer.Panel.NodeCSSValuesModel
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import java.awt.Component;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import org.apache.batik.util.gui.resource.ResourceManager;
import org.w3c.dom.Node;

public class DOMViewer$Panel$NodeRenderer
  extends DefaultTreeCellRenderer
{
  ImageIcon elementIcon;
  ImageIcon commentIcon;
  ImageIcon piIcon;
  ImageIcon textIcon;
  private final DOMViewer.Panel this$1;
  
  public DOMViewer$Panel$NodeRenderer(DOMViewer.Panel paramPanel)
  {
    this$1 = paramPanel;
    String str = DOMViewer.resources.getString("Element.icon");
    elementIcon = new ImageIcon(getClass().getResource(str));
    str = DOMViewer.resources.getString("Comment.icon");
    commentIcon = new ImageIcon(getClass().getResource(str));
    str = DOMViewer.resources.getString("PI.icon");
    piIcon = new ImageIcon(getClass().getResource(str));
    str = DOMViewer.resources.getString("Text.icon");
    textIcon = new ImageIcon(getClass().getResource(str));
  }
  
  public Component getTreeCellRendererComponent(JTree paramJTree, Object paramObject, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3, int paramInt, boolean paramBoolean4)
  {
    super.getTreeCellRendererComponent(paramJTree, paramObject, paramBoolean1, paramBoolean2, paramBoolean3, paramInt, paramBoolean4);
    switch (getNodeType(paramObject))
    {
    case 1: 
      setIcon(elementIcon);
      break;
    case 8: 
      setIcon(commentIcon);
      break;
    case 7: 
      setIcon(piIcon);
      break;
    case 3: 
    case 4: 
      setIcon(textIcon);
    }
    return this;
  }
  
  protected short getNodeType(Object paramObject)
  {
    DefaultMutableTreeNode localDefaultMutableTreeNode = (DefaultMutableTreeNode)paramObject;
    Object localObject = localDefaultMutableTreeNode.getUserObject();
    if ((localObject instanceof DOMViewer.NodeInfo))
    {
      Node localNode = ((DOMViewer.NodeInfo)localObject).getNode();
      return localNode.getNodeType();
    }
    return -1;
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.util.gui.DOMViewer.Panel.NodeRenderer
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.util.gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.GridLayout;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.text.JTextComponent;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreeNode;
import org.apache.batik.util.gui.resource.ResourceManager;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
import org.w3c.dom.css.CSSStyleDeclaration;
import org.w3c.dom.css.ViewCSS;

public class DOMViewer$Panel
  extends JPanel
{
  protected Document document;
  protected ViewCSS viewCSS;
  protected JTree tree;
  protected JSplitPane splitPane;
  protected JPanel rightPanel;
  protected JTable attributesTable;
  protected JTable propertiesTable;
  protected JPanel elementPanel;
  protected JTextArea characterData;
  protected JPanel characterDataPanel;
  protected JTextArea documentInfo;
  protected JPanel documentInfoPanel;
  private final DOMViewer this$0;
  
  public DOMViewer$Panel(DOMViewer paramDOMViewer)
  {
    super(new BorderLayout());
    this$0 = paramDOMViewer;
    rightPanel = new JPanel(new BorderLayout());
    attributesTable = new JTable();
    propertiesTable = new JTable();
    elementPanel = new JPanel(new GridLayout(2, 1));
    Object localObject = new JScrollPane();
    ((JComponent)localObject).setBorder(BorderFactory.createCompoundBorder(BorderFact
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