Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/com/generationjava/io/xml/EmptyElementXmlWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public class EmptyElementXmlWriter extends DelegatingXmlWriter {
*/
public static final Object EMPTY_MODE = new Object();

private StringBuffer attrs; // current attribute string
private boolean empty; // is the current node empty
private boolean closed; // is the current node closed...
// private StringBuffer attrs; // current attribute string
// private boolean empty; // is the current node empty
// private boolean closed; // is the current node closed...

private Object emptyMode; // the strategy to use for emptiness

Expand Down
8 changes: 4 additions & 4 deletions src/com/generationjava/io/xml/SimpleXmlWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
public class SimpleXmlWriter extends AbstractXmlWriter {

private Writer writer; // underlying writer
private Stack stack; // of xml entity names
private Stack<String> stack; // of xml entity names
private StringBuffer attrs; // current attribute string
private boolean empty; // is the current node empty
private boolean closed; // is the current node closed...
Expand All @@ -61,7 +61,7 @@ public class SimpleXmlWriter extends AbstractXmlWriter {
public SimpleXmlWriter(Writer writer) {
this.writer = writer;
this.closed = true;
this.stack = new Stack();
this.stack = new Stack<String>();
}

/**
Expand Down Expand Up @@ -121,7 +121,7 @@ public XmlWriter writeEntity(String name) throws IOException {
* @param String name of entity.
*/
private SimpleXmlWriter openEntity(String name) throws IOException {
boolean wasClosed = this.closed;
// boolean wasClosed = this.closed;
closeOpeningTag();
this.closed = false;
this.writer.write("<");
Expand Down Expand Up @@ -161,7 +161,7 @@ private void writeAttributes() throws IOException {
public XmlWriter writeAttribute(String attr, Object value) throws IOException {

// maintain api
if (false) throw new IOException();
// if (false) throw new IOException();

if (this.attrs == null) {
this.attrs = new StringBuffer();
Expand Down
4 changes: 2 additions & 2 deletions src/com/generationjava/io/xml/XmlEncXmlWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public XmlWriter writeEntity(String name) throws IOException {
* @param String name of entity.
*/
private XmlWriter openEntity(String name) throws IOException {
boolean wasClosed = this.closed;
// boolean wasClosed = this.closed;
closeOpeningTag();
this.closed = false;
this.xmlenc.startTag(name);
Expand Down Expand Up @@ -137,7 +137,7 @@ private void closeOpeningTag() throws IOException {
public XmlWriter writeAttribute(String attr, Object value) throws IOException {

// maintain api
if (false) throw new IOException();
// if (false) throw new IOException();

this.xmlenc.attribute(attr, ""+value);
return this;
Expand Down
2 changes: 1 addition & 1 deletion src/com/generationjava/io/xml/XmlUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static String unescapeXml(String str) {
public static String removeXml(String str) {
int sz = str.length();
StringBuffer buffer = new StringBuffer(sz);
boolean inString = false;
// boolean inString = false;
boolean inTag = false;
for(int i=0; i<sz; i++) {
char ch = str.charAt(i);
Expand Down
8 changes: 5 additions & 3 deletions src/dfEditor/CustomComponents/DefaultListCellEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
import java.awt.*;

// @author Santhosh Kumar T - santhosh@in.fiorano.com
public class DefaultListCellEditor extends DefaultCellEditor implements ListCellEditor{
public class DefaultListCellEditor<T> extends DefaultCellEditor implements ListCellEditor<T> {
private static final long serialVersionUID = -1814870371135163156L;

public DefaultListCellEditor(final JCheckBox checkBox){
super(checkBox);
}

public DefaultListCellEditor(final JComboBox comboBox){
public DefaultListCellEditor(final JComboBox<T> comboBox){
super(comboBox);
}

public DefaultListCellEditor(final JTextField textField){
super(textField);
}

public Component getListCellEditorComponent(JList list, Object value, boolean isSelected, int index){
public Component getListCellEditorComponent(JList<T> list, Object value, boolean isSelected, int index){
delegate.setValue(value);
return editorComponent;
}
Expand Down
20 changes: 11 additions & 9 deletions src/dfEditor/CustomComponents/DefaultMutableListModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@


// @author Santhosh Kumar T - santhosh@in.fiorano.com
public class DefaultMutableListModel extends DefaultListModel implements MutableListModel{
public boolean isCellEditable(int index){
return true;
}

public void setValueAt(Object value, int index){
super.setElementAt(value, index);
}
}
public class DefaultMutableListModel<T> extends DefaultListModel<T> implements MutableListModel<T> {
private static final long serialVersionUID = 461469498415839069L;

public boolean isCellEditable(int index){
return true;
}

// public void setValueAt(Object value, int index){
// super.setElementAt(value, index);
// }
}
35 changes: 21 additions & 14 deletions src/dfEditor/CustomComponents/JListMutable.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
import java.applet.Applet;

// @author Santhosh Kumar T - santhosh@in.fiorano.com
public class JListMutable extends JList implements CellEditorListener {
public class JListMutable<T> extends JList<T> implements CellEditorListener {
private static final long serialVersionUID = -8376374319089296337L;

protected Component editorComp = null;
protected int editingIndex = -1;
protected ListCellEditor editor = null;
protected ListCellEditor<T> editor = null;
private PropertyChangeListener editorRemover = null;

public JListMutable(ListModel dataModel){
public JListMutable(ListModel<T> dataModel){
super(dataModel);
init();
}
Expand All @@ -29,13 +31,13 @@ private void init(){
putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); //NOI18N
}

public void setListCellEditor(ListCellEditor editor){
this.editor = editor;
public void setListCellEditor(ListCellEditor<T> editor){
this.editor = editor;
}

public ListCellEditor getListCellEditor(){
return editor;
}
public ListCellEditor<T> getListCellEditor(){
return editor;
}

public boolean isEditing() {
return (editorComp == null)? false : true;
Expand Down Expand Up @@ -161,12 +163,12 @@ public void propertyChange(PropertyChangeEvent ev) {

public boolean isCellEditable(int index){
if(getModel() instanceof MutableListModel)
return ((MutableListModel)getModel()).isCellEditable(index);
return ((MutableListModel<T>)getModel()).isCellEditable(index);
return false;
}

public void setValueAt(Object value, int index){
((NamedElement)((MutableListModel)getModel()).getElementAt(index)).setName((String)value);
((NamedElement)((MutableListModel<T>)getModel()).getElementAt(index)).setName((String)value);
}

/*-------------------------------------------------[ CellEditorListener ]---------------------------------------------------*/
Expand All @@ -186,8 +188,10 @@ public void editingCanceled(ChangeEvent e) {
/*-------------------------------------------------[ Editing Actions]---------------------------------------------------*/

private static class StartEditingAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
JListMutable list = (JListMutable)e.getSource();
private static final long serialVersionUID = 2378126151125982434L;

public void actionPerformed(ActionEvent e) {
JListMutable<?> list = (JListMutable<?>)e.getSource();
if (!list.hasFocus()) {
CellEditor cellEditor = list.getListCellEditor();
if(cellEditor!=null && !cellEditor.stopCellEditing()) {
Expand All @@ -207,8 +211,11 @@ public void actionPerformed(ActionEvent e) {
}

private class CancelEditingAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
JListMutable list = (JListMutable)e.getSource();
private static final long serialVersionUID = 3414959167369764270L;

public void actionPerformed(ActionEvent e) {
@SuppressWarnings("unchecked")
JListMutable<T> list = (JListMutable<T>)e.getSource();
list.removeEditor();
}

Expand Down
4 changes: 2 additions & 2 deletions src/dfEditor/CustomComponents/ListCellEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import java.awt.*;

// @author Santhosh Kumar T - santhosh@in.fiorano.com
public interface ListCellEditor extends CellEditor{
Component getListCellEditorComponent(JList list, Object value,
public interface ListCellEditor<T> extends CellEditor{
Component getListCellEditorComponent(JList<T> list, Object value,
boolean isSelected,
int index);
}
4 changes: 2 additions & 2 deletions src/dfEditor/CustomComponents/MutableListModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.swing.*;

// @author Santhosh Kumar T - santhosh@in.fiorano.com
public interface MutableListModel extends ListModel {
public interface MutableListModel<T> extends ListModel<T> {
public boolean isCellEditable(int index);
public void setValueAt(Object value, int index);
// public void setValueAt(Object value, int index);
}
2 changes: 2 additions & 0 deletions src/dfEditor/CustomNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

public class CustomNode extends DefaultMutableTreeNode
{
private static final long serialVersionUID = 4107423710895404131L;

private Color colour = Color.BLUE;
private int childDirUniqueID;
private int childLeafUniqueID;
Expand Down
Loading