palantir / cinch Goto Github PK
View Code? Open in Web Editor NEWA Java library that manages component action/event bindings for MVC patterns
License: Other
A Java library that manages component action/event bindings for MVC patterns
License: Other
Here's a stack trace I get quite a bit with the latest version
ERROR [AWT-EventQueue-1] com.palantir.ptoss.cinch.swing.BoundSelection - could not invoke JComboBox binding
java.lang.NullPointerException
at com.palantir.ptoss.cinch.swing.BoundSelection$Wiring$3.itemStateChanged(BoundSelection.java:190)
at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1205)
at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1253)
at javax.swing.JComboBox.contentsChanged(JComboBox.java:1309)
at javax.swing.JComboBox.intervalRemoved(JComboBox.java:1331)
at javax.swing.AbstractListModel.fireIntervalRemoved(AbstractListModel.java:161)
at javax.swing.DefaultComboBoxModel.removeAllElements(DefaultComboBoxModel.java:169)
at javax.swing.JComboBox.removeAllItems(JComboBox.java:751)
It occurs because I call remove on an empty combo box, and combo.getSelectedItem() returns null:
Object current = mutator.get();
Object newValue = combo.getSelectedItem();
if (newValue.equals(nullValue)) {
This should be changed to:
Objects.equals(newValue, nullValue)
Or something similar.
Really minor, but the error message clogs up my console.
Does Cinch support Generic Model, View & Controller?
I tried to write simple Generic MVCs & it gives error when using Generic Model that
"could not find either getter/setter for a model field
"
But when I replace generic types with concrete type, it works.
I think, cinch BindingContext
is not able to find getters/setters in Generic Model!
Is there any solution or I have to write simple MVCs instead of Generic ones?
Support for JTables would be awesome. You could set as variables in the bound as to whether or not it selects by row, column, or cell etc.
The source code uses both tabs and spaces to indent. Not even consistently. And what is worse the tab stops look to be set to 4.
I recommend spaces only.
Links like BoundJCheckBoxExample.java give a 404.
I have a controller with the following signature:
public class Controller {
public void save() throws InvalidObjectException {
callExternalServiceThatThrowsException();
}
}
The fact that it throws InvalidObjectException
is not important
what is important is that it throws an exception when some error occurs
in the external service, beit a ReST API or what.
This seems totally reasonable, and since the controller should be completely
agnostic of the view, throwing an exception and having it bubble up to
an appropriate error handler seems valuable. At the moment, I have no way
of handling the error.
I want to be able to pass this error up to the view so that it can handle
it in a graceful manner. Such as:
public void handleError( Throwable t ) {
displayErrorMessage("I got an error!", t);
}
I currently can do this, sort of, by calling an reportError
method or
something on the model, but that tends to clog up my model with a lot of
error reporting code (it has to hold onto the error for just long enough
for the view to respond to it).
This is similar to the callback systems from jQuery $.ajax method:
$.ajax({
success: someCallback
error: someErrorCallback
});
I could forsee this looking like the following in cinch:
@OnClick( call = "save", onError = "handleError" )
private JButton sendAPICall;
Is there potentially a better way to solve this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.