Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
davejsmith committed Aug 28, 2012
2 parents 20436b8 + 9293687 commit 40b2bcd
Show file tree
Hide file tree
Showing 11 changed files with 415 additions and 42 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ table to be formated by Bootstrap
as with Grid an fwtype parameter will format the form with Bootstrap.
based on [Forms](http://twitter.github.com/bootstrap/base-css.html#forms)

## Using BeanDisplay
Add fwtype parameter to the BeanDisplay. If the value is null the BeanDisplat looks as before.
Use values "dl" or "dl-horizontal" to apply mixin.
Any other CSS classes can be additionally specified here, i.e., bootstrap "well".

## Using Alerts
Add fwtype parameter to the Alerts. If the value is null the Alerts looks as before.
Value fwtype="alert" changes look and feel according to [bootstrap alerts](http://twitter.github.com/bootstrap/components.html#alerts).

Until [TAP5-1996](https://issues.apache.org/jira/browse/TAP5-1996) fixed Tap5 alerts will use this mapping:
Tap5 'info' -> 'alert-success'
Tap5 'warn' -> 'alert'
Tap5 'error' -> 'alert-error'


## Customizing Bootstrap:
There are two Tapestry configurations that allow you to customize Bootstrap. First the EnvironmentSetup.class defines
a set of mapped objects that set defaults for most of the components/mixins. For example the following sets the default
Expand Down
57 changes: 27 additions & 30 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.trsvax.bootstrap</groupId>
<groupId>com.trsvax</groupId>
<artifactId>tapestry-bootstrap</artifactId>
<version>2.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>tapestry-bootstrap Tapestry 5 Application</name>
<name>tapestry-bootstrap Tapestry 5 Application</name>
<version>2.1-SNAPSHOT</version>
<description>Integrates Tapestry with Twitter Bootstrap Framework</description>
<url>https://github.com/trsvax/tapestry-bootstrap</url>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/trsvax/tapestry-bootstrap</url>
<url>git@github.com/trsvax/tapestry-bootstrap</url>
<connection>scm:git:git://github.com/trsvax/tapestry-bootstrap.git</connection>
<developerConnection>scm:git:git@github.com:trsvax/tapestry-bootstrap.git</developerConnection>
</scm>
<developers>
<developer>
<id>trsvax</id>
<name>Barry Books</name>
<email>bfb@trsvax.com</email>
</developer>
</developers>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>

<dependencies>
<!-- Too set up an application with a database, change the artifactId below to
Expand Down Expand Up @@ -45,7 +64,7 @@
<dependency>
<groupId>org.got5</groupId>
<artifactId>tapestry5-jquery</artifactId>
<version>3.0.1</version>
<version>3.2.0</version>
</dependency>


Expand Down Expand Up @@ -278,32 +297,10 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
</plugins>
</build>

<repositories>
<repository>
<id>devlab722-repo</id>
<url>http://nexus.devlab722.net/nexus/content/repositories/releases
</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>

<repository>
<id>devlab722-snapshot-repo</id>
<url>http://nexus.devlab722.net/nexus/content/repositories/snapshots
</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>

<repositories>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>oss-sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>

<profiles>
Expand All @@ -327,7 +324,7 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
</distributionManagement>

<properties>
<tapestry-release-version>5.3.2</tapestry-release-version>
<tapestry-release-version>5.3.4</tapestry-release-version>
<servlet-api-release-version>2.5</servlet-api-release-version>
<testng-release-version>5.14.9</testng-release-version>
<easymock-release-version>3.0</easymock-release-version>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.trsvax.bootstrap.environment;


public interface AlertsEnvironment extends FWEnvironment {

}
41 changes: 41 additions & 0 deletions src/main/java/com/trsvax/bootstrap/environment/AlertsValues.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.trsvax.bootstrap.environment;

import com.trsvax.bootstrap.FrameworkMixin;

public class AlertsValues implements AlertsEnvironment {
private boolean isInstrumented;
private String type;
private String prefix = "alert";

public AlertsValues(AlertsEnvironment values) {
if ( values != null ) {
this.type = values.getType(null);
}
}

public boolean isInstrumented() {
return isInstrumented;
}

public void withInstrumented(boolean value) {
isInstrumented = value;
}

public String getType(FrameworkMixin mixin) {
if ( mixin == null ) {
return type;
}
return mixin.getType() == null ? type : mixin.getType();
}

public AlertsValues withType(String type) {
this.type = type;
return this;
}

public String getPrefix() {
return prefix;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.trsvax.bootstrap.environment;


public interface BeanDisplayEnvironment extends FWEnvironment {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.trsvax.bootstrap.environment;

import com.trsvax.bootstrap.FrameworkMixin;

public class BeanDisplayValues implements BeanDisplayEnvironment {
private boolean isInstrumented;
private String type;
private String prefix = "dl";

public BeanDisplayValues(BeanDisplayEnvironment values) {
if ( values != null ) {
this.type = values.getType(null);
}
}

public boolean isInstrumented() {
return isInstrumented;
}

public void withInstrumented(boolean value) {
isInstrumented = value;
}

public String getType(FrameworkMixin mixin) {
if ( mixin == null ) {
return type;
}
return mixin.getType() == null ? type : mixin.getType();
}

public BeanDisplayValues withType(String type) {
this.type = type;
return this;
}

public String getPrefix() {
return prefix;
}

}
36 changes: 24 additions & 12 deletions src/main/java/com/trsvax/bootstrap/services/BootstrapModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
import com.trsvax.bootstrap.BootstrapProvider;
import com.trsvax.bootstrap.FrameworkProvider;
import com.trsvax.bootstrap.FrameworkVisitor;
import com.trsvax.bootstrap.environment.AlertsEnvironment;
import com.trsvax.bootstrap.environment.AlertsValues;
import com.trsvax.bootstrap.environment.BeanDisplayEnvironment;
import com.trsvax.bootstrap.environment.BeanDisplayValues;
import com.trsvax.bootstrap.environment.BreadcrumbEnvironment;
import com.trsvax.bootstrap.environment.BreadcrumbValues;
import com.trsvax.bootstrap.environment.ButtonEnvironment;
Expand All @@ -53,6 +57,8 @@
import com.trsvax.bootstrap.environment.NavValues;
import com.trsvax.bootstrap.environment.TableEnvironment;
import com.trsvax.bootstrap.environment.TableValues;
import com.trsvax.bootstrap.services.bootstrapprovider.AlertsProvider;
import com.trsvax.bootstrap.services.bootstrapprovider.BeanDisplayProvider;
import com.trsvax.bootstrap.services.bootstrapprovider.BootstrapFrameworkVisitor;
import com.trsvax.bootstrap.services.bootstrapprovider.BootstrapVisitor;
import com.trsvax.bootstrap.services.bootstrapprovider.BreadcrumbProvider;
Expand Down Expand Up @@ -84,7 +90,6 @@ public static void bind(ServiceBinder binder) {
binder.bind(ExcludeVisitor.class,ExcludeVisitorImpl.class);
binder.bind(EnvironmentSetup.class, EnvironmentSetupImpl.class);


binder.bind(BootstrapProvider.class,BreadcrumbProvider.class).withId("BootstrapBreadcrumb");
binder.bind(BootstrapProvider.class,ButtonProvider.class).withId("BootstrapButton");
binder.bind(BootstrapProvider.class,ButtonGroupProvider.class).withId("BootstrapButtonGroup");
Expand All @@ -95,7 +100,8 @@ public static void bind(ServiceBinder binder) {
binder.bind(BootstrapProvider.class,NavBarProvider.class).withId("BootstrapNavBar");
binder.bind(BootstrapProvider.class,PaginationProvider.class).withId("BootstrapPagination");
binder.bind(BootstrapProvider.class,TableProvider.class).withId("BootstrapTable");

binder.bind(BootstrapProvider.class, BeanDisplayProvider.class).withId("BootstrapBeanDisplay");
binder.bind(BootstrapProvider.class, AlertsProvider.class).withId("BootstrapAlerts");


binder.bind(FrameworkProvider.class,FrameworkProviderImpl.class).withId("FrameworkProvider");
Expand All @@ -107,12 +113,12 @@ public static void contributeComponentClassResolver(Configuration<LibraryMapping
}

public static void contributeJavaScriptStackSource(MappedConfiguration<String, JavaScriptStack> configuration,
@Symbol(JQuerySymbolConstants.SUPPRESS_PROTOTYPE) boolean suppressPrototype) {
@Symbol(JQuerySymbolConstants.SUPPRESS_PROTOTYPE) boolean suppressPrototype) {
if ( suppressPrototype ) {
configuration.overrideInstance(BootstrapFormStack.STACK_ID, BootstrapFormStack.class);
}
}
}

public static void contributeBindingSource(MappedConfiguration<String, BindingFactory> configuration,
@InjectService("SessionBindingFactory") BindingFactory sessionBindingFactory,
Expand All @@ -132,7 +138,10 @@ public static void contributeBootstrapProvider(OrderedConfiguration<BootstrapPro
@InjectService("BootstrapNav") BootstrapProvider navProvider,
@InjectService("BootstrapNavBar") BootstrapProvider navBarProvider,
@InjectService("BootstrapPagination") BootstrapProvider paginationProvider,
@InjectService("BootstrapTable") BootstrapProvider tableProvider) {
@InjectService("BootstrapTable") BootstrapProvider tableProvider,
@InjectService("BootstrapBeanDisplay") BootstrapProvider beanDisplayProvider,
@InjectService("BootstrapAlerts") BootstrapProvider alertsProvider)
{
configuration.add("Breadcrumb",breadcrumbProvider);
configuration.add("Button", buttonProvider);
configuration.add("ButtonGroup", buttonGroupProvider);
Expand All @@ -143,7 +152,8 @@ public static void contributeBootstrapProvider(OrderedConfiguration<BootstrapPro
configuration.add("NavBar", navBarProvider);
configuration.add("Pagination", paginationProvider);
configuration.add("Table", tableProvider);

configuration.add("BeanDisplay", beanDisplayProvider);
configuration.add("Alerts", alertsProvider);
}

@Marker(Primary.class)
Expand All @@ -161,7 +171,7 @@ public static void provideFrameworks(MappedConfiguration<String, FrameworkProvid
*/

@Contribute(ComponentClassTransformWorker2.class)
public static void provideWorkers(OrderedConfiguration<ComponentClassTransformWorker2> workers) {
public static void provideWorkers(OrderedConfiguration<ComponentClassTransformWorker2> workers) {
workers.addInstance("ConnectWorker", ConnectWorker.class);
workers.addInstance("ExcludeWorker", ExcludeWorker.class);
workers.addInstance("FrameworkMixinWorker", FrameworkMixinWorker.class);
Expand All @@ -176,6 +186,8 @@ public static void provideEnvironmentSetup(MappedConfiguration<Class, Object> co
configuration.add(NavEnvironment.class, new NavValues(null));
configuration.add(GridPagerEnvironment.class, new GridPagerValues(null));
configuration.add(TableEnvironment.class, new TableValues(null));
configuration.add(BeanDisplayEnvironment.class, new BeanDisplayValues(null));
configuration.add(AlertsEnvironment.class, new AlertsValues(null));
}

public void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration,
Expand Down Expand Up @@ -282,12 +294,12 @@ public static void provideDefaultBeanBlocks(Configuration<BeanBlockContribution>
}

private static void addEditBlock(Configuration<BeanBlockContribution> configuration, String dataType) {
addEditBlock(configuration, dataType, dataType);
}
addEditBlock(configuration, dataType, dataType);
}

private static void addEditBlock(Configuration<BeanBlockContribution> configuration, String dataType, String blockId) {
configuration.add(new EditBlockContribution(dataType, "tb/AppPropertyEditBlocks", blockId));
}
configuration.add(new EditBlockContribution(dataType, "tb/AppPropertyEditBlocks", blockId));
}

private static void addDisplayBlock(Configuration<BeanBlockContribution> configuration, String dataType)
{
Expand Down
Loading

0 comments on commit 40b2bcd

Please sign in to comment.