jspsourcebean.java

来自「OperaMasks是一种基于J2EE的Web开发技术」· Java 代码 · 共 64 行

JAVA
64
字号
package demo.common;

import java.util.LinkedList;
import java.util.List;

import javax.faces.model.SelectItem;

import org.operamasks.faces.annotation.Accessible;
import org.operamasks.faces.annotation.Action;
import org.operamasks.faces.annotation.BeforeRender;
import org.operamasks.faces.annotation.Bind;
import org.operamasks.faces.annotation.Inject;
import org.operamasks.faces.annotation.ManagedBean;
import org.operamasks.faces.annotation.ManagedBeanScope;
import org.operamasks.faces.annotation.SelectItems;
import org.operamasks.faces.component.html.impl.UIIFrame;

import demo.IndexBean;

/**
 * 
 * This managed bean is generated automatically
 */
@ManagedBean(name = "JspSourceBean", scope = ManagedBeanScope.REQUEST)
public class JspSourceBean {
	@Inject(value = "#{IndexBean}")
	private IndexBean indexbean;

	@Accessible
	private List<SelectItem> jspsrc_items;

	@Bind(id = "jspsrc")
	@SelectItems(source = "#{this.jspsrc_items}")
	private String jspsrc;

	@Bind
	UIIFrame jspsrcFrame;
	
	@Action
	public void jspsrc_onchange(){
	
	}

	@BeforeRender
	public void beforeRender(boolean isPostback) {
		RcdemoTreeNode selectedLeaf = indexbean.getSelectedLeaf();
		if (selectedLeaf != null && selectedLeaf.getJspsrc() != null
				&& selectedLeaf.getJspsrc().size() > 0) {
			jspsrc_items = new LinkedList<SelectItem>();
			for (String src : selectedLeaf.getJspsrc()) {
				String page = src.replace(".", "/") + ".xhtml";
				jspsrc_items.add(new SelectItem(page));
			}
		}
		if (jspsrc_items != null && jspsrc_items.size() != 0) {
			if (jspsrc == null || jspsrc.length() == 0) {
				jspsrc = jspsrc_items.get(0).getValue().toString();
			}
			jspsrcFrame.load("/common/resources/jsp-source/"
					+ jspsrc.replace("/", ".") + ".html");
		}
	}
}

⌨️ 快捷键说明

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