Code Monkey home page Code Monkey logo

cinch's People

Contributors

arigesher avatar asvoboda avatar carterkozak avatar cobaweel avatar dcervelli avatar grandpoohbear avatar safreiberg avatar schlosna avatar sfreiberg-palantir avatar svc-excavator-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cinch's Issues

NPE on Combo Box Item State Changed

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.

Generic Type support for Model, View & Controllers?

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?

@BoundSelection support for JTables

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.

onError handler for bound methods that call a controller method

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.