Пример #1
0
 /**
  * Sets the filter used to filter list data
  *
  * @param filterIn name of the filter class to use
  * @throws JspException error occurred creating an instance of the filter
  */
 public void setFilter(String filterIn) throws JspException {
   ClassLoader cl = Thread.currentThread().getContextClassLoader();
   try {
     Class klass = cl.loadClass(filterIn);
     filter = (ListFilter) klass.newInstance();
     Context threadContext = Context.getCurrentContext();
     filter.prepare(threadContext.getLocale());
   } catch (Exception e) {
     throw new JspException(e.getMessage());
   }
 }
Пример #2
0
 void configureLocale() {
   Context ctx = Context.getCurrentContext();
   Locale userLocale = ctx.getLocale();
   Enumeration<Locale> e = super.getLocales();
   while (e.hasMoreElements()) {
     Locale l = e.nextElement();
     locales.add(l);
   }
   if (!locales.contains(userLocale)) {
     locales.add(0, userLocale);
   }
 }
Пример #3
0
  /** @param f the filter to set */
  void setColumnFilter(ListFilter f) throws JspException {
    if (filter != null) {
      String msg =
          "Cannot set the column filter - [%s], "
              + "since the table has been has already assigned a filter - [%s]";

      throw new JspException(String.format(msg, String.valueOf(f), String.valueOf(filter)));
    }
    filter = f;
    Context threadContext = Context.getCurrentContext();
    filter.prepare(threadContext.getLocale());
    manip.filter(filter, pageContext);
  }
Пример #4
0
 /** {@inheritDoc} */
 public Object getAttribute(String name) {
   if (ACTIVE_LANG_ATTR.equals(name)) {
     return Context.getCurrentContext().getActiveLocaleLabel();
   }
   return super.getAttribute(name);
 }
Пример #5
0
 /** {@inheritDoc} */
 public Locale getLocale() {
   return Context.getCurrentContext().getLocale();
 }