01: /*
02: * Copyright 2007 Giordano Maestro (giordano.maestro@assetdata.it)
03: *
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
06: * use this file except in compliance with the License.
07: *
08: * You may obtain a copy of the License at
09: * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
10: * or agreed to in writing, software distributed under the License is
11: * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
12: * KIND, either express or implied. See the License for the specific language
13: * governing permissions and limitations under the License.
14: */
15: package org.romaframework.module.designer.view.domain.screen;
16:
17: import java.io.IOException;
18: import java.util.List;
19:
20: import org.romaframework.aspect.core.annotation.AnnotationConstants;
21: import org.romaframework.aspect.view.annotation.ViewField;
22: import org.romaframework.core.serializer.RomaSerializationException;
23: import org.romaframework.core.validation.ValidationException;
24:
25: /**
26: * The page for the creation of new screen
27: * @author Giordano Maestro(giordano.maestro@assetdata.it) 09/nov/07
28: *
29: */
30: public class ScreenCreationPage extends ScreenEditingPage {
31:
32: public ScreenCreationPage(ApplicationScreen root,
33: Object iBackObject, List<ApplicationScreen> iScreens) {
34: super (root, iBackObject, iScreens);
35: screens = iScreens;
36: }
37:
38: @ViewField(enabled=AnnotationConstants.TRUE)
39: public String getName() {
40: return super .getName();
41: }
42:
43: public void ok() throws ValidationException, IOException,
44: RomaSerializationException {
45: for (ApplicationScreen screen : screens) {
46: if (getName() != null
47: && screen.toString().equals(
48: getName().trim() + ".xml")) {
49: throw new ValidationException(
50: this ,
51: "name",
52: "Please change screen name, there is another with the same name!",
53: null);
54: } else if (name != null && name.trim().equals("")) {
55: throw new ValidationException(this , "name",
56: "Please insert screen name!", "");
57: }
58: }
59: screens.add(appScreen);
60: super.ok();
61: }
62: }
|