001    package org.apache.myfaces.tobago.context;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one or more
005     * contributor license agreements.  See the NOTICE file distributed with
006     * this work for additional information regarding copyright ownership.
007     * The ASF licenses this file to You under the Apache License, Version 2.0
008     * (the "License"); you may not use this file except in compliance with
009     * the License.  You may obtain a copy of the License at
010     *
011     *      http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing, software
014     * distributed under the License is distributed on an "AS IS" BASIS,
015     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016     * See the License for the specific language governing permissions and
017     * limitations under the License.
018     */
019    
020    import java.io.Serializable;
021    import java.util.ArrayList;
022    import java.util.List;
023    
024    /**
025     * Manages the script and style files for production and development stage.
026     *
027     * @since 1.5.0
028     */
029    public final class ThemeResources implements Serializable {
030    
031      private boolean production;
032      private List<ThemeScript> scriptList = new ArrayList<ThemeScript>();
033      private List<ThemeStyle> styleList = new ArrayList<ThemeStyle>();
034    
035      public ThemeResources copy() {
036        ThemeResources resources = new ThemeResources();
037        resources.setProduction(isProduction());
038        resources.scriptList.addAll(scriptList);
039        resources.styleList.addAll(styleList);
040        return resources;
041      }
042    
043      public boolean isProduction() {
044        return production;
045      }
046    
047      public void setProduction(boolean production) {
048        this.production = production;
049      }
050    
051      public boolean addScript(ThemeScript script) {
052        return scriptList.add(script);
053      }
054    
055      public boolean addStyle(ThemeStyle style) {
056        return styleList.add(style);
057      }
058    
059      public List<ThemeScript> getScriptList() {
060        return scriptList;
061      }
062    
063      public List<ThemeStyle> getStyleList() {
064        return styleList;
065      }
066    }