Skip to content

Commit

Permalink
gs-reactor: Try to improve framework
Browse files Browse the repository at this point in the history
  • Loading branch information
fducroquet committed Sep 27, 2016
1 parent 6431dbb commit a7c6b9a
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.genericsystem.reactor.annotations.DependsOnModel;
import org.genericsystem.reactor.annotations.DirectSelect;
import org.genericsystem.reactor.annotations.ForEach.ChildForEach;
import org.genericsystem.reactor.annotations.Parent;
import org.genericsystem.reactor.annotations.ReactorDependencies;
import org.genericsystem.reactor.annotations.ReactorDependencies.ChildReactorDependencies;
import org.genericsystem.reactor.annotations.RunScript;
Expand All @@ -24,6 +23,9 @@
import org.genericsystem.reactor.annotations.Styles.Flex;
import org.genericsystem.reactor.annotations.Styles.FlexDirectionStyle;
import org.genericsystem.reactor.annotations.Styles.FlexWrap;
import org.genericsystem.reactor.annotations.Styles.MarginBottom;
import org.genericsystem.reactor.annotations.Styles.MarginRight;
import org.genericsystem.reactor.annotations.Styles.Style;
import org.genericsystem.reactor.appserver.ApplicationServer;
import org.genericsystem.reactor.az.FlexDirection;
import org.genericsystem.reactor.az.GSApp;
Expand All @@ -35,24 +37,21 @@
import org.genericsystem.reactor.example.AppHtml5.AudiTT.AudiTTGreen;
import org.genericsystem.reactor.example.AppHtml5.AudiTT.AudiTTPower;
import org.genericsystem.reactor.example.AppHtml5.AudiTT.Green;
import org.genericsystem.reactor.example.AppHtml5.GSCell.GSSubcell;
import org.genericsystem.reactor.example.AppHtml5.GSInstancesComposite;
import org.genericsystem.reactor.example.AppHtml5.GSRowInstancesComposite;
import org.genericsystem.reactor.example.AppHtml5.GSTypeAttributes;
import org.genericsystem.reactor.example.AppHtml5.GSTypeAttributesRow;
import org.genericsystem.reactor.example.AppHtml5.GSTypeLabeledInstancesComposite;
import org.genericsystem.reactor.example.AppHtml5.GSTypeLabeledInstancesComposite.GSHeaderComponent_;
import org.genericsystem.reactor.example.AppHtml5.GSTypeLabeledInstancesComposite.GSHeaderComponent_.GSTypeAttributesRow_;
import org.genericsystem.reactor.example.AppHtml5.GSTypeTableInstancesComposite;
import org.genericsystem.reactor.example.AppHtml5.GSValueComponents;
import org.genericsystem.reactor.example.AppHtml5.TestCell;
import org.genericsystem.reactor.example.AppHtml5.TestCell.GSCell_;
import org.genericsystem.reactor.example.AppHtml5.Unit;
import org.genericsystem.reactor.model.ObservableListExtractor;
import org.genericsystem.reactor.modelproperties.SelectionDefaults;

@DependsOnModel({ Car.class, Power.class, UsedCar.class, Color.class, CarColor.class, CarColor2.class, AudiTT.class, Green.class, AudiTTGreen.class, AudiTTPower.class, Unit.class })
@RunScript(ExampleReactorScript.class)
@ReactorDependencies({ GSInstancesComposite.class, GSRowInstancesComposite.class, GSTypeAttributes.class, GSTypeAttributesRow.class, GSValueComponents.class, GSTypeLabeledInstancesComposite.class, /* GSTypeTableInstancesComposite.class, */TestCell.class })
@ReactorDependencies({ GSInstancesComposite.class, GSRowInstancesComposite.class, GSTypeAttributes.class, GSTypeAttributesRow.class, GSValueComponents.class, GSTypeLabeledInstancesComposite.class, GSTypeTableInstancesComposite.class, TestCell.class })
@FlexWrap("wrap")
@Flex("1 1 0%")
public class AppHtml5 extends GSApp implements SelectionDefaults {
Expand All @@ -64,7 +63,7 @@ public static void main(String[] mainArgs) {
@BackgroundColor("Green")
@DirectSelect(Car.class)
@ChildForEach(ObservableListExtractor.SUBINSTANCES.class)
public static class GSInstancesComposite extends org.genericsystem.reactor.az3.GSComposite {
public static class GSInstancesComposite extends GSComposite {

}

Expand Down Expand Up @@ -100,28 +99,80 @@ public static class GSTypeAttributesRow extends GSComposite {
@ChildFlexDirection("row")
@ChildForEach(ObservableListExtractor.ATTRIBUTES_OF_INSTANCES.class)
@ReactorDependencies({ GSHeaderComponent.class, GSContentComponent.class })
// PB here, the parent is not exactly le good ... that change behavior of parent search annotation @ParentReactorDependency
@Parent(GSContentComponent.class)
public static class GSInstanceAttributesRow extends GSComposite {

}

@BackgroundColor("Brown")
@ChildForEach(ObservableListExtractor.HOLDERS.class)
@ReactorDependencies({ GSContentComponent.class })
@ChildReactorDependencies(GSValueComponents2.class)
@MarginRight("1px")
@MarginBottom("1px")
public static class GSHolders extends GSComposite {

}

@DirectSelect(Power.class)
@BackgroundColor("Yellow")
// @DirectSelect(Power.class)
@BackgroundColor("Purple")
@FlexDirectionStyle(FlexDirection.ROW)
@ChildForEach(ObservableListExtractor.COMPONENTS.class)
@ReactorDependencies({ GSHeaderComponent.class, GSContentComponent.class })
public static class GSValueComponents extends GSComposite {

}

@ChildForEach(ObservableListExtractor.OTHER_COMPONENTS_1.class)
public static class GSValueComponents1 extends GSValueComponents {

}

@BackgroundColor("Yellow")
@ChildForEach(ObservableListExtractor.OTHER_COMPONENTS_2.class)
public static class GSValueComponents2 extends GSValueComponents {

}

@DirectSelect(AudiTT.class)
@ReactorDependencies(GSCell.class)
public static class TestCell extends GSComposite {
}

@DirectSelect(CarColor.class)
public static class GSCell extends GSHolders {

}

@DirectSelect(Car.class)
@ReactorDependencies({ GSHeaderComponent.class, GSContentComponent.class })
@ChildReactorDependencies(decorate = GSHeaderComponent.class, value = GSTypeAttributesRow.class)
@ChildReactorDependencies(GSInstanceAttributesRow.class)
@ChildFlexDirection("row")
@Style(propertyName = "margin", propertyValue = "4px")
public static class GSTypeLabeledInstancesComposite extends GSInstancesComposite {

}

@DirectSelect(Car.class)
@ChildReactorDependencies(decorate = GSHeaderComponent.class, value = GSTypeAttributesRowWithComponents.class)
@ChildReactorDependencies(GSInstanceAttributesRowWithComponents.class)
public static class GSTypeTableInstancesComposite extends GSTypeLabeledInstancesComposite {

}

@Styles.Color("#000000")
@BackgroundColor("purple")
@ChildReactorDependencies(decorate = GSHeaderComponent.class, value = GSValueComponents1.class)
@ChildReactorDependencies(GSValueComponents1.class)
public static class GSTypeAttributesRowWithComponents extends GSTypeAttributesRow {

}

@ChildReactorDependencies(decorate = GSHeaderComponent.class, value = GSValueComponents2.class)
@ChildReactorDependencies(GSHolders.class)
public static class GSInstanceAttributesRowWithComponents extends GSInstanceAttributesRow {

}

@SystemGeneric
@Meta(Car.class)
@StringValue("Audi TT")
Expand Down Expand Up @@ -149,88 +200,6 @@ public static class AudiTTGreen {
}
}

@DirectSelect(AudiTT.class)
@ReactorDependencies(GSCell_.class)
public static class TestCell extends GSComposite {
@DirectSelect(CarColor.class)
public static class GSCell_ extends GSCell {

}
}

// @org.genericsystem.reactor.annotations.ReactorDependencies(GSCellContentComponent.class)
// public static class GSCell extends GSHolders {
// @org.genericsystem.reactor.annotations.ReactorDependencies({ GSSubcell.class })
// public static class GSCellContentComponent extends GSContentComponent {
// public static class GSSubcell extends GSValueComponents {
//
// }
// }
// }

@ChildReactorDependencies(GSSubcell.class)
public static class GSCell extends GSHolders {
@Parent(GSContentComponent.class)
public static class GSSubcell extends GSValueComponents {

}
}

@DirectSelect(Car.class)
@ReactorDependencies({ GSHeaderComponent_.class, GSInstanceAttributesRow.class })
@ChildReactorDependencies(GSInstanceAttributesRow.class)
@ChildFlexDirection("row")
public static class GSTypeLabeledInstancesComposite extends GSInstancesComposite {
@org.genericsystem.reactor.annotations.ReactorDependencies({ GSTypeAttributesRow_.class })
public static class GSHeaderComponent_ extends GSHeaderComponent {
public static class GSTypeAttributesRow_ extends GSTypeAttributesRow {

}
}

// @Parent(GSContentComponent.class)
// @ChildReactorDependencies(GSContentComponent.class)
// public static class GSInstanceAttributesRow_ extends GSInstanceAttributesRow {
//
// }

// @org.genericsystem.reactor.annotations.ReactorDependencies({ GSInstanceAttributesRow_.class })
// public static class GSInstanceContentComponent_ extends GSContentComponent {
// public static class GSInstanceAttributesRow_ extends GSInstanceAttributesRow {
//
// }
// }
}

@SystemGeneric
@Components(Power.class)
@StringValue("Unit")
public static class Unit {
}

// @org.genericsystem.reactor.annotations.DirectSelect(Car.class)
// @org.genericsystem.reactor.annotations.ReactorDependencies({ GSHeaderComponent_.class, GSInstanceContentComponent__.class })
// @ChildReactorDependencies(GSInstanceContentComponent__.class)
// public static class GSTypeTableInstancesComposite extends GSTypeLabeledInstancesComposite {
// @org.genericsystem.reactor.annotations.ReactorDependencies({ GSInstanceAttributesRow__.class })
// public static class GSInstanceContentComponent__ extends GSInstanceContentComponent_ {
// @org.genericsystem.reactor.annotations.ReactorDependencies({ GSInstanceNameComponent.class, GSHoldersContentComponent.class })
// public static class GSInstanceAttributesRow__ extends GSInstanceAttributesRow_ {
// @org.genericsystem.reactor.annotations.ReactorDependencies(GSInstanceNameSubcell_.class)
// public static class GSInstanceNameComponent extends GSHeaderComponent {
// @BackgroundColor("Orange")
// public static class GSInstanceNameSubcell_ extends GSValueComponents {
//
// }
// }
//
// @org.genericsystem.reactor.annotations.ReactorDependencies({ GSCell__.class })
// public static class GSHoldersContentComponent extends GSContentComponent {
// public static class GSCell__ extends GSCell {
//
// }
// }
// }
// }
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.genericsystem.reactor.az.GSTagImpl;
import org.genericsystem.reactor.az3.GSComposite.GSContentComponent;

/**
* @author Nicolas Feybesse
Expand All @@ -22,14 +24,24 @@
@Target({ ElementType.TYPE })
@Inherited
public @interface ParentReactorDependencies {
int pos() default 0;
int value() default 0;
}

@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@Inherited
@Repeatable(ChildReactorDependenciesMult.class)
public @interface ChildReactorDependencies {
Class<? extends GSTagImpl>[] value();
Class<? extends GSTagImpl> decorate() default GSContentComponent.class;

Class<? extends GSTagImpl> value();
}

@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@Inherited
public @interface ChildReactorDependenciesMult {
ChildReactorDependencies[] value();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,30 @@
import org.genericsystem.reactor.annotations.ForEach.ParentForEach;
import org.genericsystem.reactor.annotations.ReactorDependencies;
import org.genericsystem.reactor.annotations.ReactorDependencies.ChildReactorDependencies;
import org.genericsystem.reactor.annotations.ReactorDependencies.ParentReactorDependencies;
import org.genericsystem.reactor.annotations.Styles.ChildFlexDirection;
import org.genericsystem.reactor.annotations.Styles.Flex;
import org.genericsystem.reactor.annotations.Styles.Overflow;
import org.genericsystem.reactor.annotations.Styles.ParentFlexDirection;
import org.genericsystem.reactor.az3.GSComposite.GSContentComponent;
import org.genericsystem.reactor.az3.GSComposite.GSFooterComponent;
import org.genericsystem.reactor.az3.GSComposite.GSFooterComponent.GSFooterComponentLabel;
import org.genericsystem.reactor.az3.GSComposite.GSHeaderComponent;
import org.genericsystem.reactor.az3.GSComposite.GSHeaderComponent.GSHeaderComponentLabel;
import org.genericsystem.reactor.gstag.HtmlLabel.GSLabelDisplayer;

@Flex("1 1 0%")
@Overflow("hidden")
@ReactorDependencies({ GSComposite.GSContentComponent.class })
@ChildFlexDirection("column")
@ChildReactorDependencies(GSContentComponent.GSContentComponentLabel.class)
@ChildReactorDependencies(decorate = GSHeaderComponent.class, value = GSHeaderComponentLabel.class)
@ChildReactorDependencies(decorate = GSFooterComponent.class, value = GSFooterComponentLabel.class)
public abstract class GSComposite extends GSCompositeDiv {

@Flex("1 1 0%")
@Overflow("hidden")
@ParentForEach
@ParentFlexDirection
@ParentReactorDependencies
public static class GSContentComponent extends GSCompositeDiv {
public static class GSContentComponentLabel extends GSLabelDisplayer {

Expand All @@ -32,7 +36,6 @@ public static class GSContentComponentLabel extends GSLabelDisplayer {
@Flex("1 1 0%")
@Overflow("hidden")
@ParentFlexDirection
@ReactorDependencies(GSHeaderComponent.GSHeaderComponentLabel.class)
public static class GSHeaderComponent extends GSCompositeDiv {
public static class GSHeaderComponentLabel extends GSLabelDisplayer {

Expand All @@ -42,7 +45,6 @@ public static class GSHeaderComponentLabel extends GSLabelDisplayer {
@Flex("1 1 0%")
@Overflow("hidden")
@ParentFlexDirection
@ReactorDependencies(GSFooterComponent.GSFooterComponentLabel.class)
public static class GSFooterComponent extends GSCompositeDiv {
public static class GSFooterComponentLabel extends GSLabelDisplayer {

Expand Down
Loading

0 comments on commit a7c6b9a

Please sign in to comment.