Skip to content

Commit

Permalink
#4 Retire the legacy 3rd party XMLTreeTable
Browse files Browse the repository at this point in the history
  • Loading branch information
amosshi committed Sep 22, 2019
1 parent 0236e37 commit 5f340a3
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 753 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static String getByteText(final byte b) {
}

/**
* Escape HTML special character &gt and &lt.
* Escape HTML special character < and >.
*
* @param text Input text to process
* @return Escaped result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,13 @@
package org.freeinternals.commonlib.ui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.PrintStream;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.freeinternals.commonlib.core.PosDataInputStream;
import org.freeinternals.commonlib.ui.xmltree.XMLTreeTable;
import org.freeinternals.commonlib.ui.xmltree.XMLTreeTableModel;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

/**
* Panel based XML data viewer.
Expand All @@ -50,35 +39,6 @@ public class JXMLViewer extends JPanel {
*/
public JXMLViewer(final InputStream xml) {
this.tabbedPane = new JTabbedPane();

try {
XMLTreeTable treeTable = new XMLTreeTable(new XMLTreeTableModel(new InputSource(xml)));
this.tabbedPane.addTab("XML View", new JScrollPaneTreeTable(treeTable));
} catch (ParserConfigurationException | SAXException | TransformerException ex) {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());

// The title
JLabel label = new JLabel("Exception occured when parsing the XML data.");
label.setFont(new Font(Font.DIALOG, Font.BOLD, FONT_SIZE));
label.setForeground(Color.red);
panel.add(label, BorderLayout.NORTH);

// The exception
ByteArrayOutputStream output = new ByteArrayOutputStream();
ex.printStackTrace(new PrintStream(output));

JTextArea textException = new JTextArea();
textException.setLineWrap(true);
textException.setEditable(false);
textException.setText(output.toString());

panel.add(new JScrollPane(textException), BorderLayout.CENTER);

//
this.tabbedPane.addTab("XML View", panel);
}

if (xml instanceof PosDataInputStream) {
byte[] buf = ((PosDataInputStream) xml).getBuf();
StringBuilder sb = new StringBuilder(buf.length + 1);
Expand All @@ -95,18 +55,4 @@ public JXMLViewer(final InputStream xml) {
this.setLayout(new BorderLayout());
this.add(this.tabbedPane, BorderLayout.CENTER);
}

@SuppressWarnings("PackageVisibleInnerClass")
final class JScrollPaneTreeTable extends JScrollPane {

private static final long serialVersionUID = 4876543219876500005L;

private JScrollPaneTreeTable(final Component component) {
super(component);
}

@Override
public void setColumnHeaderView(final Component view) {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ public void resetRowSelection() {
/**
* Creates and returns an instance of ListSelectionHandler.
*
* @return {@link #ListSelectionHandler}
* @return {@link ListSelectionHandler}
*/
protected final ListSelectionListener createListSelectionListener() {
return new ListSelectionHandler();
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 5f340a3

Please sign in to comment.