Exemplo n.º 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());
   }
 }
Exemplo n.º 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);
   }
 }
Exemplo n.º 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);
  }
Exemplo n.º 4
0
 /** {@inheritDoc} */
 public Object getAttribute(String name) {
   if (ACTIVE_LANG_ATTR.equals(name)) {
     return Context.getCurrentContext().getActiveLocaleLabel();
   }
   return super.getAttribute(name);
 }
Exemplo n.º 5
0
 /** {@inheritDoc} */
 public Locale getLocale() {
   return Context.getCurrentContext().getLocale();
 }