01: /*
02: * Copyright 2006 Luca Garulli (luca.garulli@assetdata.it)
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.romaframework.module.admin.view.domain.info;
18:
19: import org.romaframework.aspect.core.annotation.AnnotationConstants;
20: import org.romaframework.aspect.core.annotation.CoreClass;
21: import org.romaframework.aspect.persistence.PersistenceConstants;
22: import org.romaframework.aspect.persistence.annotation.Persistence;
23: import org.romaframework.aspect.view.ViewCallback;
24: import org.romaframework.aspect.view.annotation.ViewClass;
25: import org.romaframework.aspect.view.annotation.ViewField;
26: import org.romaframework.core.entity.ComposedEntityInstance;
27: import org.romaframework.module.admin.InfoHelper;
28: import org.romaframework.module.admin.domain.Info;
29: import org.romaframework.module.admin.domain.InfoCategory;
30: import org.romaframework.module.crud.CRUDMain;
31:
32: @CoreClass(orderFields="categories entity")
33: @ViewClass(entity=Info.class,label="")
34: public class InfoFilter extends ComposedEntityInstance<Info> implements
35: ViewCallback {
36:
37: protected CRUDMain main;
38: protected InfoCategory[] categories;
39:
40: public InfoFilter() {
41: super (new Info());
42: }
43:
44: public InfoFilter(Info iInfo) {
45: super (iInfo);
46: }
47:
48: public void onShow() {
49: categories = InfoHelper.getInstance().getInfoCategoryArray();
50: }
51:
52: public void onDispose() {
53: }
54:
55: @ViewField(label="$category",render="select",selectionField="category")
56: public InfoCategory[] getCategories() {
57: return categories;
58: }
59:
60: @ViewField(visible=AnnotationConstants.FALSE)
61: @Persistence(mode=PersistenceConstants.MODE_TX)
62: public InfoCategory getCategory() {
63: return getEntity().getCategory();
64: }
65:
66: public void setCategory(InfoCategory iCategoryIndex) {
67: getEntity().setCategory(iCategoryIndex);
68: if (main != null)
69: main.search();
70: }
71:
72: public void setMain(CRUDMain main) {
73: this.main = main;
74: }
75: }
|