save
@@ -3,6 +3,7 @@ | ||
3 | 3 | import java.io.IOException; |
4 | 4 | import java.sql.Connection; |
5 | 5 | import java.sql.SQLException; |
6 | +import java.util.ArrayList; | |
6 | 7 | import java.util.List; |
7 | 8 | |
8 | 9 | import javax.faces.context.FacesContext; |
@@ -28,12 +29,37 @@ | ||
28 | 29 | @BlancoGetterSetter |
29 | 30 | protected String project = "NONAME"; |
30 | 31 | |
31 | - protected List<String> getProjectList(@BlancoInject final FacesContext ctx, @BlancoInject final Connection conn) | |
32 | - throws IOException, SQLException { | |
32 | + /** | |
33 | + * プロジェクト名の一覧。 | |
34 | + */ | |
35 | + @BlancoGetterSetter(setter = false) | |
36 | + protected List<String> projectList = new ArrayList<String>(); | |
33 | 37 | |
34 | - return new BlancoFileManagerProjectDao().getProjectList(conn); | |
38 | + /** | |
39 | + * 画面ロード時の Bean 初期化処理を行います。 | |
40 | + * | |
41 | + * @param conn | |
42 | + * @param ctx | |
43 | + * @return | |
44 | + * @throws SQLException | |
45 | + */ | |
46 | + protected String getLoad(@BlancoInject final Connection conn, @BlancoInject final FacesContext ctx) | |
47 | + throws SQLException { | |
48 | + updateProjectList(conn); | |
49 | + | |
50 | + return null; | |
35 | 51 | } |
36 | 52 | |
53 | + /** | |
54 | + * プロジェクト名一覧を更新します。 | |
55 | + * | |
56 | + * @param conn | |
57 | + * @throws SQLException | |
58 | + */ | |
59 | + void updateProjectList(final Connection conn) throws SQLException { | |
60 | + projectList = new BlancoFileManagerProjectDao().getProjectList(conn); | |
61 | + } | |
62 | + | |
37 | 63 | protected String newProject(@BlancoInject final FacesContext ctx, @BlancoInject final Connection conn) |
38 | 64 | throws IOException, SQLException { |
39 | 65 |
@@ -16,6 +16,8 @@ | ||
16 | 16 | <h:body> |
17 | 17 | <noscript><div>JavaScript is disabled on your browser.</div></noscript> |
18 | 18 | |
19 | +<h:outputText value="#{blancoFileManagerWebFileProject.load}" /> | |
20 | + | |
19 | 21 | <util:TopNavigation items="#{blancoFileManagerWebCommonBean.getTopNavigation('ファイル管理')}" /> |
20 | 22 | <util:SubNavigation items="#{blancoFileManagerWebCommonBean.getSubNavigation('ファイル管理', 'プロジェクト')}" /> |
21 | 23 |
@@ -10,16 +10,17 @@ | ||
10 | 10 | import java.util.List; |
11 | 11 | |
12 | 12 | import javax.faces.bean.ManagedBean; |
13 | -import javax.faces.bean.ViewScoped; | |
13 | +import javax.faces.bean.SessionScoped; | |
14 | 14 | import javax.faces.context.FacesContext; |
15 | 15 | |
16 | 16 | import blanco.fw.BlancoGeneratedBy; |
17 | 17 | |
18 | 18 | /** |
19 | + * プロジェクトに関する情報。選択中プロジェクト名を記憶するために、スコープは session になっています。 | |
19 | 20 | */ |
20 | 21 | @BlancoGeneratedBy(name = "Blanco2g") |
21 | 22 | @ManagedBean |
22 | -@ViewScoped | |
23 | +@SessionScoped | |
23 | 24 | public class BlancoFileManagerWebFileProjectBean extends AbstractBlancoFileManagerWebFileProjectBean implements Serializable { |
24 | 25 | /** |
25 | 26 | * シリアルバージョン UID. |
@@ -27,7 +28,7 @@ | ||
27 | 28 | private static final long serialVersionUID = 1L; |
28 | 29 | |
29 | 30 | /** |
30 | - * プロジェクト名 | |
31 | + * プロジェクト名。デフォルトは NONAME になっています。 | |
31 | 32 | * [@BlancoGetterSetter] |
32 | 33 | * |
33 | 34 | * @return 取得したい値。 |
@@ -37,7 +38,7 @@ | ||
37 | 38 | } |
38 | 39 | |
39 | 40 | /** |
40 | - * プロジェクト名 | |
41 | + * プロジェクト名。デフォルトは NONAME になっています。 | |
41 | 42 | * [@BlancoGetterSetter] |
42 | 43 | * |
43 | 44 | * @param project 設定したい値。 |
@@ -47,18 +48,28 @@ | ||
47 | 48 | } |
48 | 49 | |
49 | 50 | /** |
51 | + * プロジェクト名の一覧。 | |
52 | + * [@BlancoGetterSetter] | |
50 | 53 | * |
54 | + * @return 取得したい値。 | |
55 | + */ | |
56 | + public List<java.lang.String> getProjectList() { | |
57 | + return projectList; | |
58 | + } | |
59 | + | |
60 | + /** | |
61 | + * 画面ロード時の Bean 初期化処理を行います。 | |
62 | + * | |
51 | 63 | * @return |
52 | - * @throws IOException | |
53 | 64 | * @throws SQLException |
54 | 65 | */ |
55 | - public List<java.lang.String> getProjectList() throws IOException, SQLException { | |
56 | - java.util.List<java.lang.String> autoValMethodResult; | |
66 | + public String getLoad() throws SQLException { | |
67 | + java.lang.String autoValMethodResult; | |
57 | 68 | final FacesContext ctx = FacesContext.getCurrentInstance(); |
58 | 69 | // [@BlancoInject] Begin database transaction. |
59 | 70 | final Connection conn = blanco.db.BlancoDbConnectionUtil.getConnection(); |
60 | 71 | try { |
61 | - autoValMethodResult = super.getProjectList(ctx, conn); | |
72 | + autoValMethodResult = super.getLoad(conn, ctx); | |
62 | 73 | } finally { |
63 | 74 | // [@BlancoInject] End database transaction. |
64 | 75 | blanco.db.BlancoDbConnectionUtil.releaseConnection(conn); |
@@ -0,0 +1,24 @@ | ||
1 | +/* | |
2 | + * このクラスは 'AbstractBlancoFileManagerWebSessionBean' の具象クラスとして blanco Framework によって自動生成されました。 | |
3 | + */ | |
4 | +package blanco.filemanager.web.bean; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | + | |
8 | +import javax.faces.bean.ManagedBean; | |
9 | +import javax.faces.bean.SessionScoped; | |
10 | + | |
11 | +import blanco.fw.BlancoGeneratedBy; | |
12 | + | |
13 | +/** | |
14 | + * Session bean for blancoFileManagerWeb | |
15 | + */ | |
16 | +@BlancoGeneratedBy(name = "Blanco2g") | |
17 | +@ManagedBean | |
18 | +@SessionScoped | |
19 | +public class BlancoFileManagerWebSessionBean extends AbstractBlancoFileManagerWebSessionBean implements Serializable { | |
20 | + /** | |
21 | + * シリアルバージョン UID. | |
22 | + */ | |
23 | + private static final long serialVersionUID = 1L; | |
24 | +} |
@@ -14,6 +14,7 @@ | ||
14 | 14 | import blanco.fw.BlancoGeneratedBy; |
15 | 15 | |
16 | 16 | /** |
17 | + * Common bean for blancoFileManagerWeb | |
17 | 18 | */ |
18 | 19 | @BlancoGeneratedBy(name = "Blanco2g") |
19 | 20 | @ManagedBean |