Example #1
0
  public Window init() {
    try {
      startup();
    } catch (IOException e) {
      logger.error("Error: ", e);
    }
    TipiScreen echo = (TipiScreen) context.getDefaultTopLevel();

    TipiFrame w = (TipiFrame) echo.getTipiComponent("init");
    if (w == null) {
      throw new RuntimeException("No toplevel found!");
    }
    echo.setWindow(w.getWindow());
    return w.getWindow();
  }
Example #2
0
  @Override
  public TipiContext createContext() throws IOException {

    String stylePath = myServletContext.getRealPath("Default.stylesheet");
    logger.info("StylePath: " + stylePath);
    try {
      FileInputStream fis = new FileInputStream(stylePath);
      Styles.loadStyleSheet(fis);
      fis.close();
    } catch (IOException e) {
      logger.error("Error: ", e);
    }

    if (Styles.DEFAULT_STYLE_SHEET != null) {
      setStyleSheet(Styles.DEFAULT_STYLE_SHEET);
      Style ss = Styles.DEFAULT_STYLE_SHEET.getStyle(WindowPane.class, "Default");
      logger.info(">>> " + ss);
    }
    logger.info("REAL PATH: " + myServletContext.getRealPath("/"));

    // Title.Sub
    EchoTipiContext newContext = new EchoTipiContext(this, null);
    ServletContextResourceLoader servletContextTipiLoader =
        new ServletContextResourceLoader(myServletContext, "tipi");
    newContext.setTipiResourceLoader(servletContextTipiLoader);
    ServletContextResourceLoader servletContextResourceLoader =
        new ServletContextResourceLoader(myServletContext, "resource");
    newContext.setGenericResourceLoader(servletContextResourceLoader);
    //	context.setResourceBaseDirectory(new File(myServletContext.getRealPath("/") +
    // "resource/tipi/"));

    TipiEchoExtension ed = new TipiEchoExtension();
    ed.initialize(newContext);

    getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
    TipiScreen es = new TipiScreen();
    //		newContext.processRequiredIncludes();
    es.setContext(newContext);
    es.createContainer();
    newContext.setDefaultTopLevel(es);
    try {
      logger.info("Context created: " + newContext.hashCode());
      initServlet(newContext, myServletConfig.getInitParameterNames(), ed);
    } catch (Throwable ex) {
      ex.printStackTrace();
    }
    return newContext;
  }