// Path: src/travis/util/Messages.java
// public final class Messages {
//     private static final ResourceBundle messages;
// 
//     static {
//         messages = ResourceBundle.getBundle(
//                 "travis.resources.messages", Locale.getDefault());
//     }
// 
//     private Messages() {
//     }
// 
//     public static String get(String key) {
//         return messages.getString(key);
//     }
// 
//     public static String format(String key, Object... args) {
//         return MessageFormat.format(get(key), args);
//     }
// }
// 
// Path: src/travis/view/Util.java
// public class Util {
// 
//     public static final RenderingHints HINTS;
// 
//     static {
//         HINTS = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
//                 RenderingHints.VALUE_ANTIALIAS_ON);
//         HINTS.put(RenderingHints.KEY_TEXT_ANTIALIASING,
//                 RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
//     }
// 
//     public static JButton getButtonWithIcon(String name) {
//         JButton b = new JButton(IconFactory.createImageIcon(name + ".png"));
//         b.setPressedIcon(IconFactory.createImageIcon(name + "_pressed.png"));
//         return b;
//     }
// 
//     public static int pow(int num, int power) {
//         if (power < 1) {
//             return 1;
//         }
//         return num * pow(num, --power);
//     }
// 
//     public static boolean containsFlag(int flags, int flag) {
//         return (flags & flag) == flag;
//     }
// 
//     public static int toggleFlag(int flags, int flag, boolean enabled) {
//         if (enabled) {
//             flags |= flag;
//         } else {
//             flags &= ~flag;
//         }
//         return flags;
//     }
// 
//     public static JSlider createSlider(int min, int max, int init,
//                                        int majorTick, int minorTick) {
//         JSlider slider = new JSlider(SwingConstants.HORIZONTAL, min, max, init);
//         slider.setMajorTickSpacing(majorTick);
//         slider.setMinorTickSpacing(minorTick);
//         slider.setPaintLabels(true);
//         slider.setPaintTicks(true);
//         return slider;
//     }
// 
//     public static JPanel createBorderedPanel(String title,
//                                              Component... components) {
//         return createBorderedPanel(title, "", components);
//     }
// 
//     public static JPanel createBorderedPanel(String title, String constraints,
//                                              Component... components) {
//         JPanel panel = new JPanel(new MigLayout("fillx, insets 0, gap 0, "
//                 + constraints));
//         if (components == null || components.length == 0) {
//             return panel;
//         }
//         panel.setBorder(BorderFactory.createTitledBorder(
//                 BorderFactory.createLineBorder(Color.BLACK), title,
//                 TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION));
//         for (Component component : components) {
//             panel.add(component, "grow");
//         }
//         return panel;
//     }
// 
// }


import javax.swing.JRadioButton;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import net.miginfocom.swing.MigLayout;
import travis.util.Messages;
import travis.view.Util;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.text.DecimalFormatSymbols;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
/*
 * TracesPanel.java
 *
 * Copyright (C) 2011-2012, Artur Jonkisz, <travis.source@gmail.com>
 *
 * This file is part of TraVis.
 * See https://github.com/ajonkisz/TraVis for more info.
 *
 * TraVis is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TraVis is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with TraVis.  If not, see <http://www.gnu.org/licenses/>.
 */

package travis.view.settings;



public class TracesPanel extends SettingsTab implements ChangeListener,
        ItemListener, ActionListener {

    private static final long serialVersionUID = 8898812372626112784L;

    private final Settings sets = Settings.getInstance();

    private final JSlider cachedTracesSlider;

    private final JSlider curvesNoSlider;
    private final JLabel curvesNoLabel;
    private final JCheckBox maxCurvesBox;
    private final JRadioButton uniqueTraces;
    private final JRadioButton latestTraces;

    private final JSlider curvesPerSecSlider;

    public TracesPanel() {
        super(new MigLayout("wrap 1, insets 0, fillx"));

        cachedTracesSlider = Util.createSlider(0, 100, 0, 10, 5);
        cachedTracesSlider.addChangeListener(this);

        curvesNoSlider = Util.createSlider(0, 200, 0, 50, 25);
        curvesNoSlider.addChangeListener(this);

        curvesNoLabel = new JLabel();

        maxCurvesBox = new JCheckBox(Messages.get("no.max"));
        maxCurvesBox.addItemListener(this);

        ButtonGroup group = new ButtonGroup();
        uniqueTraces = new JRadioButton(Messages.get("unique.traces"));
        uniqueTraces.addActionListener(this);
        group.add(uniqueTraces);
        latestTraces = new JRadioButton(Messages.get("latest.traces"));
        latestTraces.addActionListener(this);
        group.add(latestTraces);

        curvesPerSecSlider = Util.createSlider(0, 25, 0, 5, 1);
// Path: src/travis/util/Messages.java
// public final class Messages {
//     private static final ResourceBundle messages;
// 
//     static {
//         messages = ResourceBundle.getBundle(
//                 "travis.resources.messages", Locale.getDefault());
//     }
// 
//     private Messages() {
//     }
// 
//     public static String get(String key) {
//         return messages.getString(key);
//     }
// 
//     public static String format(String key, Object... args) {
//         return MessageFormat.format(get(key), args);
//     }
// }
// 
// Path: src/travis/view/Util.java
// public class Util {
// 
//     public static final RenderingHints HINTS;
// 
//     static {
//         HINTS = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
//                 RenderingHints.VALUE_ANTIALIAS_ON);
//         HINTS.put(RenderingHints.KEY_TEXT_ANTIALIASING,
//                 RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
//     }
// 
//     public static JButton getButtonWithIcon(String name) {
//         JButton b = new JButton(IconFactory.createImageIcon(name + ".png"));
//         b.setPressedIcon(IconFactory.createImageIcon(name + "_pressed.png"));
//         return b;
//     }
// 
//     public static int pow(int num, int power) {
//         if (power < 1) {
//             return 1;
//         }
//         return num * pow(num, --power);
//     }
// 
//     public static boolean containsFlag(int flags, int flag) {
//         return (flags & flag) == flag;
//     }
// 
//     public static int toggleFlag(int flags, int flag, boolean enabled) {
//         if (enabled) {
//             flags |= flag;
//         } else {
//             flags &= ~flag;
//         }
//         return flags;
//     }
// 
//     public static JSlider createSlider(int min, int max, int init,
//                                        int majorTick, int minorTick) {
//         JSlider slider = new JSlider(SwingConstants.HORIZONTAL, min, max, init);
//         slider.setMajorTickSpacing(majorTick);
//         slider.setMinorTickSpacing(minorTick);
//         slider.setPaintLabels(true);
//         slider.setPaintTicks(true);
//         return slider;
//     }
// 
//     public static JPanel createBorderedPanel(String title,
//                                              Component... components) {
//         return createBorderedPanel(title, "", components);
//     }
// 
//     public static JPanel createBorderedPanel(String title, String constraints,
//                                              Component... components) {
//         JPanel panel = new JPanel(new MigLayout("fillx, insets 0, gap 0, "
//                 + constraints));
//         if (components == null || components.length == 0) {
//             return panel;
//         }
//         panel.setBorder(BorderFactory.createTitledBorder(
//                 BorderFactory.createLineBorder(Color.BLACK), title,
//                 TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION));
//         for (Component component : components) {
//             panel.add(component, "grow");
//         }
//         return panel;
//     }
// 
// }


// Path: src/travis/view/settings/TracesPanel.java
import javax.swing.JRadioButton;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import net.miginfocom.swing.MigLayout;
import travis.util.Messages;
import travis.view.Util;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.text.DecimalFormatSymbols;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

/*
 * TracesPanel.java
 *
 * Copyright (C) 2011-2012, Artur Jonkisz, <travis.source@gmail.com>
 *
 * This file is part of TraVis.
 * See https://github.com/ajonkisz/TraVis for more info.
 *
 * TraVis is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TraVis is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with TraVis.  If not, see <http://www.gnu.org/licenses/>.
 */

package travis.view.settings;



public class TracesPanel extends SettingsTab implements ChangeListener,
        ItemListener, ActionListener {

    private static final long serialVersionUID = 8898812372626112784L;

    private final Settings sets = Settings.getInstance();

    private final JSlider cachedTracesSlider;

    private final JSlider curvesNoSlider;
    private final JLabel curvesNoLabel;
    private final JCheckBox maxCurvesBox;
    private final JRadioButton uniqueTraces;
    private final JRadioButton latestTraces;

    private final JSlider curvesPerSecSlider;

    public TracesPanel() {
        super(new MigLayout("wrap 1, insets 0, fillx"));

        cachedTracesSlider = Util.createSlider(0, 100, 0, 10, 5);
        cachedTracesSlider.addChangeListener(this);

        curvesNoSlider = Util.createSlider(0, 200, 0, 50, 25);
        curvesNoSlider.addChangeListener(this);

        curvesNoLabel = new JLabel();

        maxCurvesBox = new JCheckBox(Messages.get("no.max"));
        maxCurvesBox.addItemListener(this);

        ButtonGroup group = new ButtonGroup();
        uniqueTraces = new JRadioButton(Messages.get("unique.traces"));
        uniqueTraces.addActionListener(this);
        group.add(uniqueTraces);
        latestTraces = new JRadioButton(Messages.get("latest.traces"));
        latestTraces.addActionListener(this);
        group.add(latestTraces);

        curvesPerSecSlider = Util.createSlider(0, 25, 0, 5, 1);
        curvesPerSecSlider.addChangeListener(this);