Package de.odysseus.calyxo.panels.conf

Examples of de.odysseus.calyxo.panels.conf.PanelConfig


    if (dispatch.getPath() != null && !dispatch.isRedirect()) {
      Locale locale = i18n.getLocale(request);

      // lookup panel
      PanelConfig panel = support.findPanelConfig(dispatch.getPath(), locale);
      if (panel != null) {
        if (log.isTraceEnabled())
          log.trace("panel " + panel.getName());

        String template = panel.findTemplate(locale);
        if (template == null) {
          throw new ServletException("Could not find path for panel " + panel.toInlineString());
        }
        template = addParams(template, dispatch, "UTF-8");
//        log.debug("path " + path);

        PanelsContext context = support.getOrCreateContext(request, locale);
View Full Code Here


   * @throws IOException
   */
  protected boolean dispatch(HttpServletRequest request, HttpServletResponse response, String path, boolean doInclude) throws ServletException, IOException {
    PanelsSupport support = PanelsSupport.getInstance(request);
    Locale locale = I18nSupport.getInstance(request).getLocale(request);
    PanelConfig panel = support.findPanelConfig(path, locale);
    if (panel != null) {
      if (log.isTraceEnabled()) {
        log.trace("panel " + panel.getName());
      }
      String template = panel.findTemplate(locale);
      if (template == null) {
        throw new ServletException("Cannot find template for panel " + panel.getName());
      }

      PanelsContext context = support.getOrCreateContext(request, locale);

      context.push(panel);
View Full Code Here

      return false;
    }
    HttpServletRequest request = context.getRequest();
    PanelsSupport support = PanelsSupport.getInstance(request);
    Locale locale = I18nSupport.getInstance(request).getLocale(request);
    PanelConfig panel = support.findPanelConfig(forward.getPath(), locale);
    if (panel != null) {
      String template = panel.findTemplate(locale);
      if (template == null) {
        throw new ServletException("Cannot find template for panel " + panel.getName());
      }
      PanelsContext panels = support.getOrCreateContext(request, locale);
      boolean include = !panels.isEmpty() || context.getResponse().isCommitted();

      panels.push(panel);
View Full Code Here

   * Lookup panel within current scope.
   * Delegates search to top stack entry.
   * @param name panel name
   */
  public PanelConfig lookupPanelConfig(String name) {
    PanelConfig panel = top.lookupPanelConfig(name);
    if (panel == null) {
      panel = bottom.lookupPanelConfig(name);
    }
    return panel;
  }
View Full Code Here

      super(previous);
      this.item = item;
    }

    PanelConfig lookupPanelConfig(String name) {
      PanelConfig result = item.getPanelConfig(name);
      if (result == null && previous != null) {
        result = previous.lookupPanelConfig(name);
      }
      return result;
    }
View Full Code Here

    context = new PanelsContext(support, new Locale("", ""));
  }

  public void testPushPop() {

    PanelConfig test = context.lookupPanelConfig("test");
    assertNotNull(test);

    context.push(test);

    assertNotNull(context.lookupParamConfig("param"));
View Full Code Here

    assertNull(context.lookupListConfig("list"));
  }

  public void testLookup() throws ConfigException {

    PanelConfig test = context.lookupPanelConfig("test");
    assertNotNull(test);

    context.push(test); // --> /panel

    ParamConfig param = context.lookupParamConfig("param");
    assertNotNull(param);
    assertEquals("test.param", param.getValue());

    PanelConfig panel = context.lookupPanelConfig("panel");
    assertNotNull(panel);
    context.push(panel); // --> /panel/panel
    param = context.lookupParamConfig("param");
    assertNotNull(param);
    assertEquals("test.panel.param", param.getValue());
View Full Code Here

    assertSame(context, support.getOrCreateContext(request, new Locale("de", "")));
    assertSame(context, support.getContext(new TestPageContext(request)));
  }

  public void testFindPanelConfig() {
    PanelConfig foo = support.findPanelConfig("foo", new Locale("", ""));
    assertNotNull(foo);
    PanelConfig bar = support.findPanelConfig("bar", new Locale("", ""));
    assertNotNull(bar);

    PanelConfig foo_de = support.findPanelConfig("foo", new Locale("de", ""));
    assertNotNull(foo_de);
    PanelConfig bar_de = support.findPanelConfig("bar", new Locale("de", ""));
    assertNotNull(bar_de);
   
    assertNotSame(foo, foo_de);
    assertSame(bar, bar_de);
  }
View Full Code Here

    URL url = getClass().getResource(xml);
    ModuleContext context = new TestModuleContext("test");
    PanelsRootConfigParser parser = new PanelsRootConfigParser(context);
    PanelsRootConfig root = parser.parse(new URL[]{url});
//    System.out.println(root);
    PanelConfig foo = root.findPanelConfig("foo", null);
    assertNotNull(foo);
  }
View Full Code Here

    URL url2 = getClass().getResource(xml2);
    ModuleContext context = new TestModuleContext("test");
    PanelsRootConfigParser parser = new PanelsRootConfigParser(context);
    PanelsRootConfig root = parser.parse(new URL[]{url1,url2});
//    System.out.println(root);
    PanelConfig foo = root.findPanelConfig("foo", null);
    assertNotNull(foo);
    PanelConfig bar = root.findPanelConfig("bar", null);
    assertNotNull(bar);
  }
View Full Code Here

TOP

Related Classes of de.odysseus.calyxo.panels.conf.PanelConfig

Copyright © 2018 www.massapicom. 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.