Skip to content

Commit

Permalink
#137 - add bind-method to AbstractPopUpComponentController
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHossfeld committed Sep 9, 2020
1 parent 2d672cc commit 78031e1
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ void generate() {
.addStatement("errorPopUpController.setComponent(component)")
.addStatement("component.render()")
.addStatement("component.bind()")
.addStatement("errorPopUpController.bind()")
.addStatement("errorPopUpController.onLoad()");
}
typeSpec.addMethod(createErrorPopUpControllerMethodBuilder.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ public void generate()
createMethod.addStatement("component.setController(controller)")
.addStatement("controller.setComponent(component)")
.addStatement("component.render()")
.addStatement("component.bind()");

.addStatement("component.bind()")
.addStatement("controller.bind()");

createMethod.addStatement("return popUpControllerInstance");
typeSpec.addMethod(createMethod.build());

// MethodSpec.Builder finishCreateMethod = MethodSpec.methodBuilder("onFinishCreating")
// .addAnnotation(ClassName.get(Override.class))
// .addModifiers(Modifier.PUBLIC)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.Arrays;

/**
* Build with Nalu version >>HEAD-SNAPSHOT<< at >>2020.08.31-11:44:41<<
* Build with Nalu version >>HEAD-SNAPSHOT<< at >>2020.09.09-20:24:23<<
*/
public final class ErrorPopUpAnnotationOkImpl extends AbstractApplication<MockContext> implements ErrorPopUpAnnotationOk {
public ErrorPopUpAnnotationOkImpl() {
Expand All @@ -33,7 +33,7 @@ public void loadLoggerConfiguration() {

@Override
public void logProcessorVersion() {
this.eventBus.fireEvent(LogEvent.create() .sdmOnly(true) .addMessage("=================================================================================") .addMessage("Nalu processor version >>HEAD-SNAPSHOT<< used to generate this source") .addMessage("=================================================================================") .addMessage(""));
this.eventBus.fireEvent(LogEvent.create().sdmOnly(true).addMessage("=================================================================================").addMessage("Nalu processor version >>HEAD-SNAPSHOT<< used to generate this source").addMessage("=================================================================================").addMessage(""));
}

@Override
Expand Down Expand Up @@ -87,6 +87,7 @@ public void loadErrorPopUpController() {
errorPopUpController.setComponent(component);
component.render();
component.bind();
errorPopUpController.bind();
errorPopUpController.onLoad();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public PopUpControllerInstance create() {
controller.setComponent(component);
component.render();
component.bind();
controller.bind();
return popUpControllerInstance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ public void setComponent(V component) {
this.component = component;
}

/**
* will be called, one time, when a popup-controller is created.
*/
@Override
public void bind() {
// if you need to bind some handlers and would like to do this in a separate method
// just override this method.
}

/**
* The method is called right after the istance is created.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ public final void setComponent(V component) {
this.component = component;
}

/**
* will be called, one time, when a popup-controller is created.
*/
@Override
public void bind() {
// if you need to bind some handlers and would like to do this in a separate method
// just override this method.
}

/**
* The method is called before the show-method.
* A good place to do some initialization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ public interface IsErrorPopUpController<V> {
@NaluInternalUse
void setComponent(V component);

/**
* will be called one time, when a popup gets created.
*/
void bind();

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

public interface IsPopUpComponent<C extends IsPopUpComponent.Controller> {

/**
* Render your component here
*/
void render();

void bind();
Expand All @@ -29,8 +32,14 @@ public interface IsPopUpComponent<C extends IsPopUpComponent.Controller> {
@NaluInternalUse
void setController(C controller);

/**
* Call this method to show the component
*/
void show();

/**
* Call this method to hide the component
*/
void hide();

interface Controller {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,19 @@ public interface IsPopUpController<V> {
@NaluInternalUse
void setComponent(V component);

/**
* will be called one time, when a popup gets created.
*/
void bind();

/**
* Will be called before a popup gets visible
*/
void onBeforeShow();

/**
* sow hte popup
*/
void show();

}

0 comments on commit 78031e1

Please sign in to comment.