Beispiel #1
0
        public void initializeSession()
        {
            foreach (String b in session.getBeans().getKeys())
            {
                Bean bean_ = newBean(session.getBeans().getVal(b));
                bean_.setForms(new Map <String, Object>());
                bean_.setDataBase(dataBase);
                bean_.setLanguage(language);
                //bean_.setNavigation(this);
                session.getBeans().put(b, bean_);
            }
            String currentUrl_      = session.getFirstUrl();
            String text_            = FormatHtml.loadPage(assembly, files, currentUrl_, resourcesFolder);
            String currentBeanName_ = FormatHtml.getCurrentBean(text_);

            htmlText = FormatHtml.processImports(text_, session, language, files, resourcesFolder);
            //For title
            currentBeanName = currentBeanName_;
            currentUrl      = currentUrl_;
            setupText(htmlText);
        }
Beispiel #2
0
        public void processAnchorRequest(String _anchorRef)
        {
            String textToBeChanged_;
            Bean   bean_;
            Map <String, Object> forms_;
            String currentUrl_;
            String currentBeanName_;

            if (_anchorRef.Contains(CALL_METHOD))
            {
                Regex  pattern_    = new Regex(REG_EXP_ARGS);
                int    indexPoint_ = _anchorRef.IndexOf(DOT);
                String action_     = _anchorRef
                                     .Substring(indexPoint_ + 1);
                String key_        = action_.replaceAll(REG_EXP_INT, EMPTY_STRING);
                Match  match_      = pattern_.Match(action_);
                String argsString_ = EMPTY_STRING;
                if (match_.Success)
                {
                    argsString_ = match_.Groups[1].Value;
                    //argsString_ = match_.Value;
                }
                MyList <long> args_ = new MyList <long>();
                foreach (String l in StringList.splitStrings(argsString_, COMMA))
                {
                    if (l.isEmpty())
                    {
                        continue;
                    }
                    args_.Add(long.Parse(l));
                }
                String command_  = StringList.getFirstToken(action_, BEGIN_ARGS);
                int    begin_    = _anchorRef.IndexOf(CALL_METHOD) + 1;
                String beanName_ = _anchorRef
                                   .Substring(begin_, indexPoint_ - begin_);
                bean_ = session.getBeans().getVal(beanName_);
                Object return_ = FormatHtml.invokeMethodWithNumbers(
                    bean_, command_, args_.ToArray());
                forms_ = bean_.getForms();
                String urlDest_ = currentUrl;
                if (return_ != null)
                {
                    urlDest_ = session.getNavigation()
                               .getVal(beanName_ + DOT + key_)
                               .getVal(return_.ToString());
                    if (urlDest_ == null)
                    {
                        urlDest_ = currentUrl;
                    }
                }
                foreach (String b in session.getBeans().getKeys())
                {
                    if (!reinitBean(urlDest_, beanName_, b))
                    {
                        continue;
                    }
                    bean_ = session.getBeans().getVal(b);
                    bean_ = newBean(bean_);
                    bean_.setForms(forms_);
                    session.getBeans().put(b, bean_);
                }
                currentUrl_      = urlDest_;
                textToBeChanged_ = FormatHtml.loadPage(assembly, files, StringList.getFirstToken(urlDest_, REF_TAG), resourcesFolder);
                currentBeanName_ = FormatHtml
                                   .getCurrentBean(textToBeChanged_);
                bean_ = session.getBeans().getVal(currentBeanName_);
                bean_.setForms(forms_);
                textToBeChanged_ = FormatHtml.processImports(
                    textToBeChanged_, session, language, files, resourcesFolder);
                currentBeanName = currentBeanName_;
                currentUrl      = currentUrl_;
                setupText(textToBeChanged_);
                return;
            }
            if (_anchorRef.isEmpty())
            {
                return;
            }
            bean_  = session.getBeans().getVal(currentBeanName);
            forms_ = bean_.getForms();
            foreach (String b in session.getBeans().getKeys())
            {
                if (!reinitBean(_anchorRef, currentBeanName, b))
                {
                    continue;
                }
                bean_ = session.getBeans().getVal(b);
                bean_ = newBean(bean_);
                bean_.setForms(forms_);
                session.getBeans().put(b, bean_);
            }
            currentUrl_      = _anchorRef;
            textToBeChanged_ = FormatHtml.loadPage(assembly, files, StringList.getFirstToken(_anchorRef, REF_TAG), resourcesFolder);
            currentBeanName_ = FormatHtml
                               .getCurrentBean(textToBeChanged_);
            bean_ = session.getBeans().getVal(currentBeanName_);
            bean_.setForms(forms_);
            textToBeChanged_ = FormatHtml.processImports(
                textToBeChanged_, session, language, files, resourcesFolder);
            currentBeanName = currentBeanName_;
            currentUrl      = currentUrl_;
            setupText(textToBeChanged_);
        }