-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#8 - external module PoC
- Loading branch information
Showing
164 changed files
with
2,806 additions
and
2,278 deletions.
There are no files selected for viewing
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
2 changes: 1 addition & 1 deletion
2
...ava/org/licket/core/common/Suppliers.java → ...a/org/licket/core/supplier/Suppliers.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package org.licket.core.common; | ||
package org.licket.core.supplier; | ||
|
||
import java.util.function.Supplier; | ||
|
||
|
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
37 changes: 15 additions & 22 deletions
37
licket-demo/src/main/java/org/licket/demo/licket/LicketConfiguration.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 |
---|---|---|
@@ -1,47 +1,40 @@ | ||
package org.licket.demo.licket; | ||
|
||
import org.licket.core.module.application.LicketComponentModelReloader; | ||
import org.licket.core.resource.HeadParticipatingResource; | ||
import org.licket.demo.view.AddContactPanel; | ||
import org.licket.demo.view.ContactsAppRoot; | ||
import org.licket.demo.view.ContactsPanel; | ||
import org.licket.demo.view.semantic.JqueryLibraryResource; | ||
import org.licket.demo.view.semantic.SemanticLibraryResource; | ||
import org.licket.demo.view.semantic.SemanticStylesheetResource; | ||
import org.licket.semantic.SemanticUIPluginConfiguration; | ||
import org.licket.semantic.component.modal.ModalSettings; | ||
import org.licket.semantic.component.modal.ModalSettingsBuilder; | ||
import org.licket.spring.annotation.LicketComponent; | ||
import org.licket.spring.annotation.LicketRootContainer; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.context.annotation.Import; | ||
|
||
import static org.licket.semantic.component.modal.ModalSettingsBuilder.builder; | ||
|
||
@Configuration | ||
@Import(SemanticUIPluginConfiguration.class) | ||
public class LicketConfiguration { | ||
|
||
@LicketRootContainer | ||
public ContactsAppRoot root(@Autowired LicketComponentModelReloader modelReloader) { | ||
return new ContactsAppRoot("contacts-page", contactsPanel(modelReloader), modelReloader); | ||
return new ContactsAppRoot("contacts-page", modelReloader); | ||
} | ||
|
||
@LicketComponent | ||
public ContactsPanel contactsPanel(LicketComponentModelReloader modelReloader) { | ||
public ContactsPanel contactsPanel(@Autowired LicketComponentModelReloader modelReloader) { | ||
return new ContactsPanel("contacts-panel", modelReloader); | ||
} | ||
|
||
@Bean | ||
@Order(10) | ||
public HeadParticipatingResource jqueryResource() { | ||
return new JqueryLibraryResource(); | ||
} | ||
|
||
@Bean | ||
@Order(11) | ||
public HeadParticipatingResource semanticLibrary() { | ||
return new SemanticLibraryResource(); | ||
private ModalSettings modalDialogSettings() { | ||
return builder().build(); | ||
} | ||
|
||
@Bean | ||
@Order(12) | ||
public HeadParticipatingResource semanticStylesheet() { | ||
return new SemanticStylesheetResource(); | ||
@LicketComponent | ||
public AddContactPanel addContactPanel(@Autowired LicketComponentModelReloader modelReloader) { | ||
return new AddContactPanel("add-contact-panel", modelReloader, modalDialogSettings()); | ||
} | ||
} |
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
91 changes: 91 additions & 0 deletions
91
licket-demo/src/main/java/org/licket/demo/view/AddContactPanel.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,91 @@ | ||
package org.licket.demo.view; | ||
|
||
import org.licket.core.module.application.LicketComponentModelReloader; | ||
import org.licket.core.module.application.LicketRemote; | ||
import org.licket.core.view.container.AbstractLicketMultiContainer; | ||
import org.licket.core.view.container.LicketInlineContainer; | ||
import org.licket.core.view.link.AbstractLicketLink; | ||
import org.licket.core.view.link.ComponentActionCallback; | ||
import org.licket.core.view.link.ComponentFunctionCallback; | ||
import org.licket.demo.model.Contact; | ||
import org.licket.demo.service.ContactsService; | ||
import org.licket.demo.view.modal.AddContactFormModalSection; | ||
import org.licket.semantic.component.modal.AbstractSemanticUIModal; | ||
import org.licket.semantic.component.modal.ModalSection; | ||
import org.licket.semantic.component.modal.ModalSettings; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.util.function.BiConsumer; | ||
import java.util.function.Consumer; | ||
|
||
import static org.licket.core.model.LicketComponentModel.emptyComponentModel; | ||
import static org.licket.core.view.LicketComponentView.internalTemplateView; | ||
|
||
/** | ||
* @author grabslu | ||
*/ | ||
public class AddContactPanel extends AbstractLicketMultiContainer<Void> { | ||
|
||
@Autowired | ||
private ContactsService contactsService; | ||
|
||
@Autowired | ||
private LicketRemote remoteCommunication; | ||
|
||
private final ModalSettings modalSettings; | ||
private AbstractSemanticUIModal modal; | ||
private BiConsumer<Contact, ComponentActionCallback> callback; | ||
|
||
public AddContactPanel(String id, LicketComponentModelReloader modelReloader, ModalSettings modalSettings) { | ||
super(id, Void.class, emptyComponentModel(), internalTemplateView(), modelReloader); | ||
this.modalSettings = modalSettings; | ||
} | ||
|
||
public final void onContactAdded(BiConsumer<Contact, ComponentActionCallback> callback) { | ||
this.callback = callback; | ||
} | ||
|
||
@Override | ||
protected void onInitializeContainer() { | ||
add(new AbstractLicketLink("add-contact") { | ||
@Override | ||
protected void onClick(ComponentFunctionCallback callback) { | ||
callback.call(modal.callShow(this)); | ||
} | ||
}); | ||
|
||
add(modal = new AbstractSemanticUIModal("form-modal", modalSettings, modelReloader()) { | ||
|
||
@Override | ||
protected void onInitializeBody(ModalSection bodySection, String contentId) { | ||
bodySection.add(new AddContactFormModalSection(contentId, modelReloader()) { | ||
@Override | ||
protected void onInitializeContainer() { | ||
add(new AddContactForm("new-contact-form", contactsService, remoteCommunication, modelReloader()) { | ||
|
||
@Override | ||
protected void onAfterSubmit(ComponentActionCallback componentActionCallback) { | ||
if (callback != null) { | ||
callback.accept(getComponentModel().get(), componentActionCallback); | ||
} | ||
onAfterContactAdded(componentActionCallback); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
protected void onInitializeActions(ModalSection content, String contentId) { | ||
content.add(new LicketInlineContainer<Void>(contentId, Void.class, modelReloader()) { | ||
@Override | ||
protected void onInitializeContainer() { | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
} | ||
|
||
protected void onAfterContactAdded(ComponentActionCallback componentActionCallback) {} | ||
} |
28 changes: 21 additions & 7 deletions
28
licket-demo/src/main/java/org/licket/demo/view/ContactsAppRoot.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 |
---|---|---|
@@ -1,17 +1,31 @@ | ||
package org.licket.demo.view; | ||
|
||
import static org.licket.core.model.LicketModel.emptyModel; | ||
import static org.licket.core.view.ComponentView.fromComponentContainerClass; | ||
import static org.licket.core.model.LicketComponentModel.emptyComponentModel; | ||
import static org.licket.core.view.LicketComponentView.fromComponentClass; | ||
|
||
import org.licket.core.module.application.LicketComponentModelReloader; | ||
import org.licket.core.view.container.AbstractLicketContainer; | ||
import org.licket.core.view.container.LicketComponentContainer; | ||
import org.licket.core.view.container.AbstractLicketMultiContainer; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
public class ContactsAppRoot extends AbstractLicketContainer<Void> { | ||
public class ContactsAppRoot extends AbstractLicketMultiContainer<Void> { | ||
|
||
public ContactsAppRoot(String id, LicketComponentContainer contactsPanel, LicketComponentModelReloader modelReloader) { | ||
super(id, Void.class, emptyModel(), fromComponentContainerClass(ContactsAppRoot.class), modelReloader); | ||
@Autowired | ||
private ContactsPanel contactsPanel; | ||
|
||
@Autowired | ||
private AddContactPanel addContactPanel; | ||
|
||
public ContactsAppRoot(String id, LicketComponentModelReloader modelReloader) { | ||
super(id, Void.class, emptyComponentModel(), fromComponentClass(ContactsAppRoot.class), modelReloader); | ||
} | ||
|
||
@Override | ||
protected void onInitializeContainer() { | ||
addContactPanel.onContactAdded((contact, componentActionCallback) -> { | ||
contactsPanel.reloadList(); | ||
componentActionCallback.reload(contactsPanel); | ||
}); | ||
add(contactsPanel); | ||
add(addContactPanel); | ||
} | ||
} |
Oops, something went wrong.