Search in sources :

Example 1 with DefaultButtonImageResource

use of org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource in project wicket by apache.

the class FormInputApplication method init.

@Override
protected void init() {
    super.init();
    getResourceSettings().setThrowExceptionOnMissingResource(false);
    // Chinese buttons
    Font font = new Font("SimSun", Font.BOLD, 16);
    DefaultButtonImageResource imgSave = new DefaultButtonImageResource("\u4FDD\u5B58");
    imgSave.setFont(font);
    DefaultButtonImageResource imgReset = new DefaultButtonImageResource("\u91CD\u7F6E");
    imgReset.setFont(font);
    SharedResources sharedResources = getSharedResources();
    sharedResources.add("save", Locale.SIMPLIFIED_CHINESE, imgSave);
    sharedResources.add("reset", Locale.SIMPLIFIED_CHINESE, imgReset);
    // Japanese buttons
    Font fontJa = new Font("Serif", Font.BOLD, 16);
    DefaultButtonImageResource imgSaveJa = new DefaultButtonImageResource("\u4fdd\u5b58");
    imgSaveJa.setFont(fontJa);
    DefaultButtonImageResource imgResetJa = new DefaultButtonImageResource("\u30ea\u30bb\u30c3\u30c8");
    imgResetJa.setFont(fontJa);
    sharedResources.add("save", Locale.JAPANESE, imgSaveJa);
    sharedResources.add("reset", Locale.JAPANESE, imgResetJa);
    // Persian buttons
    Font fontFa = new Font("Serif", Font.BOLD, 16);
    Locale farsi = new Locale("fa", "IR");
    DefaultButtonImageResource imgSaveFa = new DefaultButtonImageResource("\u0630\u062e\u064a\u0631\u0647");
    imgSaveFa.setFont(fontFa);
    DefaultButtonImageResource imgResetFa = new DefaultButtonImageResource("\u0628\u0627\u0632\u0646\u0634\u0627\u0646\u064a");
    imgResetFa.setFont(fontFa);
    getSharedResources().add("save", farsi, imgSaveFa);
    getSharedResources().add("reset", farsi, imgResetFa);
}
Also used : Locale(java.util.Locale) DefaultButtonImageResource(org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource) SharedResources(org.apache.wicket.SharedResources) Font(java.awt.Font)

Example 2 with DefaultButtonImageResource

use of org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource in project wicket by apache.

the class LinkomaticApplication method init.

@Override
protected void init() {
    super.init();
    mountPage("/home", Home.class);
    getSharedResources().add("cancelButton", new DefaultButtonImageResource("Cancel"));
    // log host name and server time in the browser's status bar
    getRequestCycleSettings().addResponseFilter(new ServerHostNameAndTimeFilter());
}
Also used : ServerHostNameAndTimeFilter(org.apache.wicket.examples.ServerHostNameAndTimeFilter) DefaultButtonImageResource(org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource)

Example 3 with DefaultButtonImageResource

use of org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource in project wicket by apache.

the class TestApp1 method init.

@Override
protected void init() {
    getSharedResources().add("cancelButton", new DefaultButtonImageResource("Cancel"));
    setPageManagerProvider(new DefaultPageManagerProvider(this) {

        @Override
        public IPageManager get(IPageManagerContext pageManagerContext) {
            IDataStore dataStore = new HttpSessionDataStore(pageManagerContext, new PageNumberEvictionStrategy(100));
            IPageStore pageStore = new DefaultPageStore(new JavaSerializer(getApplicationKey()), dataStore, getStoreSettings().getInmemoryCacheSize());
            return new PageStoreManager(getName(), pageStore, pageManagerContext);
        }
    });
}
Also used : IPageStore(org.apache.wicket.pageStore.IPageStore) IPageManager(org.apache.wicket.page.IPageManager) PageStoreManager(org.apache.wicket.page.PageStoreManager) DefaultButtonImageResource(org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource) HttpSessionDataStore(org.apache.wicket.pageStore.memory.HttpSessionDataStore) PageNumberEvictionStrategy(org.apache.wicket.pageStore.memory.PageNumberEvictionStrategy) JavaSerializer(org.apache.wicket.serialize.java.JavaSerializer) IPageManagerContext(org.apache.wicket.page.IPageManagerContext) DefaultPageManagerProvider(org.apache.wicket.DefaultPageManagerProvider) IDataStore(org.apache.wicket.pageStore.IDataStore) DefaultPageStore(org.apache.wicket.pageStore.DefaultPageStore)

Example 4 with DefaultButtonImageResource

use of org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource in project wicket by apache.

the class ThumbnailImageResourceTest method testThumbnailImageResource.

/**
 * <a href="https://issues.apache.org/jira/browse/WICKET-3649">WICKET-3649</a>
 *
 * @throws IOException
 */
@Test
public void testThumbnailImageResource() throws IOException {
    DefaultButtonImageResource unscaled = new DefaultButtonImageResource(60, 60, "");
    unscaled.setFormat("jpg");
    ThumbnailImageResource scaledImageResource = new ThumbnailImageResource(unscaled, 30);
    tester.startResource(scaledImageResource);
    byte[] response = tester.getLastResponse().getBinaryContent();
    InputStream in = new ByteArrayInputStream(response);
    BufferedImage scaledImage = ImageIO.read(in);
    assertEquals(30, scaledImage.getWidth());
    assertEquals(30, scaledImage.getHeight());
}
Also used : DefaultButtonImageResource(org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) BufferedImage(java.awt.image.BufferedImage) Test(org.junit.Test)

Example 5 with DefaultButtonImageResource

use of org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource in project wicket by apache.

the class ImagesApplication method init.

@Override
protected void init() {
    super.init();
    getSharedResources().add("cancelButton", new DefaultButtonImageResource("Cancel"));
}
Also used : DefaultButtonImageResource(org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource)

Aggregations

DefaultButtonImageResource (org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource)6 DefaultPageManagerProvider (org.apache.wicket.DefaultPageManagerProvider)2 IPageManager (org.apache.wicket.page.IPageManager)2 IPageManagerContext (org.apache.wicket.page.IPageManagerContext)2 PageStoreManager (org.apache.wicket.page.PageStoreManager)2 DefaultPageStore (org.apache.wicket.pageStore.DefaultPageStore)2 IDataStore (org.apache.wicket.pageStore.IDataStore)2 IPageStore (org.apache.wicket.pageStore.IPageStore)2 HttpSessionDataStore (org.apache.wicket.pageStore.memory.HttpSessionDataStore)2 PageNumberEvictionStrategy (org.apache.wicket.pageStore.memory.PageNumberEvictionStrategy)2 JavaSerializer (org.apache.wicket.serialize.java.JavaSerializer)2 Font (java.awt.Font)1 BufferedImage (java.awt.image.BufferedImage)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 Locale (java.util.Locale)1 SharedResources (org.apache.wicket.SharedResources)1 ServerHostNameAndTimeFilter (org.apache.wicket.examples.ServerHostNameAndTimeFilter)1 Test (org.junit.Test)1