uqbar-project / arena Goto Github PK
View Code? Open in Web Editor NEWMMVC framework
Home Page: http://arena.uqbar-project.org/
MMVC framework
Home Page: http://arena.uqbar-project.org/
main panel doesn't accept manual sizing
Arena sample applications we deliver tend to have test data initialization code as part of the repositories or even views. This is a bad practice, since it couples the data set - which is envirment dependent e.g. production and development - to the views or repositories, making them impossible to use in diferent environment wihout modification to code.
It would be nice that Arena had some kind of bootstrap interface - essentially, a runnable - that could be passed to an Arena Application init code, ensuring it is executed before the app starts, similar to Rails seeds or Grails Bootstraps. That way we would discourage the previously mentioned bad practice.
If you set a negative number Arena shows 0 instead of -2
Like
new NumericField() => [
decimals = 10
]
So it should add a special configuration for its filter...
Original problem:
The biggest problem here is in table columns.
Theres a bindContentsToProperty "or" bindContentsToTransformer
Using the latter will not create any binding. Arena looses information on which property are you using from the object, therefore, it won't refresh the cell when the model changes.
'What steps will reproduce the problem?'
Table cell should actualize its contents, but it does not (unless the whole list changes).
The best approach for this is to have something really similar to transformers in bindings for other controls.
Column<Account> column = ...
Binding binding = column.bindContentProperty("amountOfMoney")
binding.setTransformer[ Double d | "$" + d ]
In this way there's still a binding there, so it will be updated automatically upon a change on that property.
But it still allows the user to change the way it's been seen.
Also note that in this case the transformer works on the value of the property.
While the current transformer works on the object that's one of the item on the list
[ Account a | "$" + a.getAmountOfMoney() ]
Note: Arena 3.5.1 has a setTransformer method, but Transformer needs to conform a <String, String> conversion. See example below:
bindContentsToProperty("recibeResumenCuenta").transformer = [ recibe | if (recibe) "SI" else "NO"]
does not work,
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
at ar.edu.celulares.ui.BuscarCelularesWindow$10$1.transform(BuscarCelularesWindow.java:1)
at org.uqbar.lacar.ui.impl.jface.tables.JFaceLabelProviderBuilder$1.transform(JFaceLabelProviderBuilder.java:85)
at org.uqbar.lacar.ui.impl.jface.tables.JFaceLabelProviderBuilder$1.transform(JFaceLabelProviderBuilder.java:82)
you should ask
bindContentsToProperty("recibeResumenCuenta").transformer = [ recibe | if (recibe == "true") "SI" else "NO"]
Same situation rises if you define a Transformer class:
BooleanToSiNoTransformer implements Transformer<String, String>
is ok while
BooleanToSiNoTransformer implements Transformer<Boolean, String>
does not compile.
See wollok project that already has this implemented
It would be nice to add a dynamic binding to a Panel for
Maybe we can use newer versions of SWT / JFaces...
Something like
new ErrorPanel(parent).setMinHeight(2)
We should discuss if measures should be given in lines or pixels. I would prefer lines, but I don't know what to do with the width.
Now if an Arena window uses a non-observable domain object, Application doesn't start.
But if a window model object has a reference to a non observable property, like a combo selector of elements T which are not observable, you get
org.eclipse.core.databinding - 0 - Could not attach listener to Eleccion Nacional
java.lang.NoSuchMethodException: ar.edu.votacion.Zona.addPropertyChangeListener(java.beans.PropertyChangeListener)
at java.lang.Class.getMethod(Class.java:1786)
at org.eclipse.core.internal.databinding.beans.ListenerSupport.processListener(ListenerSupport.java:177)
at org.eclipse.core.internal.databinding.beans.ListenerSupport.hookListener(ListenerSupport.java:72)
Maybe we can enhance message description or do a deeper validation...
Please see page 25 of https://docs.google.com/document/d/17EvP3IGEbdzhC-da-V2iV3OB6yU4qYXbMNbycu3maPo/edit#
For example, write 5 and press backspace.
I saw it at a student's computer... Ubuntu was the OS, I think.
Several students had a runtime error when clicking on a checkbox that has a binding like this:
new CheckBox(panel) => [
value <=> "checked"
]
and, in model:
def getChecked() {
true
}
def void setChecked(Boolean b) {
}
In particular, I tried to breakpoint the setter and couldn't... tried with multiple combinations of method signature but it was the same.
In http://arena.uqbar-project.org/documentation.html, 'Binding' has a broken link to http://arena.uqbar-project.org/documentation/binding.html which only misses a 's' close to the end, like this: http://arena.uqbar-project.org/documentation/bindings.html
See link to this branch. UI project is this
Exception in thread "main" javassist.CannotCompileException: [source error] firePropertyChange(java.lang.String,edu.unsam.tpeventos2018.grupo3.Usuario,edu.unsam.tpeventos2018.grupo3.Usuario) not found in edu.unsam.tpeventos2018.grupo3.Evento
at javassist.expr.FieldAccess.replace(FieldAccess.java:216)
at org.uqbar.apo.Advice.edit(Advice.scala:47)
at javassist.expr.ExprEditor.loopBody(ExprEditor.java:198)
at javassist.expr.ExprEditor.doit(ExprEditor.java:91)
at javassist.CtClassType.instrument(CtClassType.java:1398)
at org.uqbar.apo.Advice.apply(Advice.scala:83)
at org.uqbar.poo.aop.ObservableConfiguration$$anon$2.apply(ObservableConfiguration.scala:28)
at org.uqbar.apo.AdviceWeaver.applyAdviceToCtClass(AdviceWeaver.scala:42)
at org.uqbar.apo.AdviceWeaver$$anonfun$applyAdvice$1.apply(AdviceWeaver.scala:35)
at org.uqbar.apo.AdviceWeaver$$anonfun$applyAdvice$1.apply(AdviceWeaver.scala:33)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.uqbar.apo.AdviceWeaver.applyAdvice(AdviceWeaver.scala:33)
at org.uqbar.apo.APOClassLoader.applyAPO(APOClassLoader.scala:106)
at org.uqbar.apo.APOClassLoader.findClass(APOClassLoader.scala:83)
at org.uqbar.apo.APOClassLoader.loadClass(APOClassLoader.scala:58)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.uqbar.apo.APOClassLoader.loadClass(APOClassLoader.scala:69)
at jose.RealmenteNoSeQuePasa.main(RealmenteNoSeQuePasa.java:20)
Caused by: compile error: firePropertyChange(java.lang.String,edu.unsam.tpeventos2018.grupo3.Usuario,edu.unsam.tpeventos2018.grupo3.Usuario) not found in edu.unsam.tpeventos2018.grupo3.Evento
at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:723)
at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:688)
at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:157)
at javassist.compiler.ast.CallExpr.accept(CallExpr.java:46)
at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:242)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:330)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
at javassist.compiler.Javac.compileStmnt(Javac.java:569)
at javassist.expr.FieldAccess.replace(FieldAccess.java:210)
... 17 more
Cosas que probé:
Hay novedades.
Si extiendo la clase Usuario y uso esa clase como dominio, anda..
package edu.unsam.tpeventos2018.grupo3
import edu.unsam.tpeventos2018.grupo3.Usuario
import org.uqbar.commons.model.annotations.Observable
@Observable
class UsuarioExtendido extends Usuario {
}
If you have a TextBox bound to an int property for example.
Then while using the dialog, you write a number and delete all the content of the textbox, you'll see that the binding sets an error to the control, and you'll see it in the feedback panel.
"Missing character for value. ...".
But the control's interface has methods to declare when it's mandatory. So one would think that controls are not mandatory by default, which is not the case here.
Perhaps Arena can offer a NumericTextBox, which
from "com" to "org"
En https://github.com/uqbar-project/eg-votacion-arena-xtend
si intentás definir una propiedad para inhabilitar el botón y en Encuesta, si en lugar de hacer
@Dependencies("candidato")
getPuedeVotarse() {
candidato.puedeVotarse() // es candidato.partido === "PRO"
}
escribís sin el get
@Dependencies("candidato")
puedeVotarse() {
candidato.puedeVotarse() // es candidato.partido === "PRO"
}
Arena no se queja en ningún momento, pero al cambiar el candidato no se inhabilita el botón. Deberíamos chequear que el método original de xtend comience con get (en Java sin embargo lo genera con get, por eso no salta la validación de Arena).
Currently this project depends on the following jar:
And in addition it will be mostly used in project that:
That means that we have no more than 4 collection frameworks, which makes more complex to determine which to use
Sería más cómodo que Entity redefiniera el equals y el hashCode en base al id.
In the "apuestas" example:
The problem is that the button gets now enabled, while in the code we have set two different conditions
botonJugar.bindEnabled(new NotNullObservable("valorApostado"))
botonJugar.disableOnError
Somehow, it seems like in only takes into account the last call. It's like the disableOnError overrides the previous "enabled/disable" condition/binding.
I believe this should be treated as an "AND" operation.
It would be nice to upgrade them and do a regression tests
There are two Home abstractions, both in uqbar-domain project.
1° ==> package org.uqbar.commons.utils public class Home
2° ==> package org.uqbar.commons.model public interface Home
2° defines a contract for homes
1° is used by ApplicationContext
What do we expect?
Same as #19 should also enhance explanation for windows
Error al bindear una property dependiendo de su nombre. Por ejemplo "aQueAposto"
The error is
org.eclipse.core.databinding - 0 - Could not attach listener to ar.edu.votacion.Zona@2f04105
instead of
XXXX class should be annotated as @Observable
See https://github.com/uqbar-project/eg-widget-arena-xtend, Date example is using java.util.Date.
We should provide default transformers for new Java 8 LocalDates.
It should work exactly as SWT widget
Students get confused over where they should use transformer and where adapter.
You can use
-bindValueToProperty("fecha").transformer = new DateAdapter
or
-bindContentsToProperty("modeloCelular").transformer
But
-bindContentsToProperty("modeloCelular").adapter does not exists
And on the selector we can do:
-bindItems(new ObservableProperty(homeModelos, "modelos")).adapter = new PropertyAdapter(typeof(Modelo), "descripcionEntera")
I don't know if this is on purpose but it is so confusing...
Can't we do anything about it?
Now in Arena's xtend versions you can add check typing like this:
new TextBox(mainPanel) => [
value <=> "valor"
enabled <=> [ CalculadoraBigDecimal calc | calc.habilitado ]
But you can't transform that property inside the closure:
new TextBox(mainPanel) => [
value <=> "valor"
enabled <=> [ CalculadoraBigDecimal calc | calc.valor != 2 ]
Because you get an exception:
java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.Boolean
at org.eclipse.jface.internal.databinding.swt.TextEditableObservableValue.doSetValue(TextEditableObservableValue.java:67)
at org.eclipse.core.databinding.observable.value.AbstractObservableValue.setValue(AbstractObservableValue.java:55)
at org.uqbar.ui.jface.base.BaseUpdateValueStrategy.doSet(BaseUpdateValueStrategy.java:37)
at org.eclipse.core.databinding.ValueBinding$4.run(ValueBinding.java:184)
That's because operator_spaceship defines the following operation:
def static <M,R> operator_spaceship(ViewObservable obs, Function1<M,R> propertyBinder) {
obs <=> calculateObservable(obs.view.containerModelObject, propertyBinder)
}
calculateObservable searches for a property,
def static <M,R> calculateObservable(Object model, Function1<M, R> propertyBinder) {
val Class<M> concreteModelType = model.class as Class<M>
val handler = createInvocationHandler()
val M mock = createMockFor(concreteModelType, handler)
// call closure
propertyBinder.apply(mock)
//TODO: inspect mock for getter calls, register binding.
handler.getPropertyName
}
For the above example calculateObservable returns at runtime:
property: valor
value: a boolean value, which is not compatible (thus resulting in a class cast exception).
It should be nice to transform the value in the closure.
Forgot to ask if isPending() message returns true/false:
@Override
public void run() {
ObjectTransactionManager.getTransaction();
this.bootstrap.run();
this.createMainWindow().open();
}
Should be:
@Override
public void run() {
ObjectTransactionManager.getTransaction();
if (this.bootstrap.isPending()) this.bootstrap.run();
this.createMainWindow().open();
}
Already deployed 3.6.1 version, sorry. :(
All homes interfaces and classes should be renamed to Repo.
CollectionBasedHome ==> CollectionBasedRepo
Home ==> Repo
Don't blame me @PalumboN , I tried to do the right way 😄
Enhancement: create a specialized text field for password entry. For security reasons, a password field does not show the characters that the user types. Instead, the field displays a character different from the one typed, such as an asterisk '*
for Selector. See Encuestas de votación example.
In this project: https://github.com/lisar01/Choripeada the properties "totalAsistentes" and "totalRecaudacion" are not being updated in the view when the collection is modified (the getter call is happening, but that value doesn't arrive on the view).
You should use Object as View type
I'm not sure
Actually is not possible to align text or numbers on different components such as:
Define a model with a List binding, initalize using [] then at runtime you see a strange scala.List binding error. See votacion example, in getZonas method, replace the default by [] and you get that error.
Columnlayout, no autoajusta el ancho de los controles que tiene dentro. Ej label.
En swt existe un parámetro para indicarle que haga todas las columnas del mismo tamañao, y eso "estira" los controles internos. Se llama "makesamewidth", o algo así.
The problem here is that if I create a screen with a "label-control" structure, and for example I have a Label whose initial value is just one digit, like "A", but the model changes because of some interaction and this gets a longer value like "ABCDEFG", then the label will just show "A", because it was sized for the initial content, and not resized after.
The only layout that we have that stretches controls is the Vertical Layout.
Some of them are in english, and most in spanish.
It would be nice to add i18n to messages.
Now we are using arena only from languages that have static typing and lambdas/blocks, but MessageSend is largerly a patch for the lack of lambdas, in a dynamic typed way.
Perhaps it is time to remove that class, since it only adds confussion to framework users.
If you have a window with a model object that is @observable, and create a table bound to a list property which holds objects of type "B", let say.
If that class B doesn't have the @observable annotation, then when you run the application it will log the following ugly exception, because it tries to register a listener into an instance of B class, which was not weaved, and therefore doesn't have the observable methods.
org.eclipse.core.databinding - 0 - Could not attach listener to uqbar.examples.burros.model.Caballo@1682598
java.lang.NoSuchMethodException: uqbar.examples.burros.model.Caballo.addPropertyChangeListener(java.beans.PropertyChangeListener)
at java.lang.Class.getMethod(Class.java:1605)
at org.eclipse.core.internal.databinding.beans.ListenerSupport.processListener(ListenerSupport.java:177)
at org.eclipse.core.internal.databinding.beans.ListenerSupport.hookListener(ListenerSupport.java:72)
at org.eclipse.core.internal.databinding.beans.JavaBeanObservableMap.hookListener(JavaBeanObservableMap.java:86)
at org.eclipse.core.databinding.observable.map.ComputedObservableMap.init(ComputedObservableMap.java:114)
at org.eclipse.core.internal.databinding.beans.JavaBeanObservableMap.<init>(JavaBeanObservableMap.java:81)
at org.eclipse.core.internal.databinding.beans.JavaBeanObservableMap.<init>(JavaBeanObservableMap.java:63)
at org.eclipse.core.databinding.beans.BeansObservables.observeMap(BeansObservables.java:109)
at org.eclipse.core.databinding.beans.BeansObservables.observeMaps(BeansObservables.java:171)
at org.uqbar.lacar.ui.impl.jface.tables.JFaceLabelProviderBuilder.createLabelProvider(JFaceLabelProviderBuilder.java:41)
at org.uqbar.lacar.ui.impl.jface.tables.JFaceTableItemsBindingBuilder.build(JFaceTableItemsBindingBuilder.java:33)
at org.uqbar.lacar.ui.model.bindings.Binding.execute(Binding.java:79)
at org.uqbar.arena.widgets.Control.showOn(Control.java:137)
at org.uqbar.arena.widgets.Panel.showOn(Panel.java:121)
at org.uqbar.arena.windows.Window.showOn(Window.java:189)
at org.uqbar.arena.windows.Window.showOn(Window.java:1)
at org.uqbar.lacar.ui.impl.jface.windows.JFaceWindowBuilder.createWindowContents(JFaceWindowBuilder.java:104)
at org.uqbar.lacar.ui.impl.jface.windows.JFaceWindowBuilder$2.createContents(JFaceWindowBuilder.java:215)
at org.eclipse.jface.window.Window.create(Window.java:431)
at org.uqbar.lacar.ui.impl.jface.windows.JFaceWindowBuilder.open(JFaceWindowBuilder.java:71)
at org.uqbar.arena.windows.Window.open(Window.java:137)
at org.uqbar.arena.Application.run(Application.java:70)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.uqbar.lacar.ui.impl.jface.JFaceApplicationBuilder.run(JFaceApplicationBuilder.java:25)
at org.uqbar.arena.Application.start(Application.java:51)
at uqbar.examples.burros.ui.arena.BurrosApplication.main(BurrosApplication.java:30)
org.eclipse.core.databinding - 0 - Could not attach listener to uqbar.examples.burros.model.Caballo@7c3885
java.lang.NoSuchMethodException: uqbar.examples.burros.model.Caballo.addPropertyChangeListener(java.beans.PropertyChangeListener)
at java.lang.Class.getMethod(Class.java:1605)
at org.eclipse.core.internal.databinding.beans.ListenerSupport.processListener(ListenerSupport.java:177)
at org.eclipse.core.internal.databinding.beans.ListenerSupport.hookListener(ListenerSupport.java:72)
at org.eclipse.core.internal.databinding.beans.JavaBeanObservableMap.hookListener(JavaBeanObservableMap.java:86)
at org.eclipse.core.databinding.observable.map.ComputedObservableMap.init(ComputedObservableMap.java:114)
at org.eclipse.core.internal.databinding.beans.JavaBeanObservableMap.<init>(JavaBeanObservableMap.java:81)
at org.eclipse.core.internal.databinding.beans.JavaBeanObservableMap.<init>(JavaBeanObservableMap.java:63)
at org.eclipse.core.databinding.beans.BeansObservables.observeMap(BeansObservables.java:109)
at org.eclipse.core.databinding.beans.BeansObservables.observeMaps(BeansObservables.java:171)
at org.uqbar.lacar.ui.impl.jface.tables.JFaceLabelProviderBuilder.createLabelProvider(JFaceLabelProviderBuilder.java:41)
at org.uqbar.lacar.ui.impl.jface.tables.JFaceTableItemsBindingBuilder.build(JFaceTableItemsBindingBuilder.java:33)
at org.uqbar.lacar.ui.model.bindings.Binding.execute(Binding.java:79)
at org.uqbar.arena.widgets.Control.showOn(Control.java:137)
at org.uqbar.arena.widgets.Panel.showOn(Panel.java:121)
at org.uqbar.arena.windows.Window.showOn(Window.java:189)
at org.uqbar.arena.windows.Window.showOn(Window.java:1)
at org.uqbar.lacar.ui.impl.jface.windows.JFaceWindowBuilder.createWindowContents(JFaceWindowBuilder.java:104)
at org.uqbar.lacar.ui.impl.jface.windows.JFaceWindowBuilder$2.createContents(JFaceWindowBuilder.java:215)
at org.eclipse.jface.window.Window.create(Window.java:431)
at org.uqbar.lacar.ui.impl.jface.windows.JFaceWindowBuilder.open(JFaceWindowBuilder.java:71)
at org.uqbar.arena.windows.Window.open(Window.java:137)
at org.uqbar.arena.Application.run(Application.java:70)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.uqbar.lacar.ui.impl.jface.JFaceApplicationBuilder.run(JFaceApplicationBuilder.java:25)
at org.uqbar.arena.Application.start(Application.java:51)
at uqbar.examples.burros.ui.arena.BurrosApplication.main(BurrosApplication.java:30)
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.