⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 layoutmanagerportlet.java

📁 GridSphere 门户 提供一个基于 portlet 的高级开放源代码门户。GridSphere 是在欧盟提供基金的 GridLab 项目下开发的
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
            PortletNavMenu menu = (PortletNavMenu) tab.getParentComponent();            int index = menu.getIndexOfTab(tab);            if (index < (menu.getTabCount() - 1)) {                menu.setSelectedPortletTabIndex(index + 1);            } else if (index > 0) {                menu.setSelectedPortletTabIndex(index - 1);            }            menu.removeTab(tab);        }        pageFactory.savePortletPageMaster(page);    }    public void doMoveTabLeft(ActionFormEvent event) throws PortletException, IOException {        PortletRequest req = event.getActionRequest();        String sessionId = req.getPortletSession().getId();        PortletPage page = (PortletPage) pages.get(sessionId);        HiddenFieldBean compHF = event.getHiddenFieldBean("compHF");        String activeComp = compHF.getValue();        PortletComponent comp = page.getActiveComponent(activeComp);        if (comp instanceof PortletTab) {            PortletTab tab = (PortletTab) comp;            PortletNavMenu pane = (PortletNavMenu) tab.getParentComponent();            int index = pane.getIndexOfTab(tab);            pane.removeTab(tab);            pane.insertTab(tab, index - 1);            pane.setSelectedPortletTabIndex(index - 1);        }        pageFactory.savePortletPageMaster(page);    }    public void doMoveTabRight(ActionFormEvent event) throws PortletException, IOException {        PortletRequest req = event.getActionRequest();        String sessionId = req.getPortletSession().getId();        PortletPage page = (PortletPage) pages.get(sessionId);        HiddenFieldBean compHF = event.getHiddenFieldBean("compHF");        String activeComp = compHF.getValue();        PortletComponent comp = page.getActiveComponent(activeComp);        if (comp instanceof PortletTab) {            PortletTab tab = (PortletTab) comp;            PortletNavMenu pane = (PortletNavMenu) tab.getParentComponent();            int index = pane.getIndexOfTab(tab);            pane.removeTab(tab);            pane.insertTab(tab, index + 1);            pane.setSelectedPortletTabIndex(index + 1);        }        pageFactory.savePortletPageMaster(page);    }    public void doCancel(ActionFormEvent event) throws PortletException, IOException {        // do nothing    }    public void doShowLayout(ActionFormEvent event) throws PortletException, IOException {        doShowLayout(event.getActionRequest(), event.getActionResponse(), event);    }    public void doShowLayout(RenderFormEvent event) throws PortletException, IOException {        RenderRequest req = event.getRenderRequest();        RenderResponse res = event.getRenderResponse();        doShowLayout(req, res, event);        setNextState(event.getRenderRequest(), VIEW_JSP);    }    public void doShowLayout(PortletRequest req, PortletResponse res, FormEvent event) throws PortletException, IOException {        PortletSession session = req.getPortletSession();        Set<String> layoutIds = pageFactory.getEditableLayoutIds();        // set guest page as the selected page        if (session.getAttribute(SELECTED_LAYOUT) == null) {            session.setAttribute(SELECTED_LAYOUT, PortletPageFactory.GUEST_PAGE);        }        String selectedLayout = (String) session.getAttribute(SELECTED_LAYOUT);        req.setAttribute("pageName", selectedLayout);        ListBoxBean layoutsLB = event.getListBoxBean("layoutsLB");        layoutsLB.clear();        for (String layoutId : layoutIds) {            ListBoxItemBean item = new ListBoxItemBean();            item.setName(layoutId);            item.setValue(layoutId);            if (layoutId.equalsIgnoreCase(selectedLayout)) item.setSelected(true);            layoutsLB.addBean(item);        }        String theme = (String) req.getPortletSession().getAttribute(SportletProperties.LAYOUT_THEME, PortletSession.APPLICATION_SCOPE);        //String theme = portalConfigService.getProperty(PortalConfigService.DEFAULT_THEME);        String renderkit = (String) req.getPortletSession().getAttribute(SportletProperties.LAYOUT_RENDERKIT, PortletSession.APPLICATION_SCOPE);        ListBoxBean themesLB = event.getListBoxBean("themesLB");        themesLB.clear();        String themesPath = getPortletConfig().getPortletContext().getRealPath("/themes");        /// retrieve the current renderkit        themesPath += "/" + renderkit;        String[] themes = null;        File f = new File(themesPath);        if (f.isDirectory()) {            themes = f.list();        }        for (int i = 0; i < themes.length; i++) {            ListBoxItemBean lb = new ListBoxItemBean();            lb.setValue(themes[i].trim());            if (themes[i].trim().equalsIgnoreCase(theme)) lb.setSelected(true);            themesLB.addBean(lb);        }        PortletContext context = getPortletConfig().getPortletContext();        // theme has to be set before it is inited        req.setAttribute(SportletProperties.LAYOUT_EDIT_MODE, "true");        String cid = (String) req.getAttribute(SportletProperties.COMPONENT_ID);        String sessionId = session.getId();        String extraURI = "&" + SportletProperties.COMPONENT_ID + "=" + cid +                "&" + SportletProperties.DEFAULT_PORTLET_ACTION + "=doShowLayout";        log.debug("extraURI= " + extraURI);        req.setAttribute(SportletProperties.EXTRA_QUERY_INFO, extraURI);        PortletPage page = (PortletPage) pages.get(sessionId);        if (page == null) page = createLayout(event, req);        CheckBoxBean showModesCB = event.getCheckBoxBean("showModesCB");        CheckBoxBean showStatesCB = event.getCheckBoxBean("showStatesCB");        showStatesCB.setSelected(page.getDisplayStates());        showModesCB.setSelected(page.getDisplayModes());        // set page details        event.getTextFieldBean("titleTF").setValue(page.getTitle());        event.getTextFieldBean("keywordsTF").setValue(page.getKeywords());        GridSphereEventImpl gsevent = new GridSphereEventImpl(context, (HttpServletRequest) req, (HttpServletResponse) res);        req.setAttribute(SportletProperties.IGNORE_PARSING, "true");        String controlUI = "";        String compid = req.getParameter(SportletProperties.COMPONENT_ID_2);        // put new cid in before render is called        if (compid != null) {            gsevent.setComponentID(compid);            System.err.println("\n\n\nfound compid2 = " + compid);        }        String action = req.getParameter(SportletProperties.DEFAULT_PORTLET_ACTION_2);        if (action != null) {            gsevent.setAction(new DefaultPortletAction(action));            System.err.println("found action2 = " + action);        }        if (req.getParameter("usertable") != null) {            page.init(req, new ArrayList<ComponentIdentifier>());            page.actionPerformed(gsevent);            pageFactory.savePortletPageMaster(page);            page.init(req, new ArrayList<ComponentIdentifier>());        }        if (compid != null) {            PortletComponent comp = page.getActiveComponent(compid);            if (comp instanceof PortletFrame) {                log.debug("it's a frame!");                PortletFrame frame = (PortletFrame) comp;                // don't perform action on portlet frame                if (action.equals(PortletFrame.DELETE_PORTLET)) {                    PortletComponent parent = frame.getParentComponent();                    parent.remove(frame);                    pageFactory.savePortletPageMaster(page);                } else {                    controlUI = "frame";                }                if (!frame.getTransparent()) {                    req.setAttribute("isTitle", "true");                }                ListBoxBean portletsLB = event.getListBoxBean("portletsLB");                Collection<ApplicationPortlet> appColl = portletRegistryService.getAllApplicationPortlets();                Locale loc = req.getLocale();                for (ApplicationPortlet app : appColl) {                    String concID = app.getConcretePortletID();                    // we don't want to list PortletServlet loader!                    // if (concID.startsWith(PortletServlet.class.getName())) continue;                    String dispName = app.getDisplayName(loc);                    String descName = app.getDescription(loc);                    ListBoxItemBean item = new ListBoxItemBean();                    item.setValue(dispName + " - " + descName);                    item.setName(concID);                    if (concID.equalsIgnoreCase(frame.getPortletClass())) item.setSelected(true);                    portletsLB.addBean(item);                }            } else if (comp instanceof PortletContent) {                if ((action != null) && (!action.equals(""))) {                    PortletContent content = (PortletContent) comp;                    PortletComponent parent = content.getParentComponent();                    parent.remove(content);                    pageFactory.savePortletPageMaster(page);                } else {                    controlUI = "content";                    ListBoxBean contentLB = event.getListBoxBean("contentLB");                    List contentFiles = contentManagerService.getAllContent();                    for (int i = 0; i < contentFiles.size(); i++) {                        ContentFile contentFile = (ContentFile) contentFiles.get(i);                        ListBoxItemBean item = new ListBoxItemBean();                        item.setName(contentFile.getFile().getName());                        item.setValue(contentFile.getFile().getName());                        contentLB.addBean(item);                    }                }            } else if (comp instanceof PortletTab) {                PortletTab tab = (PortletTab) comp;                PortletNavMenu pane = (PortletNavMenu) tab.getParentComponent();                if (pane.getStyle().equals("menu")) {                    log.debug("it's a tab!");                    controlUI = "tab";                    createColsListBox(event, req, tab.getPortletComponent());                } else {                    log.debug("it's a subtab");                    controlUI = "subtab";                    createColsListBox(event, req, tab.getPortletComponent());                }                log.debug("tab name=" + tab.getTitle(req.getLocale().getLanguage()));                // if selected tab is first tab disable 'move left' button                if ((pane.getIndexOfTab(tab) == 0)) {                    ActionSubmitBean moveLeftButton = event.getActionSubmitBean("moveLeftButton");                    moveLeftButton.setDisabled(true);                }                // if selected tab is last tab disable 'move right' buttom                if ((pane.getIndexOfTab(tab) == (pane.getTabCount() - 1))) {                    ActionSubmitBean moveRightButton = event.getActionSubmitBean("moveRightButton");                    moveRightButton.setDisabled(true);                }                log.debug("invoking action on tab/subtab");                page.actionPerformed(gsevent);            } else if (comp instanceof PortletBar) {                PortletBar bar = (PortletBar) comp;                controlUI = "bar";                createColsListBox(event, req, bar.getPortletComponent());            }            boolean itsanewtab = false;            if (req.getParameter("newtab") != null) {                controlUI = "tab";                TextFieldBean nameTF = event.getTextFieldBean("nameTF");                nameTF.setValue(this.getLocalizedText(req, "LAYOUT_NEW_TAB2"));                itsanewtab = true;                comp = new PortletTab();            } else if (req.getParameter("newsubtab") != null) {                controlUI = "subtab";                TextFieldBean nameTF = event.getTextFieldBean("nameTF");                nameTF.setValue(this.getLocalizedText(req, "LAYOUT_NEW_SUBTAB2"));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -