Search in sources :

Example 1 with SharedResources

use of org.apache.wicket.SharedResources 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 SharedResources

use of org.apache.wicket.SharedResources in project wicket by apache.

the class PackageResourceTest method bindAbsolutePackageResource.

/**
 * Tests binding a single absolute package resource.
 *
 * @throws Exception
 */
@Test
public void bindAbsolutePackageResource() throws Exception {
    final SharedResources sharedResources = Application.get().getSharedResources();
    assertNotNull("resource packaged1.txt should be available as a packaged resource", sharedResources.get(PackageResourceTest.class, "packaged1.txt", null, null, null, true));
}
Also used : SharedResources(org.apache.wicket.SharedResources) Test(org.junit.Test)

Aggregations

SharedResources (org.apache.wicket.SharedResources)2 Font (java.awt.Font)1 Locale (java.util.Locale)1 DefaultButtonImageResource (org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource)1 Test (org.junit.Test)1