diff --git a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/GenerateTreeNode.java b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/GenerateTreeNode.java index 729328a..9e79433 100644 --- a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/GenerateTreeNode.java +++ b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/GenerateTreeNode.java @@ -4,17 +4,22 @@ * Copyright 2010, FreeInternals.org. All rights reserved. * Use is subject to license terms. */ - package org.freeinternals.commonlib.ui; import javax.swing.tree.DefaultMutableTreeNode; /** + * Interface for generating children tree nodes. * * @author Amos Shi */ public interface GenerateTreeNode { - void generateTreeNode(final DefaultMutableTreeNode parentNode); + /** + * Generate children nodes for current file component. + * + * @param parentNode Parent tree node + */ + void generateTreeNode(DefaultMutableTreeNode parentNode); } diff --git a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/JPanelForTree.java b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/JPanelForTree.java index 774a4f9..09b18c6 100644 --- a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/JPanelForTree.java +++ b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/JPanelForTree.java @@ -30,40 +30,65 @@ * * @author Amos Shi */ -public class JPanelForTree extends JPanel { +public final class JPanelForTree extends JPanel { private static final long serialVersionUID = 4876543219876500000L; + /** + * Default editor size. + */ + private static final Dimension EDITOR_DEFAULT_SIZE = new Dimension(100, 120); + /** + * Top level window. + */ private final JFrame topLevelFrame; - private JPanel details_panel; - private String details_title; - public final JTree tree; - public final JToolBar toolbar; - public final JButton toolbarbtn_Details; + /** + * Details panel. + */ + private JPanel detailsPanel; + /** + * Title for details pane. + */ + private String detailsTitle; + /** + * Tree component for the file components. + */ + private final JTree tree; + /** + * Toolbar on the tree. + */ + private final JToolBar toolbar; + /** + * Toolbar button for details. + */ + private final JButton toolbarbtnDetails; + /** + * Editor pane at the right. + */ private JEditorPane editorPaneDescription; /** * Create a panel tool bar to contain a {@code JTree} object. * - * @param tree The tree to be contained - * @param frame + * @param jTree The tree to be contained + * @param frame The parent window */ - public JPanelForTree(final JTree tree, final JFrame frame) { - if (tree == null) { + public JPanelForTree(final JTree jTree, final JFrame frame) { + if (jTree == null) { throw new IllegalArgumentException("[tree] cannot be null."); } - this.tree = tree; + this.tree = jTree; this.topLevelFrame = frame; this.tree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(final javax.swing.event.TreeSelectionEvent evt) { - tree_SelectionChanged(evt); + treeSelectionChanged(evt); } }); this.toolbar = new JToolBar(); - this.toolbarbtn_Details = new JButton("Details"); + this.toolbarbtnDetails = new JButton("Details"); this.initToolbar(); this.layoutComponents(); @@ -72,26 +97,26 @@ public void valueChanged(final javax.swing.event.TreeSelectionEvent evt) { private void layoutComponents() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - final JPanel panel_Toolbar = new JPanel(); - panel_Toolbar.setLayout(new BoxLayout(panel_Toolbar, BoxLayout.X_AXIS)); - panel_Toolbar.add(this.toolbar); + final JPanel panelToolbar = new JPanel(); + panelToolbar.setLayout(new BoxLayout(panelToolbar, BoxLayout.X_AXIS)); + panelToolbar.add(this.toolbar); final Component glue = Box.createGlue(); glue.setMaximumSize(new Dimension(Short.MAX_VALUE, this.toolbar.getHeight())); - panel_Toolbar.add(glue); + panelToolbar.add(glue); - final JPanel panel_toolbar_tree = new JPanel(); - panel_toolbar_tree.setLayout(new BoxLayout(panel_toolbar_tree, BoxLayout.Y_AXIS)); - panel_toolbar_tree.add(panel_Toolbar); - panel_toolbar_tree.add(new JScrollPane(this.tree)); + final JPanel panelToolbarTree = new JPanel(); + panelToolbarTree.setLayout(new BoxLayout(panelToolbarTree, BoxLayout.Y_AXIS)); + panelToolbarTree.add(panelToolbar); + panelToolbarTree.add(new JScrollPane(this.tree)); this.editorPaneDescription = new JEditorPane(); this.editorPaneDescription.setContentType("text/html"); this.editorPaneDescription.setEditable(false); - this.editorPaneDescription.setPreferredSize(new Dimension(100, 120)); + this.editorPaneDescription.setPreferredSize(EDITOR_DEFAULT_SIZE); final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); - splitPane.setTopComponent(panel_toolbar_tree); + splitPane.setTopComponent(panelToolbarTree); splitPane.setBottomComponent(new JScrollPane(this.editorPaneDescription)); splitPane.setResizeWeight(1.0); this.add(splitPane, BorderLayout.CENTER); @@ -107,7 +132,7 @@ private void initToolbar() { @Override public void actionPerformed(final ActionEvent e) { - toolbar_ExpandAll(); + toolbarExpandAll(); } }); this.toolbar.add(buttonExpandAll); @@ -118,27 +143,27 @@ public void actionPerformed(final ActionEvent e) { @Override public void actionPerformed(final ActionEvent e) { - toolbar_CollapseAll(); + toolbarCollapseAll(); } }); this.toolbar.add(buttonCollapseAll); // Button: Details - this.toolbarbtn_Details.setVisible(false); - this.toolbarbtn_Details.addActionListener(new ActionListener() { + this.toolbarbtnDetails.setVisible(false); + this.toolbarbtnDetails.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - toolbar_ShowDetails(); + public void actionPerformed(final ActionEvent e) { + toolbarShowDetails(); } }); //this.toolbar.addSeparator(); - this.toolbar.add(this.toolbarbtn_Details); + this.toolbar.add(this.toolbarbtnDetails); // Button: Find //this.toolbar.add(new JButton("Find")); } - private void toolbar_ExpandAll() { + private void toolbarExpandAll() { if (this.tree == null) { return; } @@ -154,7 +179,7 @@ private void toolbar_ExpandAll() { } while (now > old); } - private void toolbar_CollapseAll() { + private void toolbarCollapseAll() { if (this.tree == null) { return; } @@ -162,16 +187,16 @@ private void toolbar_CollapseAll() { this.tree.collapseRow(0); } - private void toolbar_ShowDetails() { - UITool.showPopup(this.topLevelFrame, this.details_panel, this.details_title); + private void toolbarShowDetails() { + UITool.showPopup(this.topLevelFrame, this.detailsPanel, this.detailsTitle); } - private void tree_SelectionChanged(final TreeSelectionEvent e) { + private void treeSelectionChanged(final TreeSelectionEvent e) { this.editorPaneDescription.setText(""); - this.toolbarbtn_Details.setVisible(false); - this.details_panel = null; - this.details_title = null; + this.toolbarbtnDetails.setVisible(false); + this.detailsPanel = null; + this.detailsTitle = null; Object obj = e.getPath().getLastPathComponent(); if (obj instanceof DefaultMutableTreeNode) { @@ -184,9 +209,9 @@ private void tree_SelectionChanged(final TreeSelectionEvent e) { this.editorPaneDescription.setText(s); } if (fileComp.isDetailAvailable()) { - this.toolbarbtn_Details.setVisible(true); - this.details_panel = fileComp.getDetailPanel(); - this.details_title = fileComp.getText(); + this.toolbarbtnDetails.setVisible(true); + this.detailsPanel = fileComp.getDetailPanel(); + this.detailsTitle = fileComp.getText(); } } } diff --git a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/JXMLViewer.java b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/JXMLViewer.java index 047e18b..9c47003 100644 --- a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/JXMLViewer.java +++ b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/JXMLViewer.java @@ -18,10 +18,13 @@ 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; /** * @@ -38,9 +41,7 @@ public JXMLViewer(InputStream xml){ try { XMLTreeTable treeTable = new XMLTreeTable(new XMLTreeTableModel(new InputSource(xml))); this.tabbedPane.addTab("XML View", new JScrollPaneTreeTable(treeTable)); - } catch (Exception ex) { - //Logger.getLogger(JXMLViewer.class.getName()).log(Level.SEVERE, null, ex); - + } catch (ParserConfigurationException | SAXException | TransformerException ex) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); @@ -83,16 +84,16 @@ public JXMLViewer(InputStream xml){ } @SuppressWarnings("PackageVisibleInnerClass") - class JScrollPaneTreeTable extends JScrollPane { + final class JScrollPaneTreeTable extends JScrollPane { private static final long serialVersionUID = 4876543219876500005L; - private JScrollPaneTreeTable(Component component) { + private JScrollPaneTreeTable(final Component component) { super(component); } @Override - public void setColumnHeaderView(Component view) { + public void setColumnHeaderView(final Component view) { } } } diff --git a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/TableColumnResizer.java b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/TableColumnResizer.java index 6de7d33..9d78dcf 100644 --- a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/TableColumnResizer.java +++ b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/TableColumnResizer.java @@ -16,38 +16,59 @@ * Allows table columns to be resized not only using the header but from any * rows. Based on the BasicTableHeaderUI.MouseInputHandler code. * - *
- * A little change may be done on formatting, annotation, java doc, etc. - *
- * + * Created bySanthosh Kumar T
. Miner change may be done on
+ * formatting, annotation, java doc, etc, for check style.
+ *
* @author Santhosh Kumar T - santhosh@in.fiorano.com
* @see javax.swing.plaf.basic.BasicTableHeaderUI.MouseInputHandler
- * @see XML Viewer for Swing
+ * @see XML Viewer
+ * for Swing
*/
-public class TableColumnResizer extends MouseInputAdapter {
-
- public static final Cursor resizeCursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
+public final class TableColumnResizer extends MouseInputAdapter {
+
+ /**
+ * Mouse cursor for resize.
+ */
+ public static final Cursor RESIZE_CURSOR = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
+ /**
+ * Constant value -3.
+ */
+ private static final int MINUS_3 = -3;
+ /**
+ * Mouse X offset.
+ */
private int mouseXOffset;
- private Cursor otherCursor = resizeCursor;
- private JTable table;
-
- public TableColumnResizer(JTable table) {
- this.table = table;
+ /**
+ * Mouse cursor for others.
+ */
+ private Cursor otherCursor = RESIZE_CURSOR;
+ /**
+ * Swing table.
+ */
+ private final JTable table;
+
+ /**
+ * Constructor.
+ *
+ * @param t Swing table
+ */
+ public TableColumnResizer(final JTable t) {
+ this.table = t;
table.addMouseListener(this);
table.addMouseMotionListener(this);
}
- private boolean canResize(TableColumn column) {
+ private boolean canResize(final TableColumn column) {
return column != null
&& table.getTableHeader().getResizingAllowed()
&& column.getResizable();
}
- private TableColumn getResizingColumn(Point p) {
+ private TableColumn getResizingColumn(final Point p) {
return getResizingColumn(p, table.columnAtPoint(p));
}
- private TableColumn getResizingColumn(Point p, int column) {
+ private TableColumn getResizingColumn(final Point p, final int column) {
if (column == -1) {
return null;
}
@@ -56,7 +77,7 @@ private TableColumn getResizingColumn(Point p, int column) {
return null;
}
Rectangle r = table.getCellRect(row, column, true);
- r.grow(-3, 0);
+ r.grow(MINUS_3, 0);
if (r.contains(p)) {
return null;
}
@@ -76,7 +97,7 @@ private TableColumn getResizingColumn(Point p, int column) {
}
@Override
- public void mousePressed(MouseEvent e) {
+ public void mousePressed(final MouseEvent e) {
table.getTableHeader().setDraggedColumn(null);
table.getTableHeader().setResizingColumn(null);
table.getTableHeader().setDraggedDistance(0);
@@ -110,21 +131,21 @@ private void swapCursor() {
}
@Override
- public void mouseMoved(MouseEvent e) {
+ public void mouseMoved(final MouseEvent e) {
if (canResize(getResizingColumn(e.getPoint()))
- != (table.getCursor() == resizeCursor)) {
+ != (table.getCursor() == RESIZE_CURSOR)) {
swapCursor();
}
}
@Override
- public void mouseDragged(MouseEvent e) {
+ public void mouseDragged(final MouseEvent e) {
int mouseX = e.getX();
TableColumn resizingColumn = table.getTableHeader().getResizingColumn();
- boolean headerLeftToRight =
- table.getTableHeader().getComponentOrientation().isLeftToRight();
+ boolean headerLeftToRight
+ = table.getTableHeader().getComponentOrientation().isLeftToRight();
if (resizingColumn != null) {
int oldWidth = resizingColumn.getWidth();
@@ -136,9 +157,9 @@ public void mouseDragged(MouseEvent e) {
}
resizingColumn.setWidth(newWidth);
- Container container;
+ Container container = table.getTableHeader().getParent().getParent();
if ((table.getTableHeader().getParent() == null)
- || ((container = table.getTableHeader().getParent().getParent()) == null)
+ || (container == null)
|| !(container instanceof JScrollPane)) {
return;
}
@@ -163,8 +184,8 @@ public void mouseDragged(MouseEvent e) {
if ((newHeaderWidth >= viewportWidth)
&& (table.getAutoResizeMode() == JTable.AUTO_RESIZE_OFF)) {
Point p = viewport.getViewPosition();
- p.x =
- Math.max(0, Math.min(newHeaderWidth - viewportWidth, p.x + diff));
+ p.x
+ = Math.max(0, Math.min(newHeaderWidth - viewportWidth, p.x + diff));
viewport.setViewPosition(p);
/* Update the original X offset value. */
@@ -176,7 +197,7 @@ public void mouseDragged(MouseEvent e) {
}
@Override
- public void mouseReleased(MouseEvent e) {
+ public void mouseReleased(final MouseEvent e) {
table.getTableHeader().setResizingColumn(null);
table.getTableHeader().setDraggedColumn(null);
}
diff --git a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTable.java b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTable.java
index ded64cc..7e55392 100644
--- a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTable.java
+++ b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTable.java
@@ -9,33 +9,37 @@
import org.freeinternals.commonlib.ui.jtreetable.TreeTableModel;
/**
- * There are some issues in JTreeTable from Sun's Article.
- * To fix them, I sub-classed it.
- *
- *
- * A little change may be done on formatting, annotation, java doc, etc.
- * The class name is XMLTreeTable
originally in the link bellow.
- *
Santhosh Kumar T
. Miner change may be done on
+ * formatting, annotation, java doc, etc, for check style.
*
* @author Santhosh Kumar T - santhosh@in.fiorano.com
- * @see XML Viewer for Swing
+ * @see XML Viewer
+ * for Swing
*/
-public class XMLTreeTable extends JTreeTable {
+public final class XMLTreeTable extends JTreeTable {
private static final long serialVersionUID = 4876543219876500005L;
+ /**
+ * Constructor.
+ *
+ * @param treeTableModel Tree Table Model
+ */
@SuppressWarnings("ResultOfObjectAllocationIgnored")
- public XMLTreeTable(TreeTableModel treeTableModel) {
+ public XMLTreeTable(final TreeTableModel treeTableModel) {
super(treeTableModel);
setShowGrid(true);
- setGridColor(new Color(234, 234, 234));
+ setGridColor(Color.BLUE);
setIntercellSpacing(new Dimension(1, 1));
new TableColumnResizer(this);
this.initTree();
}
- private void initTree(){
+ private void initTree() {
if (super.tree == null) {
return;
}
@@ -56,7 +60,7 @@ private void initTree(){
}
@Override
- public boolean editCellAt(int row, int column, EventObject e) {
+ public boolean editCellAt(final int row, final int column, final EventObject e) {
if (e instanceof MouseEvent) {
MouseEvent me = (MouseEvent) e;
// If the modifiers are not 0 (or the left mouse button),
@@ -86,7 +90,9 @@ public boolean editCellAt(int row, int column, EventObject e) {
}
/**
- * Override to make the height of scroll match viewpost height if smaller.
+ * Override to make the height of scroll match view post height if smaller.
+ *
+ * @return boolean
*/
@Override
public boolean getScrollableTracksViewportHeight() {
@@ -95,13 +101,15 @@ public boolean getScrollableTracksViewportHeight() {
/**
* Mouse press intended for resize shouldn't change row/col/cell selection.
- * @param row
- * @param column
+ *
+ * @param row row
+ * @param column column
+ * @param toggle toggle
+ * @param extend extend
*/
- //
@Override
- public void changeSelection(int row, int column, boolean toggle, boolean extend) {
- if(getCursor()==TableColumnResizer.resizeCursor) {
+ public void changeSelection(final int row, final int column, final boolean toggle, final boolean extend) {
+ if (getCursor() == TableColumnResizer.RESIZE_CURSOR) {
return;
}
super.changeSelection(row, column, toggle, extend);
diff --git a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTableCellRenderer.java b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTableCellRenderer.java
index 49c11a1..034b7cf 100644
--- a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTableCellRenderer.java
+++ b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTableCellRenderer.java
@@ -8,7 +8,7 @@
import org.w3c.dom.Node;
/**
- *
+ *
* * A little change may be done on formatting, annotation, java doc, etc. *
@@ -17,12 +17,17 @@ * @see javax.swing.plaf.basic.BasicTableHeaderUI.MouseInputHandler * @see XML Viewer for Swing */ -public class XMLTreeTableCellRenderer extends DefaultTreeCellRenderer { +public final class XMLTreeTableCellRenderer extends DefaultTreeCellRenderer { private static final long serialVersionUID = 4876543219876500005L; - Color elementColor = new Color(0, 0, 128); - Color attributeColor = new Color(0, 128, 0); + /** Color for element. */ + private final Color elementColor = Color.BLUE; + /** Color for attribute. */ + private final Color attributeColor = Color.GREEN; + /** + * Constructor. + */ public XMLTreeTableCellRenderer() { this.setOpenIcon(null); this.setClosedIcon(null); @@ -30,29 +35,30 @@ public XMLTreeTableCellRenderer() { } @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { + public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { + Object newValue; Node node = (Node) value; switch (node.getNodeType()) { case Node.ELEMENT_NODE: - value = '<' + node.getNodeName() + '>'; + newValue = '<' + node.getNodeName() + '>'; break; case Node.ATTRIBUTE_NODE: - value = '@' + node.getNodeName(); + newValue = '@' + node.getNodeName(); break; case Node.TEXT_NODE: - value = "# text"; + newValue = "# text"; break; case Node.COMMENT_NODE: - value = "# comment"; + newValue = "# comment"; break; case Node.DOCUMENT_TYPE_NODE: DocumentType dtype = (DocumentType) node; - value = "# doctype"; + newValue = "# doctype"; break; default: - value = node.getNodeName(); + newValue = node.getNodeName(); } - super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); + super.getTreeCellRendererComponent(tree, newValue, sel, expanded, leaf, row, hasFocus); if (!selected) { switch (node.getNodeType()) { case Node.ELEMENT_NODE: @@ -61,6 +67,8 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean case Node.ATTRIBUTE_NODE: setForeground(attributeColor); break; + default: + break; } } return this; diff --git a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTableModel.java b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTableModel.java index 23ff070..3b9e213 100644 --- a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTableModel.java +++ b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTreeTableModel.java @@ -18,26 +18,45 @@ * * * @author Santhosh Kumar T - santhosh@in.fiorano.com - * @see XML Viewer for Swing + * @see XML Viewer + * for Swing */ -public class XMLTreeTableModel implements TreeTableModel { +public final class XMLTreeTableModel implements TreeTableModel { + /** + * DOM Node. + */ private Node node; - public XMLTreeTableModel(InputSource is) - throws ParserConfigurationException, SAXException, TransformerConfigurationException, TransformerException { + /** + * Constructor. + * + * @param is Input Source + * @throws ParserConfigurationException Error + * @throws SAXException Error + * @throws TransformerConfigurationException Error + * @throws TransformerException Error + */ + public XMLTreeTableModel(final InputSource is) throws ParserConfigurationException, SAXException, TransformerConfigurationException, TransformerException { this(DOMUtil.createDocument(is).getDocumentElement()); } - public XMLTreeTableModel(Node node) { - this.node = node; + /** + * Constructor. + * + * @param n Value for {@link #node} + */ + public XMLTreeTableModel(final Node n) { + this.node = n; } + @Override public Object getRoot() { return node; } - public Object getChild(Object parent, int index) { + @Override + public Object getChild(final Object parent, final int index) { Node n = (Node) parent; NamedNodeMap attrs = n.getAttributes(); int attrCount = attrs != null ? attrs.getLength() : 0; @@ -48,7 +67,8 @@ public Object getChild(Object parent, int index) { return children.item(index - attrCount); } - public int getChildCount(Object parent) { + @Override + public int getChildCount(final Object parent) { Node n = (Node) parent; NamedNodeMap attrs = n.getAttributes(); int attrCount = attrs != null ? attrs.getLength() : 0; @@ -61,11 +81,13 @@ public int getChildCount(Object parent) { } } - public boolean isLeaf(Object node) { - return getChildCount(node) == 0; + @Override + public boolean isLeaf(final Object nodeObject) { + return getChildCount(nodeObject) == 0; } - public int getIndexOfChild(Object parent, Object child) { + @Override + public int getIndexOfChild(final Object parent, final Object child) { Node n = (Node) parent; Node childNode = (Node) child; @@ -89,35 +111,42 @@ public int getIndexOfChild(Object parent, Object child) { throw new RuntimeException("this should never happen!"); } - public void addTreeModelListener(TreeModelListener listener) { + @Override + public void addTreeModelListener(final TreeModelListener listener) { // not editable } - public void removeTreeModelListener(TreeModelListener listener) { + @Override + public void removeTreeModelListener(final TreeModelListener listener) { // not editable } - public void valueForPathChanged(TreePath path, Object newValue) { + @Override + public void valueForPathChanged(final TreePath path, final Object newValue) { // not editable } + @Override public int getColumnCount() { return 2; } - public String getColumnName(int column) { + @Override + public String getColumnName(final int column) { return column == 0 ? "Node" : "Value"; } - public Class getColumnClass(int column) { + @Override + public Class getColumnClass(final int column) { return column == 0 ? TreeTableModel.class : String.class; } - public Object getValueAt(Object node, int column) { + @Override + public Object getValueAt(final Object nodeObject, final int column) { if (column == 0) { - return node; + return nodeObject; } else { - Node n = (Node) node; + Node n = (Node) nodeObject; if (n.getNodeType() == Node.ELEMENT_NODE) { NodeList children = n.getChildNodes(); int childCount = children != null ? children.getLength() : 0; @@ -129,11 +158,13 @@ public Object getValueAt(Object node, int column) { } } - public boolean isCellEditable(Object node, int column) { + @Override + public boolean isCellEditable(final Object nodeObject, final int column) { return false; } - public void setValueAt(Object aValue, Object node, int column) { + @Override + public void setValueAt(final Object aValue, final Object nodeObject, final int column) { // not editable } } diff --git a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTrimFilter.java b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTrimFilter.java index b4d3cd2..b74edb1 100644 --- a/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTrimFilter.java +++ b/CommonLib/src/main/java/org/freeinternals/commonlib/ui/xmltree/XMLTrimFilter.java @@ -7,9 +7,8 @@ import org.xml.sax.helpers.XMLFilterImpl; /** - *- * A little change may be done on formatting, annotation, java doc, etc. - *
+ * Created bySanthosh Kumar T
. Miner change may be done on
+ * formatting, annotation, java doc, etc, for check style.
*
* @author Santhosh Kumar T - santhosh@in.fiorano.com
* @see XML Viewer