Skip to content

Instantly share code, notes, and snippets.

public class ConverterGridDataSource implements GridDataSource {
private final GridDataSource delegate;
private final Converter converter;
public ConverterGridDataSource(GridDataSource delegate, Converter converter) {
this.delegate = delegate;
this.converter = converter;
}
public int getAvailableRows() {
@uklance
uklance / RunNotifierJUnit4ClassRunner.java
Created April 2, 2014 07:51
BlockJUnit4ClassRunner events
package sandbox.junit;
import org.junit.runner.Description;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;
import org.junit.runner.notification.StoppedByUserException;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.InitializationError;
@uklance
uklance / AppModule.java
Last active August 29, 2015 14:01
Tapestry: Custom BeanModel to support "is" getters for javal.ang.Boolean
public class AppModule {
public static BeanModelSource decorateBeanModelSource(BeanModelSource defaultImpl) {
return new MyBeanModelSource(defaultImpl);
}
}
@uklance
uklance / BlockContainer.java
Last active August 29, 2015 14:05
Tapestry5 Dialog Avoiding Nested Forms
public interface BlockContainer {
void addBlock(Block block);
}
@uklance
uklance / MyPage.java
Last active August 29, 2015 14:06
Dynamic template usage
public class MyPage {
@Inject
private DynamicTemplateParser parser;
public DynamicTemplate getMyDynamicTemplate() {
// if you want this to come from a string you might need to
// implement a StringResource by extending AbstractResource
Resource resource = new ClasspathResource("path/to/some-template.tml");
return parser.parseTemplate(resource);
}
public class FileBean {
private UploadedFile file;
public void setUploadedFile(UploadedFile file) {
this.file = file;
}
public UploadedFile getUploadedFile() {
return file;
}
[INFO] +- org.apache.tapestry:tapestry-core:jar:5.4-beta-22:compile
[INFO] | +- org.antlr:antlr-runtime:jar:3.5.2:compile
[INFO] | +- commons-codec:commons-codec:jar:1.5:compile
[INFO] | +- org.apache.tapestry:tapestry-json:jar:5.4-beta-22:compile
[INFO] | \- org.apache.tapestry:tapestry-ioc:jar:5.4-beta-22:compile
[INFO] | +- org.apache.tapestry:tapestry5-annotations:jar:5.4-beta-22:compile
[INFO] | +- org.apache.tapestry:plastic:jar:5.4-beta-22:compile
[INFO] | +- javax.inject:javax.inject:jar:1:compile
[INFO] | \- org.apache.tapestry:tapestry-func:jar:5.4-beta-22:compile
[INFO] +- com.google.code:sitemapgen4j:jar:1.0.1:compile
@uklance
uklance / Page.tml
Last active August 29, 2015 14:08
Tapestry - Render body in parallel
<t:parallel>
<t:someComponent />
</t:parallel>
@uklance
uklance / AssertCommand.java
Last active August 29, 2015 14:15
sproc-unit thoughts
@Events({Event.SCENARIO_THEN, Event.SCENARIO_AFTER})
public class AssertCommand {
@Parameter(requiredGroup="value")
private String sql;
@Parameter(name="attribute", requiredGroup="value")
private String attributeName;
@Parameter(name="expected", required=true)
private String expectedString;