Skip to content

Commit

Permalink
gs-reactor: Add link on instance name in table
Browse files Browse the repository at this point in the history
  • Loading branch information
fducroquet committed Oct 3, 2016
1 parent 9b37228 commit fb3e788
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public static void main(String[] mainArgs) {
ApplicationServer.startSimpleGenericApp(mainArgs, AppHtml5.class, "/example-reactor");
}

public AppHtml5() {
createSelectionProperty();
}

@DirectSelect(Car.class)
public static class CarInstancesTable extends TitledInstancesTable {

Expand Down
15 changes: 13 additions & 2 deletions gs-reactor/src/main/java/org/genericsystem/reactor/az3/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.genericsystem.reactor.az3.GSComposite.Header.HeaderLabel;
import org.genericsystem.reactor.az3.Table.ContentRow;
import org.genericsystem.reactor.gstag.HtmlButton;
import org.genericsystem.reactor.gstag.HtmlHyperLink;
import org.genericsystem.reactor.model.ObservableListExtractor;
import org.genericsystem.reactor.model.ObservableValueSelector;

Expand Down Expand Up @@ -54,14 +55,15 @@ public static class FooterRow extends GSComposite {
@BackgroundColor(path = { HeaderRow.class, GSValueComponents.class, Header.class }, value = "#ea0084")
@BackgroundColor(path = { HeaderRow.class, Content.class, GSValueComponents.class, Content.class }, value = "#ea0084")
@BackgroundColor(path = { HeaderRow.class, Content.class, GSValueComponents.class, Header.class }, value = "#ea0084")
@Styles.Color(path = { ContentRow.class, GSValueComponents.class, Header.class }, value = "white")
@Styles.Color(path = { ContentRow.class, GSValueComponents.class, Header.class, InstanceNameLink.class }, value = "white")
@GenericValueBackgroundColor(path = { ContentRow.class, GSValueComponents.class, Header.class }, value = "#3393ff")
@AlignItems(path = { ContentRow.class, GSValueComponents.class, Header.class }, value = "flex-start")
@ReactorDependencies({ HeaderRow.class, ContentRow.class })
@ReactorDependencies(path = HeaderRow.class, value = { GSValueComponents.class, Content.class, ButtonDiv.class })
@ReactorDependencies(path = { HeaderRow.class, Content.class }, value = GSValueComponents.class)
@ReactorDependencies(path = ContentRow.class, value = { GSValueComponents.class, GSHolders.class, ButtonDiv.class })
@ReactorDependencies(path = { ContentRow.class, GSValueComponents.class, Header.class }, value = InstanceNameLink.class)
@ReactorDependencies(path = { ContentRow.class, ButtonDiv.class }, value = RemoveButton.class)
@ReactorDependencies(path = { HeaderRow.class, Content.class }, value = GSValueComponents.class)
@ForEach(path = { HeaderRow.class, Content.class }, value = ObservableListExtractor.ATTRIBUTES_OF_TYPE.class)
@ForEach(path = ContentRow.class, value = ObservableListExtractor.SUBINSTANCES.class)
@ForEach(path = { ContentRow.class, GSHolders.class }, value = ObservableListExtractor.ATTRIBUTES_OF_INSTANCES.class)
Expand Down Expand Up @@ -99,6 +101,15 @@ public static class GSValueComponents extends GSComposite {

}

public static class InstanceNameLink extends HtmlHyperLink {

@Override
public void init() {
bindText();
bindAction(model -> getSelectionProperty(model).setValue(model));
}
}

@KeepFlexDirection
@BackgroundColor("#ea0084")
@MarginRight("1px")
Expand Down

0 comments on commit fb3e788

Please sign in to comment.