templates.JavaFXassociations.stg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fulib Show documentation
Show all versions of fulib Show documentation
Fulib is a Java-code generating library.
roleAttrDecl(roleName,roleType,toMany,otherClassName) ::=
<<
private SimpleListProperty\< > = _init();
private ObjectProperty\< > = _init();
>>
propertyDecl(roleName) ::=
<< public static final String PROPERTY_ = "";>>
initMethod(roleName,toMany,myClassName,otherClassName,otherRoleName,otherToMany) ::=
<<
private SimpleListProperty\< > _init()
{
SimpleListProperty\< > result = new SimpleListProperty(javafx.collections.FXCollections.observableArrayList());
result.addListener((javafx.collections.ListChangeListener\ super >) change -> {
while (change.next())
{
java.util.List\ extends > removed = change.getRemoved();
for ( value : removed)
{
value.;
firePropertyChange("", value, null);
}
for ( value : change.getAddedSubList())
{
value.(this);
firePropertyChange("", null, value);
}
}
});
return result;
}
private ObjectProperty\< > _init()
{
ObjectProperty\< > result = new SimpleObjectProperty\<>();
result.addListener((observable, oldValue, newValue) ->
{
if (oldValue != null) oldValue.;
if (newValue != null) newValue.(.this);
firePropertyChange("", oldValue, newValue);
});
return result;
}
>>
getMethod(roleName,toMany,otherClassName,roleType) ::=
<<
public \< > get()
{
return ;
}
public get()
{
return .getValue();
}
>>
propertyMethod(roleName,otherClassName) ::=
<<
public ObjectProperty\< > Property()
{
return ;
}
>>
property(toMany) ::=
<%
SimpleListProperty
ObjectProperty
%>
setMethod(roleName,toMany,myClassName,otherClassName,otherRoleName,otherToMany,roleType) ::=
<<
public with( value)
{
if (this.get().contains(value)) return this;
this.get().add(value);
return this;
}
public set( value)
{
if (value == this..getValue()) return this;
.setValue(value);
return this;
}
>>
withoutMethod(roleName,toMany,myClassName,otherClassName,otherRoleName,otherToMany,roleType) ::=
<<
public without( value)
{
this.get().remove(value);
return this;
}
>>
withoutTypeThis(toMany,otherRoleName,myClassName) ::=
<%
without(.this)
set(null)
%>
withoutThis(toMany,otherRoleName) ::=
<%
without(this)
set(null)
%>
prefix(toMany) ::=
<%
with
set
%>
cap(n) ::=
<%
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy