Examples of StaticMessageSource


Examples of org.springframework.context.support.StaticMessageSource

      // expected
    }
  }

  public void testSetValue_MessageSourceBase() {
    StaticMessageSource ms = new StaticMessageSource();
    RequestContextHolder.setRequestContext(new MockRequestContext());
    try {
      context.getELResolver().setValue(context, ms, "foo", null);
      fail("setValue should fail when the base is a MessageSource");
    } catch (PropertyNotWritableException ex) {
View Full Code Here

Examples of org.springframework.context.support.StaticMessageSource

  }
 
  private EnumTableCellRenderer tetcr;
 
  public void testGetTableCellRendererComponent() {
    StaticMessageSource messageSource = new StaticMessageSource();
    messageSource.addMessage("org.springframework.richclient.table.renderer.EnumTableCellRendererTests$Numbers.ONE", Locale.getDefault(), "one");
    messageSource.addMessage("org.springframework.richclient.table.renderer.EnumTableCellRendererTests$Numbers.TWO", Locale.getDefault(), "two");
    messageSource.addMessage("org.springframework.richclient.table.renderer.EnumTableCellRendererTests$Numbers.THREE", Locale.getDefault(), "three");
    messageSource.addMessage("org.springframework.richclient.table.renderer.EnumTableCellRendererTests$Numbers.FOUR", Locale.getDefault(), "four");
    messageSource.addMessage("org.springframework.richclient.table.renderer.EnumTableCellRendererTests$Numbers.FIVE", Locale.getDefault(), "five");
    messageSource.addMessage("org.springframework.richclient.table.renderer.EnumTableCellRendererTests$Numbers.SIX", Locale.getDefault(), "six");
    messageSource.addMessage("org.springframework.richclient.table.renderer.EnumTableCellRendererTests$Numbers.SEVEN", Locale.getDefault(), "seven");
    messageSource.addMessage("org.springframework.richclient.table.renderer.EnumTableCellRendererTests$Numbers.EIGHT", Locale.getDefault(), "eight");
    messageSource.addMessage("org.springframework.richclient.table.renderer.EnumTableCellRendererTests$Numbers.NINE", Locale.getDefault(), "nine");
    messageSource.addMessage("org.springframework.richclient.table.renderer.EnumTableCellRendererTests$Numbers.TEN", Locale.getDefault(), "ten");
    MessageSourceAccessor msa = new MessageSourceAccessor(messageSource);
    tetcr = new EnumTableCellRenderer(msa);
    Object[][] rowData = {
        { Numbers.ONE },
        { Numbers.TWO },
View Full Code Here

Examples of org.springframework.context.support.StaticMessageSource

    }

    protected void registerBasicServices(DefaultApplicationServices applicationServices) {
        super.registerBasicServices(applicationServices);

        StaticMessageSource messageSource = new StaticMessageSource();
        messageSource.addMessage("dirty.message", Locale.getDefault(), "{0} has changed, original value was {1}.");
        messageSource.addMessage("revert.message", Locale.getDefault(), "Revert value to {0}.");

        messageSource.addMessage("property.label", Locale.getDefault(), "Property");

        applicationServices.setMessageSource(messageSource);
    }
View Full Code Here

Examples of org.springframework.context.support.StaticMessageSource

    StaticApplicationContext appCtx = new StaticApplicationContext();
    appCtx.registerSingleton(beanName1, Object.class);
    appCtx.registerSingleton(beanName2, Object.class);
    appCtx.registerPrototype(beanName3, Object.class);

    StaticMessageSource messageSource = new StaticMessageSource();

    messageSource.addMessage(ProgressMonitoringBeanFactoryPostProcessor.LOADING_APP_CONTEXT_KEY, Locale
        .getDefault(), loadingAppCtxMessage);

    messageSource.addMessage(ProgressMonitoringBeanFactoryPostProcessor.LOADING_BEAN_KEY, Locale.getDefault(),
        loadingBeanMessage);

    ProgressMonitor mockProgressMonitor = (ProgressMonitor) EasyMock.createStrictMock(ProgressMonitor.class);
    mockProgressMonitor.taskStarted(loadingAppCtxMessage, expectedSingletonBeanCount);
    mockProgressMonitor.subTaskStarted(expectedLoadBean1Message);
View Full Code Here

Examples of org.springframework.context.support.StaticMessageSource

    /**
     * Register the application services needed for our tests.
     */
    protected void registerBasicServices( DefaultApplicationServices applicationServices ) {
        applicationServices.setMessageSource(new StaticMessageSource());
    }
View Full Code Here

Examples of org.springframework.context.support.StaticMessageSource

    }
    catch (IllegalStateException e) {
      // test passes
    }

    StaticMessageSource messageSource = new StaticMessageSource();
    beanTableModel.setMessageSource(messageSource);

    beanTableModel.setRowNumbers(false);
  }
View Full Code Here

Examples of org.springframework.context.support.StaticMessageSource

    beanTableModel.setRowNumbers(false);
  }

  protected BaseTableModel getBaseTableModel() {
    return new BeanTableModel(TestBean.class, new StaticMessageSource()) {

      protected String[] createColumnPropertyNames() {
        return new String[] { "stringProperty", "dateProperty" };
      }
View Full Code Here

Examples of org.springframework.context.support.StaticMessageSource

        return new DefaultFieldFace("Some Property", "", "", new LabelInfo("Some Property"), null);
      }
    };
    formModel.add("someProperty", new ValueHolder("value"));

    StaticMessageSource messageSource = new StaticMessageSource();
    messageSource.addMessage("typeMismatch", Locale.getDefault(), "{0} has an invalid format \"{1}\"");
    MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(messageSource);
    provider.setMessageSourceAccessor(messageSourceAccessor);

    ValidationMessage message = provider.getErrorMessage(formModel, "someProperty", "new value",
        new IllegalArgumentException());
View Full Code Here

Examples of org.springframework.context.support.StaticMessageSource

  public void testLoadFieldFace() {
    Icon testIcon = new TestIcon(Color.RED);

    MessageSourceFieldFaceSource fieldFaceSource = new MessageSourceFieldFaceSource();

    StaticMessageSource messageSource = new StaticMessageSource();
    messageSource.addMessage("context.field.caption", Locale.getDefault(), "the caption");
    messageSource.addMessage("context.field.description", Locale.getDefault(), "the description");
    messageSource.addMessage("context.field.label", Locale.getDefault(), "the label");
    messageSource.addMessage("context.field.icon", Locale.getDefault(), "iconName");
    fieldFaceSource.setMessageSourceAccessor(new MessageSourceAccessor(messageSource));

    IconSource mockIconSource = (IconSource) EasyMock.createMock(IconSource.class);
    EasyMock.expect(mockIconSource.getIcon("iconName")).andReturn(testIcon);
    EasyMock.replay(mockIconSource);
View Full Code Here

Examples of org.springframework.context.support.StaticMessageSource

    public void testRegisteredServiceIsReturned() {
        ValueChangeDetector vcd = new DefaultValueChangeDetector();
        getApplicationServices().setValueChangeDetector(vcd);
        assertSame("Expected same object back", vcd, getApplicationServices().getService(ValueChangeDetector.class));

        MessageSource msrc = new StaticMessageSource();
        getApplicationServices().setMessageSource(msrc);
        assertSame("Expected same object back", msrc, getApplicationServices().getService(MessageSource.class));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.