01: /*
02: * Copyright (C) 2005 Jeff Tassin
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package com.jeta.swingbuilder.codegen.gui.config;
20:
21: import com.jeta.forms.components.panel.FormPanel;
22: import com.jeta.swingbuilder.gui.utils.FormDesignerUtils;
23: import com.jeta.swingbuilder.store.CodeModel;
24:
25: /**
26: * View for entering options for code generation
27: *
28: * @author Jeff Tassin
29: */
30: public class OptionsView extends FormPanel {
31: private CodeModel m_model;
32:
33: public OptionsView(CodeModel om) {
34: super ("com/jeta/swingbuilder/store/codeOptions.jfrm");
35: m_model = om;
36: loadModel(om);
37: }
38:
39: public CodeModel getModel() {
40: return m_model;
41: }
42:
43: public void loadModel(CodeModel om) {
44: setText(OptionsNames.ID_PACKAGE, om.getPackage());
45: setText(OptionsNames.ID_CLASS_NAME, om.getClassName());
46: setText(OptionsNames.ID_MEMBER_PREFIX, om.getMemberPrefix());
47: setSelected(OptionsNames.ID_INCLUDE_MAIN, om.isIncludeMain());
48: setSelected(OptionsNames.ID_INCLUDE_NONSTANDARD, om
49: .isIncludeNonStandard());
50: }
51:
52: public void saveToModel() {
53: m_model.setPackage(FormDesignerUtils
54: .fastTrim(getText(OptionsNames.ID_PACKAGE)));
55: m_model.setClassName(FormDesignerUtils
56: .fastTrim(getText(OptionsNames.ID_CLASS_NAME)));
57: m_model.setMemberPrefix(FormDesignerUtils
58: .fastTrim(getText(OptionsNames.ID_MEMBER_PREFIX)));
59: m_model
60: .setIncludeMain(isSelected(OptionsNames.ID_INCLUDE_MAIN));
61: m_model
62: .setIncludeNonStandard(isSelected(OptionsNames.ID_INCLUDE_NONSTANDARD));
63: }
64: }
|