-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/genericsystem/genericsyst…
- Loading branch information
Showing
9 changed files
with
196 additions
and
37 deletions.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
gs-example-reactor/src/main/java/org/genericsystem/example/reactor/AppHtml2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package org.genericsystem.example.reactor; | ||
|
||
import org.genericsystem.api.core.ApiStatics; | ||
import org.genericsystem.carcolor.model.Car; | ||
import org.genericsystem.carcolor.model.CarColor; | ||
import org.genericsystem.carcolor.model.CarColor2; | ||
import org.genericsystem.carcolor.model.Color; | ||
import org.genericsystem.carcolor.model.Power; | ||
import org.genericsystem.carcolor.model.UsedCar; | ||
import org.genericsystem.common.Generic; | ||
import org.genericsystem.common.Root; | ||
import org.genericsystem.example.reactor.AppHtml.ExampleReactorScript; | ||
import org.genericsystem.reactor.annotations.DependsOnModel; | ||
import org.genericsystem.reactor.annotations.RunScript; | ||
import org.genericsystem.reactor.appserver.ApplicationServer; | ||
import org.genericsystem.reactor.appserver.Script; | ||
import org.genericsystem.reactor.gs.GSApp; | ||
import org.genericsystem.reactor.gs2.GSTable.GSSubSubCellTable; | ||
import org.genericsystem.reactor.modelproperties.SelectionDefaults; | ||
|
||
@DependsOnModel({ Car.class, Power.class, UsedCar.class, Color.class, CarColor.class, CarColor2.class }) | ||
@RunScript(ExampleReactorScript.class) | ||
public class AppHtml2 extends GSApp implements SelectionDefaults { | ||
|
||
public static void main(String[] mainArgs) { | ||
ApplicationServer.startSimpleGenericApp(mainArgs, AppHtml2.class, "/example-reactor"); | ||
} | ||
|
||
public AppHtml2() { | ||
addStyle("justify-content", "center"); | ||
new GSSubSubCellTable(this).select(Color.class); | ||
new GSSubSubCellTable(this).select(Car.class); | ||
} | ||
|
||
public static class ExampleReactorScript implements Script { | ||
|
||
@Override | ||
public void run(Root engine) { | ||
Generic car = engine.find(Car.class); | ||
Generic power = engine.find(Power.class); | ||
Generic diesel = engine.find(UsedCar.class); | ||
car.setAttribute("Description"); | ||
Generic person = engine.setInstance("Person"); | ||
Generic category = engine.setInstance("Category"); | ||
Generic carColor = engine.find(CarColor.class); | ||
Generic color = engine.find(Color.class); | ||
Generic carPerson = car.setRelation("CarDriverOwner", category, person); | ||
carPerson.enablePropertyConstraint(); | ||
Generic red = color.setInstance("Red"); | ||
Generic black = color.setInstance("Black"); | ||
Generic green = color.setInstance("Green"); | ||
color.setInstance("Blue"); | ||
color.setInstance("Orange"); | ||
color.setInstance("White"); | ||
color.setInstance("Yellow"); | ||
Generic jdoe = person.setInstance("John Doe"); | ||
Generic hoover = person.setInstance("Edgar Hoover"); | ||
Generic jsnow = person.setInstance("Jon Snow"); | ||
Generic driver = category.setInstance("Driver"); | ||
Generic owner = category.setInstance("Owner"); | ||
category.setInstance("Passenger"); | ||
person.setInstance("Chuck Norris"); | ||
person.setInstance("Barack Obama"); | ||
person.setInstance("Donald Trump"); | ||
Generic audiS4 = car.setInstance("Audi S4"); | ||
audiS4.setHolder(power, 333); | ||
audiS4.setHolder(diesel, false); | ||
audiS4.setLink(carColor, "Audi S4 Green", green); | ||
audiS4.setLink(carPerson, "Audi S4 owner", owner, jsnow); | ||
audiS4.setLink(carPerson, "Audi S4 driver", driver, hoover); | ||
Generic bmwM3 = car.setInstance("BMW M3"); | ||
bmwM3.setHolder(power, 450); | ||
bmwM3.setHolder(diesel, false); | ||
bmwM3.setLink(carColor, "BMW M3 Red", red); | ||
bmwM3.setLink(carPerson, "BMW M3 owner", owner, jdoe); | ||
bmwM3.setLink(carPerson, "BMW M3 owner", driver, jdoe); | ||
Generic ferrariF40 = car.setInstance("Ferrari F40"); | ||
ferrariF40.setHolder(power, 478); | ||
ferrariF40.setHolder(diesel, false); | ||
ferrariF40.setLink(carColor, "Ferrari F40 red", red); | ||
Generic miniCooper = car.setInstance("Mini Cooper"); | ||
miniCooper.setHolder(power, 175); | ||
miniCooper.setHolder(diesel, true); | ||
miniCooper.setLink(carColor, "Mini Cooper", black); | ||
car.setInstance("Audi A4 3.0 TDI").setHolder(power, 233); | ||
car.setInstance("Peugeot 106 GTI").setHolder(power, 120); | ||
car.setInstance("Peugeot 206 S16").setHolder(power, 136); | ||
power.enableRequiredConstraint(ApiStatics.BASE_POSITION); | ||
engine.getCurrentCache().flush(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
gs-reactor/src/main/java/org/genericsystem/reactor/gs2/GSCell.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
gs-reactor/src/main/java/org/genericsystem/reactor/gs2/GSComponentSubCell.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.genericsystem.reactor.gs2; | ||
|
||
import org.genericsystem.reactor.Tag; | ||
import org.genericsystem.reactor.gstag.HtmlLabel; | ||
|
||
public class GSComponentSubCell extends GSComposite { | ||
|
||
public GSComponentSubCell(Tag parent, MetaTag metaTag) { | ||
super(parent, metaTag); | ||
new HtmlLabel(this).bindText(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
gs-reactor/src/main/java/org/genericsystem/reactor/gs2/GSRow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
gs-reactor/src/main/java/org/genericsystem/reactor/gs2/GSSubCell.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
gs-reactor/src/main/java/org/genericsystem/reactor/gs2/GSValueSubCell.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.genericsystem.reactor.gs2; | ||
|
||
import org.genericsystem.reactor.Tag; | ||
import org.genericsystem.reactor.gstag.HtmlLabel; | ||
|
||
public class GSValueSubCell extends GSComposite { | ||
|
||
public GSValueSubCell(Tag parent, MetaTag metaTag) { | ||
super(parent, metaTag, ((GSComposite) parent).getDirection()); | ||
new HtmlLabel(this).bindText(); | ||
} | ||
} |