1/*
2 * ProGuard -- shrinking, optimization, obfuscation, and preverification
3 *             of Java bytecode.
4 *
5 * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21package proguard.gui;
22
23import proguard.*;
24
25import javax.swing.*;
26
27/**
28 * This <code>ListPanel</code> allows the user to add, edit, move, and remove
29 * KeepClassSpecification entries in a list.
30 *
31 * @author Eric Lafortune
32 */
33final class KeepSpecificationsPanel extends ClassSpecificationsPanel
34{
35    private final boolean markClasses;
36    private final boolean markConditionally;
37    private final boolean allowShrinking;
38    private final boolean allowOptimization;
39    private final boolean allowObfuscation;
40
41
42    public KeepSpecificationsPanel(JFrame  owner,
43                                   boolean markClasses,
44                                   boolean markConditionally,
45                                   boolean allowShrinking,
46                                   boolean allowOptimization,
47                                   boolean allowObfuscation)
48    {
49        super(owner, true);
50
51        this.markClasses       = markClasses;
52        this.markConditionally = markConditionally;
53        this.allowShrinking    = allowShrinking;
54        this.allowOptimization = allowOptimization;
55        this.allowObfuscation  = allowObfuscation;
56    }
57
58
59    // Factory methods for ClassSpecificationsPanel.
60
61    protected ClassSpecification createClassSpecification()
62    {
63        return new KeepClassSpecification(markClasses,
64                                     markConditionally,
65                                     allowShrinking,
66                                     allowOptimization,
67                                     allowObfuscation);
68    }
69
70
71    protected void setClassSpecification(ClassSpecification classSpecification)
72    {
73        classSpecificationDialog.setKeepSpecification((KeepClassSpecification)classSpecification);
74    }
75
76
77    protected ClassSpecification getClassSpecification()
78    {
79        return classSpecificationDialog.getKeepSpecification();
80    }
81}
82