Skip to content

Commit

Permalink
#8 - trying to build semantic bundle ...
Browse files Browse the repository at this point in the history
  • Loading branch information
activey committed Oct 15, 2016
1 parent ff31551 commit df32775
Show file tree
Hide file tree
Showing 22 changed files with 274 additions and 77 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.licket.core.id;

import static com.google.common.base.CaseFormat.LOWER_HYPHEN;
import static com.google.common.base.CaseFormat.UPPER_CAMEL;
import static com.google.common.base.Joiner.on;
import static com.google.common.collect.Iterables.toArray;
import static com.google.common.collect.ObjectArrays.concat;
Expand Down Expand Up @@ -42,7 +43,7 @@ public String getValue() {

public String getNormalizedValue() {
return on(SEPARATOR_NORMALIZED)
.join(stream(idParts).map(idPart -> LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, idPart)).toArray());
.join(stream(idParts).map(idPart -> LOWER_HYPHEN.to(UPPER_CAMEL, idPart)).toArray());
}

public boolean hasMore() {
Expand Down
6 changes: 6 additions & 0 deletions licket-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
<artifactId>javafaker</artifactId>
<version>0.10</version>
</dependency>

<dependency>
<groupId>org.licket</groupId>
<artifactId>licket-module-semanticui</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
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.SemanticUIModuleConfiguration;
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.context.annotation.Import;
import org.springframework.core.annotation.Order;

@Configuration
@Import(SemanticUIModuleConfiguration.class)
public class LicketConfiguration {

@LicketRootContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public final void submitForm(T formModelObject, ComponentActionCallback actionCa
protected void onSubmit() {}

@Override
protected void onRender(ComponentRenderingContext renderingContext) {
protected void onRenderContainer(ComponentRenderingContext renderingContext) {
renderingContext.onSurfaceElement(element -> {
// TODO check if element is in fact a <form>
element.setAttribute("(submit)", "submitForm()");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Lists.newArrayList;
import static java.lang.String.format;
import static org.licket.core.view.hippo.ComponentModelSerializer.serializeComponentModel;
import static org.licket.framework.hippo.AssignmentBuilder.assignment;
import static org.licket.framework.hippo.BlockBuilder.block;
Expand Down Expand Up @@ -31,6 +32,7 @@
import org.licket.core.view.hippo.annotation.AngularClassConstructor;
import org.licket.core.view.hippo.annotation.AngularClassFunction;
import org.licket.core.view.hippo.annotation.Name;
import org.licket.core.view.render.ComponentRenderingContext;
import org.licket.framework.hippo.BlockBuilder;
import org.licket.framework.hippo.NameBuilder;
import org.licket.framework.hippo.ObjectLiteralBuilder;
Expand Down Expand Up @@ -103,6 +105,20 @@ public void constructor(BlockBuilder body) {
));
}

@Override
protected final void onRender(ComponentRenderingContext renderingContext) {
// addind # attribute
renderingContext.onSurfaceElement(surfaceElement -> {
surfaceElement.setEmptyAttribute(format("#%s", getCompositeId().getNormalizedValue()));
});

onRenderContainer(renderingContext);
}

protected void onRenderContainer(ComponentRenderingContext renderingContext) {

}

protected final void add(LicketComponent<?> licketComponent) {
if (branches.contains(licketComponent)) {
LOGGER.trace("Licket component [{}] already used as a branch!", licketComponent.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public AbstractLicketList(String id, LicketModel<String> enclosingComponentPrope
}

@Override
protected final void onRender(ComponentRenderingContext renderingContext) {
protected final void onRenderContainer(ComponentRenderingContext renderingContext) {
Optional<LicketComponent<?>> parent = traverseUp(component -> component instanceof AbstractLicketContainer);
if (!parent.isPresent()) {
return;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

28 changes: 28 additions & 0 deletions licket-module-semanticui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "licket-module-semanticui",
"version": "0.0.1-SNAPSHOT",
"repository": "https://github.com/activey/licket.git",
"license": "Apache-2.0",
"scripts": {
"build-ts": "tsc"
},
"dependencies": {
"ng-semantic": "^1.1.11",
"tsc": "^1.20150623.0"
},
"devDependencies": {
"typescript": "~1.5.3",
"@angular/common": "2.0.1",
"@angular/compiler": "2.0.1",
"@angular/core": "2.0.1",
"@angular/forms": "2.0.1",
"@angular/http": "2.0.1",
"@angular/platform-browser": "2.0.1",
"@angular/platform-browser-dynamic": "2.0.1",
"@angular/router": "3.0.0",
"@angular/upgrade": "2.0.1",
"angular2-in-memory-web-api": "0.0.20",
"systemjs": "0.19.27",
"core-js": "^2.4.1"
}
}
67 changes: 67 additions & 0 deletions licket-module-semanticui/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>licket-parent</artifactId>
<groupId>org.licket</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>licket-module-semanticui</artifactId>

<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v6.6.0</nodeVersion>
<npmVersion>3.10.8</npmVersion>
</configuration>
</execution>

<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

<resources>
<resource>
<directory>node_modules/ng-semantic</directory>
<filtering>false</filtering>
<includes>
<include>ng-semantic/**/*.js</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
</build>

<dependencies>
<dependency>
<groupId>org.licket</groupId>
<artifactId>licket-framework</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.licket.semantic;

import static org.licket.framework.hippo.NameBuilder.name;
import static org.licket.framework.hippo.PropertyNameBuilder.property;

import org.licket.core.view.hippo.ngclass.AngularInjectable;
import org.licket.core.view.hippo.ngmodule.AbstractAngularModule;
import org.licket.framework.hippo.PropertyNameBuilder;

/**
* @author activey
*/
public class SemanticUIModule extends AbstractAngularModule {

public SemanticUIModule(AngularInjectable... injectables) {
super(injectables);
}

@Override
public PropertyNameBuilder angularName() {
return property(property(name("ng"), name("http")), name("HttpModule"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.licket.semantic;

import org.licket.core.resource.Resource;
import org.licket.core.view.hippo.ngmodule.AngularModule;
import org.licket.semantic.resource.SemanticUILibraryResource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* @author activey
*/
@Configuration
public class SemanticUIModuleConfiguration {

@Bean
public AngularModule semanticModule() {
return new SemanticUIModule();
}

@Bean
public Resource semanticLibraryResource() {
return new SemanticUILibraryResource();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.licket.semantic.resource;

import org.licket.core.resource.HeadParticipatingResource;
import org.licket.core.resource.javascript.MergedJavascriptStaticResource;

import static org.licket.core.resource.javascript.JavascriptStaticResource.javascriptResource;

/**
* @author activey
*/
public class SemanticUILibraryResource extends MergedJavascriptStaticResource implements HeadParticipatingResource {

public SemanticUILibraryResource() {
super("ng-semantic.all.js",
javascriptResource("modal.js", "ng-semantic/modal/modal.js"),
javascriptResource("segment.js", "ng-semantic/segment/segment.js"),
javascriptResource("ng-semantic", "ng-semantic/ng-semantic.js")

);
}
}
Loading

0 comments on commit df32775

Please sign in to comment.