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

📄 layoutmanagerportlet.java

📁 GridSphere 门户 提供一个基于 portlet 的高级开放源代码门户。GridSphere 是在欧盟提供基金的 GridLab 项目下开发的
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
                            PortletColumnLayout oldcol = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col = new PortletColumnLayout();                            oldcol.setWidth("66%");                            col.setWidth("33%");                            row.addPortletComponent(col);                        }                        if (strategyNum.equals("five")) {                            PortletColumnLayout oldcol = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col = new PortletColumnLayout();                            PortletColumnLayout newcol = new PortletColumnLayout();                            oldcol.setWidth("33%");                            col.setWidth("33%");                            newcol.setWidth("33%");                            row.addPortletComponent(col);                            row.addPortletComponent(newcol);                        }                        if (strategyNum.equals("six")) {                            PortletColumnLayout oldcol = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col = new PortletColumnLayout();                            PortletColumnLayout newcol = new PortletColumnLayout();                            oldcol.setWidth("25%");                            col.setWidth("50%");                            newcol.setWidth("25%");                            row.addPortletComponent(col);                            row.addPortletComponent(newcol);                        }                    }                    if (cols.size() == 2) {                        if (strategyNum.equals("one")) {                            // deal with case where column layout needs to be reduced                            PortletColumnLayout col = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout oldcol = (PortletColumnLayout) cols.get(1);                            col.setWidth("100%");                            row.removePortletComponent(oldcol);                        }                        if (strategyNum.equals("two")) {                            PortletColumnLayout oldcol = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col = (PortletColumnLayout) cols.get(1);                            oldcol.setWidth("33%");                            col.setWidth("66%");                        }                        if (strategyNum.equals("three")) {                            PortletColumnLayout oldcol = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col = (PortletColumnLayout) cols.get(1);                            oldcol.setWidth("50%");                            col.setWidth("50%");                        }                        if (strategyNum.equals("four")) {                            PortletColumnLayout oldcol = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col = (PortletColumnLayout) cols.get(1);                            oldcol.setWidth("66%");                            col.setWidth("33%");                        }                        if (strategyNum.equals("five")) {                            PortletColumnLayout oldcol = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col = (PortletColumnLayout) cols.get(1);                            PortletColumnLayout newcol = new PortletColumnLayout();                            oldcol.setWidth("33%");                            col.setWidth("33%");                            newcol.setWidth("33%");                            row.addPortletComponent(newcol);                        }                        if (strategyNum.equals("six")) {                            PortletColumnLayout oldcol = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col = (PortletColumnLayout) cols.get(1);                            PortletColumnLayout newcol = new PortletColumnLayout();                            oldcol.setWidth("25%");                            col.setWidth("50%");                            newcol.setWidth("25%");                            row.addPortletComponent(newcol);                        }                    }                    if (cols.size() == 3) {                        if (strategyNum.equals("one")) {                            // deal with case where column layout needs to be reduced                            PortletColumnLayout col = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout newcol = (PortletColumnLayout) cols.get(2);                            PortletColumnLayout oldcol = (PortletColumnLayout) cols.get(1);                            col.setWidth("100%");                            row.removePortletComponent(oldcol);                            row.removePortletComponent(newcol);                        }                        if (strategyNum.equals("two")) {                            PortletColumnLayout col1 = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col2 = (PortletColumnLayout) cols.get(1);                            PortletColumnLayout col3 = (PortletColumnLayout) cols.get(2);                            col1.setWidth("33%");                            col2.setWidth("66%");                            row.removePortletComponent(col3);                        }                        if (strategyNum.equals("three")) {                            PortletColumnLayout col1 = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col2 = (PortletColumnLayout) cols.get(1);                            PortletColumnLayout col3 = (PortletColumnLayout) cols.get(2);                            col1.setWidth("50%");                            col2.setWidth("50%");                            row.removePortletComponent(col3);                        }                        if (strategyNum.equals("four")) {                            PortletColumnLayout col1 = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col2 = (PortletColumnLayout) cols.get(1);                            PortletColumnLayout col3 = (PortletColumnLayout) cols.get(2);                            col1.setWidth("66%");                            col2.setWidth("33%");                            row.removePortletComponent(col3);                        }                        if (strategyNum.equals("five")) {                            PortletColumnLayout col1 = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col2 = (PortletColumnLayout) cols.get(1);                            PortletColumnLayout col3 = (PortletColumnLayout) cols.get(2);                            col1.setWidth("33%");                            col2.setWidth("33%");                            col3.setWidth("33%");                        }                        if (strategyNum.equals("six")) {                            PortletColumnLayout col1 = (PortletColumnLayout) cols.get(0);                            PortletColumnLayout col2 = (PortletColumnLayout) cols.get(1);                            PortletColumnLayout col3 = (PortletColumnLayout) cols.get(2);                            col1.setWidth("25%");                            col2.setWidth("50%");                            col3.setWidth("25%");                        }                    }                }            }            System.err.println("return comp " + comp.getClass().getName());            return table;        } else {            System.err.println("creating a new table");            PortletTableLayout table = new PortletTableLayout();            PortletRowLayout row = new PortletRowLayout();            if (strategyNum.equals("one")) {                PortletColumnLayout col = new PortletColumnLayout();                col.setWidth("100%");                row.addPortletComponent(col);            }            if (strategyNum.equals("two")) {                PortletColumnLayout col = new PortletColumnLayout();                PortletColumnLayout newcol = new PortletColumnLayout();                col.setWidth("33%");                row.addPortletComponent(col);                col.setWidth("66%");                row.addPortletComponent(newcol);            }            if (strategyNum.equals("three")) {                PortletColumnLayout col = new PortletColumnLayout();                PortletColumnLayout newcol = new PortletColumnLayout();                col.setWidth("50%");                row.addPortletComponent(col);                col.setWidth("50%");                row.addPortletComponent(newcol);            }            if (strategyNum.equals("four")) {                PortletColumnLayout col = new PortletColumnLayout();                PortletColumnLayout newcol = new PortletColumnLayout();                col.setWidth("66%");                row.addPortletComponent(col);                col.setWidth("33%");                row.addPortletComponent(newcol);            }            if (strategyNum.equals("five")) {                PortletColumnLayout col1 = new PortletColumnLayout();                PortletColumnLayout col2 = new PortletColumnLayout();                PortletColumnLayout col3 = new PortletColumnLayout();                col1.setWidth("33%");                row.addPortletComponent(col1);                col2.setWidth("33%");                row.addPortletComponent(col2);                col2.setWidth("33%");                row.addPortletComponent(col3);            }            if (strategyNum.equals("six")) {                PortletColumnLayout col1 = new PortletColumnLayout();                PortletColumnLayout col2 = new PortletColumnLayout();                PortletColumnLayout col3 = new PortletColumnLayout();                col1.setWidth("25%");                row.addPortletComponent(col1);                col2.setWidth("50%");                row.addPortletComponent(col2);                col2.setWidth("25%");                row.addPortletComponent(col3);            }            table.addPortletComponent(row);            System.err.println("return table");            return table;        }    }    private void createColsListBox(FormEvent event, PortletRequest req, PortletComponent comp) {        // TODO  deal with column layouts        String colType = "one";        if ((comp != null) && (comp instanceof PortletTableLayout)) {            PortletTableLayout tableLayout = (PortletTableLayout) comp;            List rows = tableLayout.getPortletComponents();            if ((rows != null) && (!rows.isEmpty())) {                PortletComponent row = (PortletComponent) rows.get(0);                if (row instanceof PortletRowLayout) {                    PortletRowLayout r = (PortletRowLayout) row;                    List cols = r.getPortletComponents();                    if (cols.size() == 2) {                        PortletColumnLayout col = (PortletColumnLayout) cols.get(0);                        if (col.getWidth().equals("33%")) {                            colType = "two";                        }                        if (col.getWidth().equals("50%")) {                            colType = "three";                        }                        if (col.getWidth().equals("66%")) {                            colType = "four";                        }                    }                    if (cols.size() == 3) {                        PortletColumnLayout col = (PortletColumnLayout) cols.get(0);                        if (col.getWidth().equals("33%")) {                            colType = "five";                        }                        if (col.getWidth().equals("25%")) {                            colType = "six";                        }                    }                }            }        }        ListBoxBean colsLB = event.getListBoxBean("colsLB");        colsLB.clear();        ListBoxItemBean one = new ListBoxItemBean();        ListBoxItemBean two = new ListBoxItemBean();        ListBoxItemBean three = new ListBoxItemBean();        ListBoxItemBean four = new ListBoxItemBean();        ListBoxItemBean five = new ListBoxItemBean();        ListBoxItemBean six = new ListBoxItemBean();        one.setValue(this.getLocalizedText(req, "LAYOUT_ONECOL"));        one.setName("one");        if (colType.equals("one")) one.setSelected(true);        two.setValue(this.getLocalizedText(req, "LAYOUT_TWOCOL1"));        two.setName("two");        if (colType.equals("two")) two.setSelected(true);        three.setValue(this.getLocalizedText(req, "LAYOUT_TWOCOL2"));        three.setName("three");        if (colType.equals("three")) three.setSelected(true);        four.setValue(this.getLocalizedText(req, "LAYOUT_TWOCOL3"));        four.setName("four");        if (colType.equals("four")) four.setSelected(true);        five.setValue(this.getLocalizedText(req, "LAYOUT_THREECOL1"));        five.setName("five");        if (colType.equals("five")) five.setSelected(true);        six.setValue(this.getLocalizedText(req, "LAYOUT_THREECOL2"));        six.setName("six");        if (colType.equals("six")) six.setSelected(true);        colsLB.addBean(one);        colsLB.addBean(two);        colsLB.addBean(three);        colsLB.addBean(four);        colsLB.addBean(five);        colsLB.addBean(six);    }}

⌨️ 快捷键说明

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