Improvements related to editing of features#274
Conversation
fgdrf
left a comment
There was a problem hiding this comment.
@nprigour Thanks for this improvement! I'm wondering if you could address minor changes I commented.
Cool thing to get only valid Values and even null values applied to feature attributes. I'm asking myself if there is a need to have a difference in behavior to set an empty value rather than a null value...
| try { | ||
| return convertToNumber(); | ||
| } catch (NumberFormatException e) { | ||
| e.printStackTrace(); |
There was a problem hiding this comment.
This causes errors logged in console / error view and the value is cleared for feature. I tested to override isValueValid which leaves the feature untouched in case of any NumberFormatException. With this change the try/catch block in doGetValue isn't required anymore..
@Override
public boolean isValueValid() {
try {
Number number = convertToNumber();
return (number != null);
} catch (NumberFormatException e) {
return false;
}
}
| /** | ||
| * Test Cell Editor | ||
| * | ||
| * @author Jesse |
There was a problem hiding this comment.
Your credits, use here @author Nikolaos Pringouris <nprigour@gmail.com> as well ;)
| assertNull(editor.getValue() ); | ||
| } | ||
|
|
||
| private void runTest( Object value, Object value2, Class<? extends Number> class1 ) { |
There was a problem hiding this comment.
I'd like to suggest to rename to something like assertSetAndGetTwoValues or even split it into two calls of assertSetAndGetValue.
I tested with a Parametrized Test, goint to create a pull request for your branch ..
There was a problem hiding this comment.
actually for that I just adopted the same naming approach as used for BasicTypeCellEditorTest
| * Test Cell Editor | ||
| * | ||
| * @author Jesse | ||
| * @since 1.1.0 |
| assertNull(editor.getValue() ); | ||
|
|
||
| //not parsable number | ||
| editor.setValue("aa"); |
There was a problem hiding this comment.
this might be obsolete if isValueValidis implemented...
| public void setDateFormatter(DateFormat format) { | ||
| this.format = format; | ||
| } | ||
|
|
There was a problem hiding this comment.
Override isValueValid here as well to avoid clearance of the feature attribute value in case of ParseException
|
Hi @fgdrf , I have addressed most of your comments/requests with the exception of renaming of runTest (I have explained why.
|
|
Hi @fgdrf , I have addressed most of your comments/requests with the exception of renaming of runTest (I have explained why.
Besides all the above and before merging the pull request I would like your opinion if it is worthy to perform also some code refactoring to gather for exapmle all cell editors in a separate package witihin orgo.locationtech.udig.ui plugin. What do you think? |
I'm wondering about your format settings. Have you configured codeformatter.xml settings for your workspace (Preferences —> Java —> Code Style —> Code Formatter)?
I'm fine with it althought it is not convenient naming such methods. It was just a hint to improve codebase while other classes still might have "special" style ;) And, especially in this case, its copied or used as template which makes it even worse.
Good Idea and I'd like to suggest to seperate it from this pull request. We can collaborate on your suggested refacturings (sub-packaging). |
|
Yes I use the specified code formatter. However occasionally it may occur that during editing formatting does not apply and sometimesI need to explixitly select format from the eclipse editor context menu. Ok no objection to handle refactoring to a subpackage in a separate pull request. |
|
Started a build : https://ci.eclipse.org/udig/job/uDig-PR/2/ |
|
Can you try to select all lines in at least new files you created and Format code again? Do you have configures some specific save Actions (Preferences -> Java -> Editor -> Save Actions)? |
|
re-apply formatting in: NumberCellEditor.java |
|
Can you merge latest changes from master into your branch and push the btranch again? The build didn't finished since an old WMS url let it timeout (https://ci.eclipse.org/udig/job/uDig-PR/2/) which is fixed on master already ;) many Thanks |
|
does this wms related fix conflicts with the present pull? It seems not. Do you want to just merge and push or rebase and force push? |
|
Try a rebase with forced push, I can trigger a build afterwards ..
Thanks
|
Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>
in Table view Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>
Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>
d583721 to
cc16ca6
Compare
|
rebase succesfully applied |
|
build started : https://ci.eclipse.org/udig/job/uDig-PR/3/ |
The FeaturePropertySource & AttributePropertyDescriptor enhancements include:
derived from splitting of #254
Signed-off-by: Nikolaos Pringouris nprigour@gmail.com