001// Copyright 2007 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5.internal;
016
017import org.apache.tapestry5.OptionGroupModel;
018import org.apache.tapestry5.OptionModel;
019import org.apache.tapestry5.util.AbstractSelectModel;
020
021import java.util.Arrays;
022import java.util.List;
023
024public final class SelectModelImpl extends AbstractSelectModel
025{
026    private final List<OptionGroupModel> optionGroups;
027
028    private final List<OptionModel> optionModels;
029
030    public SelectModelImpl(final List<OptionGroupModel> optionGroups,
031                           final List<OptionModel> optionModels)
032    {
033        this.optionGroups = optionGroups;
034        this.optionModels = optionModels;
035    }
036
037    public SelectModelImpl(OptionModel... optionModels)
038    {
039        this(null, Arrays.asList(optionModels));
040    }
041
042    public SelectModelImpl(OptionGroupModel... groupModels)
043    {
044        this(Arrays.asList(groupModels), null);
045    }
046
047    public List<OptionGroupModel> getOptionGroups()
048    {
049        return optionGroups;
050    }
051
052    public List<OptionModel> getOptions()
053    {
054        return optionModels;
055    }
056
057}