-
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.
#8 - first version of modal component with form inside! :D all stuff …
…finally migrated onto vue.js, lots of changes, new stuff introduced, yummy ;}
- Loading branch information
Showing
28 changed files
with
609 additions
and
384 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
18 changes: 16 additions & 2 deletions
18
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,26 +1,40 @@ | ||
package org.licket.demo.licket; | ||
|
||
import org.licket.core.module.application.LicketComponentModelReloader; | ||
import org.licket.demo.view.AddContactPanel; | ||
import org.licket.demo.view.ContactsAppRoot; | ||
import org.licket.demo.view.ContactsPanel; | ||
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.Configuration; | ||
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); | ||
} | ||
|
||
private ModalSettings modalDialogSettings() { | ||
return builder().build(); | ||
} | ||
|
||
@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) {} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
licket-demo/src/main/java/org/licket/demo/view/modal/AddContactFormModalSection.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,18 @@ | ||
package org.licket.demo.view.modal; | ||
|
||
import org.licket.core.module.application.LicketComponentModelReloader; | ||
import org.licket.core.view.container.AbstractLicketMonoContainer; | ||
|
||
import static org.licket.core.model.LicketComponentModel.emptyComponentModel; | ||
import static org.licket.core.view.LicketComponentView.fromComponentClass; | ||
|
||
/** | ||
* @author grabslu | ||
*/ | ||
public class AddContactFormModalSection extends AbstractLicketMonoContainer<Void> { | ||
|
||
public AddContactFormModalSection(String id, LicketComponentModelReloader modelReloader) { | ||
super(id, Void.class, emptyComponentModel(), | ||
fromComponentClass(AddContactFormModalSection.class), modelReloader); | ||
} | ||
} |
17 changes: 0 additions & 17 deletions
17
licket-demo/src/main/resources/org/licket/demo/view/AddContactForm.html
This file was deleted.
Oops, something went wrong.
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
19 changes: 19 additions & 0 deletions
19
licket-demo/src/main/resources/org/licket/demo/view/modal/AddContactFormModalSection.html
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,19 @@ | ||
<div xmlns:lick="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"> | ||
<form lick:id="new-contact-form" class="ui form"> | ||
<div class="two fields"> | ||
<div class="field"> | ||
<label>Name</label> | ||
<input type="text" placeholder="Full Name" lick:id="name" /> | ||
</div> | ||
|
||
<div class="field"> | ||
<label>Description</label> | ||
<input type="text" placeholder="Some description" lick:id="description" /> | ||
</div> | ||
</div> | ||
|
||
<div class="ui submit button" lick:id="add"> | ||
Add one | ||
</div> | ||
</form> | ||
</div> |
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
Oops, something went wrong.