1/*
2 * ProGuard -- shrinking, optimization, obfuscation, and preverification
3 *             of Java bytecode.
4 *
5 * Copyright (c) 2002-2014 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 markDescriptorClasses;
38    private final boolean allowShrinking;
39    private final boolean allowOptimization;
40    private final boolean allowObfuscation;
41
42
43    public KeepSpecificationsPanel(JFrame  owner,
44                                   boolean markClasses,
45                                   boolean markConditionally,
46                                   boolean markDescriptorClasses,
47                                   boolean allowShrinking,
48                                   boolean allowOptimization,
49                                   boolean allowObfuscation)
50    {
51        super(owner, true);
52
53        this.markClasses           = markClasses;
54        this.markConditionally     = markConditionally;
55        this.markDescriptorClasses = markDescriptorClasses;
56        this.allowShrinking        = allowShrinking;
57        this.allowOptimization     = allowOptimization;
58        this.allowObfuscation      = allowObfuscation;
59    }
60
61
62    // Factory methods for ClassSpecificationsPanel.
63
64    protected ClassSpecification createClassSpecification()
65    {
66        return new KeepClassSpecification(markClasses,
67                                          markConditionally,
68                                          markDescriptorClasses,
69                                          allowShrinking,
70                                          allowOptimization,
71                                          allowObfuscation);
72    }
73
74
75    protected void setClassSpecification(ClassSpecification classSpecification)
76    {
77        classSpecificationDialog.setKeepSpecification((KeepClassSpecification)classSpecification);
78    }
79
80
81    protected ClassSpecification getClassSpecification()
82    {
83        return classSpecificationDialog.getKeepSpecification();
84    }
85}
86