r3536 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction
Author: athimel Date: 2012-07-18 13:36:40 +0200 (Wed, 18 Jul 2012) New Revision: 3536 Url: http://chorem.org/repositories/revision/lima/3536 Log: Fix indentation ! Use variable instead of 7 getEditorComponent() No 'if' without {?\194?\160} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-18 09:50:01 UTC (rev 3535) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-18 11:36:40 UTC (rev 3536) @@ -58,7 +58,7 @@ /** * Table des transaction qui ajoute des comportement (keys). - * + * * <ul> * <li>Auto creation des entrees si la transaction est vide (tab) * <li>positionnement automatique sur les cellules editables @@ -117,7 +117,7 @@ Highlighter colorTransaction = new ColorHighlighter(predicate, new Color(222, 222, 222), null); addHighlighter(colorTransaction); - + // highlight unbalanced financial transactions predicate = new HighlightPredicate() { @Override @@ -317,18 +317,22 @@ public boolean editCellAt(int row, int column, EventObject e) { boolean result = super.editCellAt(row, column, e); int lengthCellValue; - if (getEditorComponent() != null) - if (getEditorComponent() instanceof JXDatePicker) { - lengthCellValue = ((JXDatePicker)getEditorComponent()).getEditor().getText().length(); + Component editorComponent = getEditorComponent(); + if (editorComponent != null) { + if (editorComponent instanceof JXDatePicker) { + JXDatePicker datePickerComponent = (JXDatePicker) editorComponent; + lengthCellValue = datePickerComponent.getEditor().getText().length(); if (lengthCellValue != -1) { - ((JXDatePicker)getEditorComponent()).getEditor().select(lengthCellValue, lengthCellValue); + datePickerComponent.getEditor().select(lengthCellValue, lengthCellValue); } - } else if ( (getEditorComponent() instanceof JTextComponent)) { - lengthCellValue = ((JTextComponent)getEditorComponent()).getText().length(); - if (lengthCellValue != -1) { - ((JTextComponent)getEditorComponent()).select(lengthCellValue, lengthCellValue); - } + } else if ((editorComponent instanceof JTextComponent)) { + JTextComponent textComponent = (JTextComponent) editorComponent; + lengthCellValue = textComponent.getText().length(); + if (lengthCellValue != -1) { + textComponent.select(lengthCellValue, lengthCellValue); + } } + } return result; }
participants (1)
-
athimelï¼ users.chorem.org