View Javadoc

    1   /*
    2    * $Id: StrutsModels.java 501750 2007-01-31 07:06:47Z mrdon $
    3    *
    4    * Licensed to the Apache Software Foundation (ASF) under one
    5    * or more contributor license agreements.  See the NOTICE file
    6    * distributed with this work for additional information
    7    * regarding copyright ownership.  The ASF licenses this file
    8    * to you under the Apache License, Version 2.0 (the
    9    * "License"); you may not use this file except in compliance
    10   * with the License.  You may obtain a copy of the License at
    11   *
    12   *  http://www.apache.org/licenses/LICENSE-2.0
    13   *
    14   * Unless required by applicable law or agreed to in writing,
    15   * software distributed under the License is distributed on an
    16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    17   * KIND, either express or implied.  See the License for the
    18   * specific language governing permissions and limitations
    19   * under the License.
    20   */
    21  package org.apache.struts2.views.freemarker.tags;
    22
    23  import javax.servlet.http.HttpServletRequest;
    24  import javax.servlet.http.HttpServletResponse;
    25
    26  import com.opensymphony.xwork2.util.ValueStack;
    27  import org.apache.struts2.components.InputTransferSelect;
    28
    29  /***
    30   * Provides @s.tag access for various tags.
    31   *
    32   */
    33  public class StrutsModels {
    34      protected ValueStack stack;
    35      protected HttpServletRequest req;
    36      protected HttpServletResponse res;
    37
    38      protected ActionModel action;
    39      protected BeanModel bean;
    40      protected CheckboxModel checkbox;
    41      protected CheckboxListModel checkboxlist;
    42      protected ComboBoxModel comboBox;
    43      protected ComponentModel component;
    44      protected DateModel date;
    45      protected DateTimePickerModel dateTimePicker;
    46      protected DivModel div;
    47      protected DoubleSelectModel doubleselect;
    48      protected FileModel file;
    49      protected FormModel form;
    50      protected HeadModel head;
    51      protected HiddenModel hidden;
    52      protected AnchorModel a;
    53      protected I18nModel i18n;
    54      protected IncludeModel include;
    55      protected LabelModel label;
    56      protected PasswordModel password;
    57      protected PushModel push;
    58      protected ParamModel param;
    59      protected RadioModel radio;
    60      protected SelectModel select;
    61      protected SetModel set;
    62      protected SubmitModel submit;
    63      protected ResetModel reset;
    64      protected TabbedPanelModel tabbedPanel;
    65      protected TextAreaModel textarea;
    66      protected TextModel text;
    67      protected TextFieldModel textfield;
    68      protected TokenModel token;
    69      protected URLModel url;
    70      protected WebTableModel table;
    71      protected PropertyModel property;
    72      protected IteratorModel iterator;
    73      protected ActionErrorModel actionerror;
    74      protected ActionMessageModel actionmessage;
    75      protected FieldErrorModel fielderror;
    76      protected OptionTransferSelectModel optiontransferselect;
    77      protected TreeModel treeModel;
    78      protected TreeNodeModel treenodeModel;
    79      protected UpDownSelectModel updownselect;
    80      protected OptGroupModel optGroupModel;
    81      protected IfModel ifModel;
    82      protected ElseModel elseModel;
    83      protected ElseIfModel elseIfModel;
    84      protected AutocompleterModel autocompleterModel;
    85      protected InputTransferSelectModel inputtransferselect;
    86
    87
    88      public StrutsModels(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
    89          this.stack = stack;
    90          this.req = req;
    91          this.res = res;
    92      }
    93
    94      public CheckboxListModel getCheckboxlist() {
    95          if (checkboxlist == null) {
    96              checkboxlist = new CheckboxListModel(stack, req, res);
    97          }
    98
    99          return checkboxlist;
    100     }
    101
    102     public CheckboxModel getCheckbox() {
    103         if (checkbox == null) {
    104             checkbox = new CheckboxModel(stack, req, res);
    105         }
    106
    107         return checkbox;
    108     }
    109
    110     public ComboBoxModel getComboBox() {
    111         if (comboBox == null) {
    112             comboBox = new ComboBoxModel(stack, req, res);
    113         }
    114
    115         return comboBox;
    116     }
    117
    118     public AutocompleterModel getAutocompleterModel() {
    119         if (autocompleterModel == null) {
    120             autocompleterModel = new AutocompleterModel(stack, req, res);
    121         }
    122
    123         return autocompleterModel;
    124     }
    125
    126     public ComponentModel getComponent() {
    127         if (component == null) {
    128             component = new ComponentModel(stack, req, res);
    129         }
    130
    131         return component;
    132     }
    133
    134     public DoubleSelectModel getDoubleselect() {
    135         if (doubleselect == null) {
    136             doubleselect = new DoubleSelectModel(stack, req, res);
    137         }
    138
    139         return doubleselect;
    140     }
    141
    142     public FileModel getFile() {
    143         if (file == null) {
    144             file = new FileModel(stack, req, res);
    145         }
    146
    147         return file;
    148     }
    149
    150     public FormModel getForm() {
    151         if (form == null) {
    152             form = new FormModel(stack, req, res);
    153         }
    154
    155         return form;
    156     }
    157
    158     public HeadModel getHead() {
    159         if (head == null) {
    160             head = new HeadModel(stack, req, res);
    161         }
    162
    163         return head;
    164     }
    165
    166     public HiddenModel getHidden() {
    167         if (hidden == null) {
    168             hidden = new HiddenModel(stack, req, res);
    169         }
    170
    171         return hidden;
    172     }
    173     public LabelModel getLabel() {
    174         if (label == null) {
    175             label = new LabelModel(stack, req, res);
    176         }
    177
    178         return label;
    179     }
    180
    181     public PasswordModel getPassword() {
    182         if (password == null) {
    183             password = new PasswordModel(stack, req, res);
    184         }
    185
    186         return password;
    187     }
    188
    189     public RadioModel getRadio() {
    190         if (radio == null) {
    191             radio = new RadioModel(stack, req, res);
    192         }
    193
    194         return radio;
    195     }
    196
    197     public SelectModel getSelect() {
    198         if (select == null) {
    199             select = new SelectModel(stack, req, res);
    200         }
    201
    202         return select;
    203     }
    204
    205     public SubmitModel getSubmit() {
    206         if (submit == null) {
    207             submit = new SubmitModel(stack, req, res);
    208         }
    209
    210         return submit;
    211     }
    212
    213     public ResetModel getReset() {
    214         if (reset == null) {
    215             reset = new ResetModel(stack, req, res);
    216         }
    217
    218         return reset;
    219     }
    220
    221     public TextAreaModel getTextarea() {
    222         if (textarea == null) {
    223             textarea = new TextAreaModel(stack, req, res);
    224         }
    225
    226         return textarea;
    227     }
    228
    229     public TextFieldModel getTextfield() {
    230         if (textfield == null) {
    231             textfield = new TextFieldModel(stack, req, res);
    232         }
    233
    234         return textfield;
    235     }
    236
    237     public DateModel getDate() {
    238         if (date == null) {
    239             date = new DateModel(stack, req, res);
    240         }
    241
    242         return date;
    243     }
    244
    245     public DateTimePickerModel getDateTimePicker() {
    246         if (dateTimePicker == null) {
    247             dateTimePicker = new DateTimePickerModel(stack, req, res);
    248         }
    249
    250         return dateTimePicker;
    251     }
    252
    253     public TokenModel getToken() {
    254         if (token == null) {
    255             token = new TokenModel(stack, req, res);
    256         }
    257
    258         return token;
    259     }
    260
    261     public WebTableModel getTable() {
    262         if (table == null) {
    263             table = new WebTableModel(stack, req, res);
    264         }
    265
    266         return table;
    267     }
    268
    269     public URLModel getUrl() {
    270         if (url == null) {
    271             url = new URLModel(stack, req, res);
    272         }
    273
    274         return url;
    275     }
    276
    277     public IncludeModel getInclude() {
    278         if (include == null) {
    279             include = new IncludeModel(stack, req, res);
    280         }
    281
    282         return include;
    283     }
    284
    285     public ParamModel getParam() {
    286         if (param == null) {
    287             param = new ParamModel(stack, req, res);
    288         }
    289
    290         return param;
    291     }
    292
    293     public ActionModel getAction() {
    294         if (action == null) {
    295             action = new ActionModel(stack, req, res);
    296         }
    297
    298         return action;
    299     }
    300
    301     public AnchorModel getA() {
    302         if (a == null) {
    303             a = new AnchorModel(stack, req, res);
    304         }
    305
    306         return a;
    307     }
    308
    309     public AnchorModel getHref() {
    310         if (a == null) {
    311             a = new AnchorModel(stack, req, res);
    312         }
    313
    314         return a;
    315     }
    316
    317     public DivModel getDiv() {
    318         if (div == null) {
    319             div = new DivModel(stack, req, res);
    320         }
    321
    322         return div;
    323     }
    324
    325     public TextModel getText() {
    326         if (text == null) {
    327             text = new TextModel(stack, req, res);
    328         }
    329
    330         return text;
    331     }
    332
    333     public TabbedPanelModel getTabbedPanel() {
    334         if (tabbedPanel == null) {
    335             tabbedPanel = new TabbedPanelModel(stack, req, res);
    336         }
    337
    338         return tabbedPanel;
    339     }
    340
    341     public BeanModel getBean() {
    342         if (bean == null) {
    343             bean = new BeanModel(stack, req, res);
    344         }
    345
    346         return bean;
    347     }
    348
    349     public I18nModel getI18n() {
    350         if (i18n == null) {
    351             i18n = new I18nModel(stack, req, res);
    352         }
    353
    354         return i18n;
    355     }
    356
    357     public PushModel getPush() {
    358         if (push == null) {
    359             push = new PushModel(stack, req, res);
    360         }
    361
    362         return push;
    363     }
    364
    365     public SetModel getSet() {
    366         if (set == null) {
    367             set = new SetModel(stack, req, res);
    368         }
    369
    370         return set;
    371     }
    372
    373     public PropertyModel getProperty() {
    374         if (property == null) {
    375             property = new PropertyModel(stack, req, res);
    376         }
    377
    378         return property;
    379     }
    380
    381     public IteratorModel getIterator() {
    382         if (iterator == null) {
    383             iterator = new IteratorModel(stack, req, res);
    384         }
    385
    386         return iterator;
    387     }
    388
    389     public ActionErrorModel getActionerror() {
    390         if (actionerror == null) {
    391             actionerror = new ActionErrorModel(stack, req, res);
    392         }
    393
    394         return actionerror;
    395     }
    396
    397     public ActionMessageModel getActionmessage() {
    398         if (actionmessage == null) {
    399             actionmessage = new ActionMessageModel(stack, req, res);
    400         }
    401
    402         return actionmessage;
    403     }
    404
    405     public FieldErrorModel getFielderror() {
    406         if (fielderror == null) {
    407             fielderror = new FieldErrorModel(stack, req, res);
    408         }
    409
    410         return fielderror;
    411     }
    412
    413     public OptionTransferSelectModel getOptiontransferselect() {
    414         if (optiontransferselect == null) {
    415             optiontransferselect = new OptionTransferSelectModel(stack, req, res);
    416         }
    417         return optiontransferselect;
    418     }
    419
    420     public TreeModel getTree() {
    421         if (treeModel == null) {
    422             treeModel = new TreeModel(stack,req, res);
    423         }
    424         return treeModel;
    425     }
    426
    427     public TreeNodeModel getTreenode() {
    428         if (treenodeModel == null) {
    429             treenodeModel = new TreeNodeModel(stack, req, res);
    430         }
    431         return treenodeModel;
    432     }
    433
    434     public UpDownSelectModel getUpdownselect() {
    435         if (updownselect == null)  {
    436             updownselect = new UpDownSelectModel(stack, req, res);
    437         }
    438         return updownselect;
    439     }
    440
    441     public OptGroupModel getOptgroup() {
    442         if (optGroupModel == null) {
    443             optGroupModel = new OptGroupModel(stack, req, res);
    444         }
    445         return optGroupModel;
    446     }
    447
    448     public IfModel getIf() {
    449         if (ifModel == null) {
    450             ifModel = new IfModel(stack, req, res);
    451         }
    452         return ifModel;
    453     }
    454
    455     public ElseModel getElse() {
    456         if (elseModel == null) {
    457             elseModel = new ElseModel(stack, req, res);
    458         }
    459         return elseModel;
    460     }
    461
    462     public ElseIfModel getElseif() {
    463         if (elseIfModel == null) {
    464             elseIfModel = new ElseIfModel(stack, req, res);
    465         }
    466         return elseIfModel;
    467     }
    468
    469
    470     public InputTransferSelectModel getInputtransferselect() {
    471         if (inputtransferselect == null) {
    472             inputtransferselect = new InputTransferSelectModel(stack, req, res);
    473         }
    474         return inputtransferselect;
    475     }
    476
    477 }