Permalink
Browse files

replaced tabs with spaces

  • Loading branch information...
1 parent d05459b commit 26e9a5b6303c9ca8cf1aff39d1e3eef9d412b0bc @darxriggs darxriggs committed with blackdrag Dec 27, 2011
View
@@ -10,16 +10,16 @@
public class ary {
public static void main(String[] args) {
- int i, j, k, n = Integer.parseInt(args[0]);
- int[] x = new int[n];
- int[] y = new int[n];
+ int i, j, k, n = Integer.parseInt(args[0]);
+ int[] x = new int[n];
+ int[] y = new int[n];
- for (i = 0; i < n; i++)
- x[i] = i + 1;
- for (k = 0; k < 1000; k++ )
- for (j = n-1; j >= 0; j--)
- y[j] += x[j];
+ for (i = 0; i < n; i++)
+ x[i] = i + 1;
+ for (k = 0; k < 1000; k++ )
+ for (j = n-1; j >= 0; j--)
+ y[j] += x[j];
- System.out.println(y[0] + " " + y[n-1]);
+ System.out.println(y[0] + " " + y[n-1]);
}
}
@@ -185,7 +185,7 @@ ruleset {
exclude 'ElseBlockBraces' // else statements without braces seems acceptable in our coding standards
}
ruleset('rulesets/basic.xml') {
- /* not available with gradle 0.9.2
+ /* not available with gradle 0.9.2
'ConsecutiveStringConcatenation' {
doNotApplyToClassNames='groovy.DynamicMemberTest,groovy.StaticImportTest,groovy.bugs.Groovy675_Bug,groovy.bugs.MorgansBug,' +
'groovy.bugs.WriteOnlyPropertyBug,groovy.operator.StringOperatorsTest,groovy.swing.SwingBuilderTest,' +
@@ -195,7 +195,7 @@ ruleset {
'DeadCode' {
doNotApplyToClassNames='ThrowTest'
}
- /* not available with gradle 0.9.2
+ /* not available with gradle 0.9.2
'ConsecutiveLiteralAppends' {
doNotApplyToClassNames='groovy.bugs.ByteIndexBug'
}
@@ -25,19 +25,19 @@ import java.awt.Component
class CellEditorFactory extends AbstractFactory {
public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) {
- FactoryBuilderSupport.checkValueIsNull value, name
- return new ClosureCellEditor(null, attributes)
+ FactoryBuilderSupport.checkValueIsNull value, name
+ return new ClosureCellEditor(null, attributes)
}
public void setChild(FactoryBuilderSupport builder, Object parent, Object child) {
- if (child instanceof Component) {
- parent.children += child
- }
+ if (child instanceof Component) {
+ parent.children += child
+ }
}
public void onNodeCompleted(FactoryBuilderSupport builder, Object parent, Object node) {
- node.editorValue = builder.context.editorValueClosure
- node.prepareEditor = builder.context.prepareEditorClosure
+ node.editorValue = builder.context.editorValueClosure
+ node.prepareEditor = builder.context.prepareEditorClosure
parent.cellEditor = node
}
}
@@ -49,27 +49,27 @@ class CellEditorGetValueFactory extends AbstractFactory {
}
public boolean isHandlesNodeChildren() {
- return true;
+ return true;
}
public boolean onNodeChildren(FactoryBuilderSupport builder, Object node, Closure childContent) {
- builder.parentContext.editorValueClosure = childContent
- return false
+ builder.parentContext.editorValueClosure = childContent
+ return false
}
}
class CellEditorPrepareFactory extends AbstractFactory {
- public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) {
- return Collections.emptyMap()
- }
+ public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) {
+ return Collections.emptyMap()
+ }
- public boolean isHandlesNodeChildren() {
- return true;
- }
+ public boolean isHandlesNodeChildren() {
+ return true;
+ }
- public boolean onNodeChildren(FactoryBuilderSupport builder, Object node, Closure childContent) {
- builder.parentContext.prepareEditorClosure = childContent
- return false
- }
- }
+ public boolean onNodeChildren(FactoryBuilderSupport builder, Object node, Closure childContent) {
+ builder.parentContext.prepareEditorClosure = childContent
+ return false
+ }
+}
@@ -28,40 +28,40 @@ import groovy.util.logging.Log
@Log
class ColumnFactory extends AbstractFactory {
- Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) {
- if(value instanceof TableColumn) {
+ Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) {
+ if(value instanceof TableColumn) {
return value
}
- TableColumn node
- Class jxTableClass = null
- try {
- jxTableClass = Class.forName("org.jdesktop.swingx.JXTable")
- } catch (ClassNotFoundException ex) {
- }
+ TableColumn node
+ Class jxTableClass = null
+ try {
+ jxTableClass = Class.forName("org.jdesktop.swingx.JXTable")
+ } catch (ClassNotFoundException ex) {
+ }
- if(jxTableClass != null && builder.current instanceof TableColumnModel) {
- node = Class.forName("org.jdesktop.swingx.table.TableColumnExt").newInstance()
- } else {
+ if(jxTableClass != null && builder.current instanceof TableColumnModel) {
+ node = Class.forName("org.jdesktop.swingx.table.TableColumnExt").newInstance()
+ } else {
node = new javax.swing.table.TableColumn()
}
- if(value != null) {
- node.identifier = value.toString()
+ if(value != null) {
+ node.identifier = value.toString()
attributes.remove('identifier')
}
- if(attributes.width) {
- if(attributes.width instanceof Collection) {
- // 3 values: min, pref, max
- // 2 values: min, pref
- // 1 value: pref
- def (min, pref, max) = attributes.width
- if(!pref && !max) {
- node.minWidth = 0
+ if(attributes.width) {
+ if(attributes.width instanceof Collection) {
+ // 3 values: min, pref, max
+ // 2 values: min, pref
+ // 1 value: pref
+ def (min, pref, max) = attributes.width
+ if(!pref && !max) {
+ node.minWidth = 0
node.preferredWidth = min as Integer
node.maxWidth = Integer.MAX_VALUE
- } else {
+ } else {
if(min) {
node.minWidth = min as Integer
}
@@ -72,15 +72,15 @@ class ColumnFactory extends AbstractFactory {
node.maxWidth = max as Integer
}
}
- } else if(attributes.width instanceof Number) {
- node.minWidth = attributes.width.intValue()
- node.preferredWidth = attributes.width.intValue()
- node.maxWidth = attributes.width.intValue()
- }
- attributes.remove('width')
- }
- return node
- }
+ } else if(attributes.width instanceof Number) {
+ node.minWidth = attributes.width.intValue()
+ node.preferredWidth = attributes.width.intValue()
+ node.maxWidth = attributes.width.intValue()
+ }
+ attributes.remove('width')
+ }
+ return node
+ }
void onNodeCompleted(FactoryBuilderSupport builder, Object parent, Object node) {
if (!(parent instanceof TableColumnModel)) {
@@ -25,100 +25,100 @@ import javax.swing.*
* @author Alexander Klein
*/
class ClosureCellEditor extends AbstractCellEditor implements TableCellEditor, TreeCellEditor {
- Map<String, Closure> callbacks = [:]
- Closure prepareEditor
- Closure editorValue
- List children = []
- boolean defaultEditor
-
- JTable table
- JTree tree
- Object value
- boolean selected
- boolean expanded
- boolean leaf
- int row
- int column
-
- ClosureCellEditor(Closure c = null, Map<String, Closure> callbacks = [:]) {
- this.editorValue = c
- this.callbacks.putAll(callbacks)
- }
-
- @Override
- public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
- this.table = table
- this.tree = null
- this.value = value
- this.selected = isSelected
- this.expanded = false
- this.leaf = false
- this.row = row
- this.column = column
-
- return prepare();
- }
-
- Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) {
- this.table = null
- this.tree = tree
- this.value = value
- this.selected = isSelected
- this.expanded = expanded
- this.leaf = leaf
- this.row = row
- this.column = -1
-
- return prepare();
- }
-
- private Component prepare() {
- if (children.isEmpty() || defaultEditor) {
- defaultEditor = true
- children.clear()
- if (table) {
- TableCellEditor tce = table.getDefaultEditor(table.getColumnClass(column))
- children.add(tce.getTableCellEditorComponent(table, value, selected, row, column))
- } else if (tree) {
- TreeCellEditor tce = new DefaultCellEditor(new JTextField())
- children.add(tce.getTreeCellEditorComponent(tree, value, selected, expanded, leaf, row))
- }
- }
- Object o = prepareEditor.call()
- if (o instanceof Component) {
- return (Component) o
- } else {
- return (Component) children[0]
- }
- }
-
- @Override
- public Object getCellEditorValue() {
- editorValue.call()
- }
-
- public void setEditorValue(Closure editorValue) {
- if (editorValue != null) {
- editorValue.delegate = this
- editorValue.resolveStrategy = Closure.DELEGATE_FIRST
- }
- this.editorValue = editorValue
- }
-
- public void setPrepareEditor(Closure prepareEditor) {
- if (prepareEditor != null) {
- prepareEditor.delegate = this
- prepareEditor.resolveStrategy = Closure.DELEGATE_FIRST
- }
- this.prepareEditor = prepareEditor
- }
-
- @Override
- public Object invokeMethod(String name, Object args) {
- def calledMethod = ClosureCellEditor.metaClass.getMetaMethod(name, args)
- if (callbacks."$name" && callbacks."$name" instanceof Closure)
- return callbacks."$name".call(calledMethod, this, args)
- else
- return calledMethod?.invoke(this, args)
- }
+ Map<String, Closure> callbacks = [:]
+ Closure prepareEditor
+ Closure editorValue
+ List children = []
+ boolean defaultEditor
+
+ JTable table
+ JTree tree
+ Object value
+ boolean selected
+ boolean expanded
+ boolean leaf
+ int row
+ int column
+
+ ClosureCellEditor(Closure c = null, Map<String, Closure> callbacks = [:]) {
+ this.editorValue = c
+ this.callbacks.putAll(callbacks)
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
+ this.table = table
+ this.tree = null
+ this.value = value
+ this.selected = isSelected
+ this.expanded = false
+ this.leaf = false
+ this.row = row
+ this.column = column
+
+ return prepare();
+ }
+
+ Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) {
+ this.table = null
+ this.tree = tree
+ this.value = value
+ this.selected = isSelected
+ this.expanded = expanded
+ this.leaf = leaf
+ this.row = row
+ this.column = -1
+
+ return prepare();
+ }
+
+ private Component prepare() {
+ if (children.isEmpty() || defaultEditor) {
+ defaultEditor = true
+ children.clear()
+ if (table) {
+ TableCellEditor tce = table.getDefaultEditor(table.getColumnClass(column))
+ children.add(tce.getTableCellEditorComponent(table, value, selected, row, column))
+ } else if (tree) {
+ TreeCellEditor tce = new DefaultCellEditor(new JTextField())
+ children.add(tce.getTreeCellEditorComponent(tree, value, selected, expanded, leaf, row))
+ }
+ }
+ Object o = prepareEditor.call()
+ if (o instanceof Component) {
+ return (Component) o
+ } else {
+ return (Component) children[0]
+ }
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+ editorValue.call()
+ }
+
+ public void setEditorValue(Closure editorValue) {
+ if (editorValue != null) {
+ editorValue.delegate = this
+ editorValue.resolveStrategy = Closure.DELEGATE_FIRST
+ }
+ this.editorValue = editorValue
+ }
+
+ public void setPrepareEditor(Closure prepareEditor) {
+ if (prepareEditor != null) {
+ prepareEditor.delegate = this
+ prepareEditor.resolveStrategy = Closure.DELEGATE_FIRST
+ }
+ this.prepareEditor = prepareEditor
+ }
+
+ @Override
+ public Object invokeMethod(String name, Object args) {
+ def calledMethod = ClosureCellEditor.metaClass.getMetaMethod(name, args)
+ if (callbacks."$name" && callbacks."$name" instanceof Closure)
+ return callbacks."$name".call(calledMethod, this, args)
+ else
+ return calledMethod?.invoke(this, args)
+ }
}
Oops, something went wrong.

0 comments on commit 26e9a5b

Please sign in to comment.