From e95d216c1f74ba3ed966ac46304c406667090a5f Mon Sep 17 00:00:00 2001 From: 66-m <53166536+66-m@users.noreply.github.com> Date: Thu, 12 Mar 2026 12:50:47 +0100 Subject: [PATCH 1/2] refactor(settings): extract UI into themed components and cards Introduce UiTheme, ComponentFactory, and StyledCard to centralize styling constants and component creation. Reorganize Settings.java into discrete factory methods (createSortingCard, createSpeedCard, createVisualizationCard, createGradientCard, createDisplayCard, createSoundCard, createActionPanel) for better separation of concerns. Move run-all dialog logic to showRunAllDialog() and image selection to selectImageFile(). --- .../Control/ComponentFactory.java | 307 +++++ .../compilerstuck/Control/Settings.java | 1130 ++++++++--------- .../compilerstuck/Control/StyledCard.java | 79 ++ .../github/compilerstuck/Control/UiTheme.java | 93 ++ 4 files changed, 1041 insertions(+), 568 deletions(-) create mode 100644 src/main/java/io/github/compilerstuck/Control/ComponentFactory.java create mode 100644 src/main/java/io/github/compilerstuck/Control/StyledCard.java create mode 100644 src/main/java/io/github/compilerstuck/Control/UiTheme.java diff --git a/src/main/java/io/github/compilerstuck/Control/ComponentFactory.java b/src/main/java/io/github/compilerstuck/Control/ComponentFactory.java new file mode 100644 index 0000000..449b9b8 --- /dev/null +++ b/src/main/java/io/github/compilerstuck/Control/ComponentFactory.java @@ -0,0 +1,307 @@ +package io.github.compilerstuck.Control; + +import javax.swing.*; +import javax.swing.border.Border; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * Factory for consistently styled, rounded UI components. + * All buttons use custom-painted rounded rectangles for a modern 2025 look. + */ +public class ComponentFactory { + + private static final int BUTTON_ARC = 8; + private static final int INPUT_ARC = 6; + private static final int INPUT_PAD_H = 10; + private static final int INPUT_PAD_V = 6; + + // ── Labels ──────────────────────────────────────────────────────────────── + + public static JLabel createTitleLabel(String text) { + JLabel label = new JLabel(text); + label.setFont(UiTheme.FONT_TITLE); + label.setForeground(UiTheme.TEXT_PRIMARY); + label.setOpaque(false); + return label; + } + + public static JLabel createSubtitleLabel(String text) { + JLabel label = new JLabel(text); + label.setFont(UiTheme.FONT_SUBTITLE); + label.setForeground(UiTheme.TEXT_PRIMARY); + label.setOpaque(false); + return label; + } + + public static JLabel createFormLabel(String text) { + JLabel label = new JLabel(text); + label.setFont(UiTheme.FONT_LABEL); + label.setForeground(UiTheme.TEXT_PRIMARY); + label.setOpaque(false); + return label; + } + + // ── Buttons ─────────────────────────────────────────────────────────────── + + /** + * Primary action button — dark background, white text, rounded corners. + * Used for the main "RUN" action — more prominence with larger font. + */ + public static JButton createPrimaryButton(String text) { + JButton btn = buildRoundedButton(text, UiTheme.BUTTON_PRIMARY, UiTheme.BUTTON_PRIMARY_FG, + null, BUTTON_ARC, UiTheme.BUTTON_HEIGHT); + btn.setFont(new Font(UiTheme.FONT_FAMILY, Font.BOLD, 14)); + addHoverSmooth(btn, UiTheme.BUTTON_PRIMARY, UiTheme.BUTTON_PRIMARY_HOVER); + btn.setPreferredSize(new Dimension(120, UiTheme.BUTTON_HEIGHT)); + btn.setMinimumSize(new Dimension(90, UiTheme.BUTTON_HEIGHT)); + btn.setMaximumSize(new Dimension(220, UiTheme.BUTTON_HEIGHT)); + return btn; + } + + /** + * Secondary action button — white background, zinc border, dark text. + * Used for "Cancel", etc. + */ + public static JButton createSecondaryButton(String text) { + JButton btn = buildRoundedButton(text, UiTheme.BUTTON_SECONDARY, UiTheme.TEXT_PRIMARY, + UiTheme.BORDER_COLOR, BUTTON_ARC, UiTheme.BUTTON_HEIGHT); + btn.setFont(UiTheme.FONT_LABEL); + addHoverSmooth(btn, UiTheme.BUTTON_SECONDARY, UiTheme.BUTTON_SECONDARY_HOVER); + btn.setPreferredSize(new Dimension(110, UiTheme.BUTTON_HEIGHT)); + btn.setMinimumSize(new Dimension(80, UiTheme.BUTTON_HEIGHT)); + btn.setMaximumSize(new Dimension(200, UiTheme.BUTTON_HEIGHT)); + return btn; + } + + /** + * Compact inline button for auxiliary actions (Apply, Configure, Select Image). + * Same visual style as secondary but smaller height. + */ + public static JButton createSmallButton(String text) { + JButton btn = buildRoundedButton(text, UiTheme.BUTTON_SECONDARY, UiTheme.TEXT_PRIMARY, + UiTheme.BORDER_COLOR, BUTTON_ARC, UiTheme.BUTTON_HEIGHT_SMALL); + btn.setFont(UiTheme.FONT_SMALL); + addHoverSmooth(btn, UiTheme.BUTTON_SECONDARY, UiTheme.BUTTON_SECONDARY_HOVER); + btn.setPreferredSize(new Dimension(90, UiTheme.BUTTON_HEIGHT_SMALL)); + btn.setMinimumSize(new Dimension(60, UiTheme.BUTTON_HEIGHT_SMALL)); + btn.setMaximumSize(new Dimension(200, UiTheme.BUTTON_HEIGHT_SMALL)); + return btn; + } + + /** Shared builder for all rounded buttons. */ + private static JButton buildRoundedButton(String text, Color bg, Color fg, Color borderCol, + int arc, int height) { + final Color[] borderRef = {borderCol}; + JButton btn = new JButton(text) { + @Override + protected void paintComponent(Graphics g) { + Graphics2D g2 = (Graphics2D) g.create(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setColor(isEnabled() ? getBackground() : new Color(244, 244, 245)); + g2.fillRoundRect(0, 0, getWidth(), getHeight(), arc, arc); + g2.dispose(); + super.paintComponent(g); + } + + @Override + protected void paintBorder(Graphics g) { + if (borderRef[0] == null) return; + Graphics2D g2 = (Graphics2D) g.create(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setColor(isEnabled() ? borderRef[0] : new Color(228, 228, 231)); + g2.setStroke(new BasicStroke(1.0f)); + g2.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc); + g2.dispose(); + } + }; + btn.setContentAreaFilled(false); + btn.setOpaque(false); + btn.setBorderPainted(false); // we handle border in paintBorder override + btn.setFocusPainted(false); + btn.setBackground(bg); + btn.setForeground(fg); + btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + btn.setMargin(new Insets(0, UiTheme.SPACING_MD, 0, UiTheme.SPACING_MD)); + return btn; + } + + // ── Form inputs ─────────────────────────────────────────────────────────── + + public static JCheckBox createCheckBox(String label) { + JCheckBox cb = new JCheckBox(label); + cb.setFont(UiTheme.FONT_LABEL); + cb.setForeground(UiTheme.TEXT_PRIMARY); + cb.setOpaque(false); + cb.setFocusPainted(false); + return cb; + } + + public static JComboBox createComboBox() { + JComboBox box = new JComboBox<>(); + box.setFont(UiTheme.FONT_BODY); + box.setForeground(UiTheme.TEXT_PRIMARY); + box.setBackground(Color.WHITE); + box.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createLineBorder(UiTheme.BORDER_COLOR, 1), + BorderFactory.createEmptyBorder(2, 4, 2, 4) + )); + box.setPreferredSize(new Dimension(150, UiTheme.INPUT_HEIGHT)); + box.setMaximumRowCount(15); + return box; + } + + public static JTextField createTextField() { + JTextField field = new JTextField(); + field.setFont(UiTheme.FONT_BODY); + field.setForeground(UiTheme.TEXT_PRIMARY); + field.setBackground(UiTheme.BG_INPUT); + field.setOpaque(true); // paint our own background (slightly off-white) + field.setCaretColor(UiTheme.ACCENT_PRIMARY); + field.setSelectionColor(UiTheme.ACCENT_PRIMARY); + field.setSelectedTextColor(Color.WHITE); + field.setPreferredSize(new Dimension(120, UiTheme.INPUT_HEIGHT)); + field.setBorder(buildInputBorder(UiTheme.BORDER_COLOR)); + + // Blue focus ring + field.addFocusListener(new java.awt.event.FocusAdapter() { + @Override public void focusGained(java.awt.event.FocusEvent e) { + field.setBorder(buildInputBorder(UiTheme.BORDER_FOCUS)); + field.setForeground(UiTheme.TEXT_PRIMARY); + } + @Override public void focusLost(java.awt.event.FocusEvent e) { + field.setBorder(buildInputBorder(UiTheme.BORDER_COLOR)); + } + }); + return field; + } + + /** Rounded input border that also fills the white background. */ + private static Border buildInputBorder(Color borderColor) { + return new Border() { + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { + Graphics2D g2 = (Graphics2D) g.create(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setColor(borderColor); + g2.setStroke(new BasicStroke(1.0f)); + g2.drawRoundRect(x, y, w - 1, h - 1, INPUT_ARC, INPUT_ARC); + g2.dispose(); + } + @Override public Insets getBorderInsets(Component c) { + return new Insets(INPUT_PAD_V, INPUT_PAD_H, INPUT_PAD_V, INPUT_PAD_H); + } + @Override public boolean isBorderOpaque() { return false; } + }; + } + + public static JSlider createSlider(int min, int max, int initial) { + JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, initial); + slider.setFont(UiTheme.FONT_SMALL); + slider.setForeground(UiTheme.TEXT_SECONDARY); + slider.setOpaque(false); + slider.setPaintTicks(true); + slider.setPaintLabels(true); + slider.putClientProperty("JSlider.isFilled", true); + slider.putClientProperty("Slider.paintThumbArrowShape", false); + return slider; + } + + /** + * Color swatch panel — compact rounded square, click to pick color. + */ + public static JPanel createColorSwatch(Color color) { + JPanel swatch = new JPanel() { + @Override + protected void paintComponent(Graphics g) { + Graphics2D g2 = (Graphics2D) g.create(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setColor(getBackground()); + g2.fillRoundRect(0, 0, getWidth(), getHeight(), 6, 6); + g2.setColor(UiTheme.BORDER_COLOR); + g2.setStroke(new BasicStroke(1.5f)); + g2.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 6, 6); + g2.dispose(); + } + }; + int sz = UiTheme.COLOR_SWATCH_SIZE; + swatch.setBackground(color); + swatch.setPreferredSize(new Dimension(sz, sz)); + swatch.setMaximumSize(new Dimension(sz, sz)); + swatch.setMinimumSize(new Dimension(sz, sz)); + swatch.setOpaque(false); + swatch.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + swatch.setToolTipText("Click to customize color"); + return swatch; + } + + /** + * Thin accent-colored progress bar — used as a status strip. + */ + public static JProgressBar createProgressBar() { + JProgressBar bar = new JProgressBar(0, 100); + bar.setForeground(UiTheme.ACCENT_PRIMARY); + bar.setBackground(UiTheme.BG_INPUT); + bar.setBorder(null); + bar.setPreferredSize(new Dimension(400, 4)); + bar.setMaximumSize(new Dimension(Integer.MAX_VALUE, 4)); + bar.setStringPainted(false); + return bar; + } + + public static JComponent createSeparator() { + JSeparator sep = new JSeparator(JSeparator.HORIZONTAL); + sep.setForeground(UiTheme.BORDER_COLOR); + sep.setPreferredSize(new Dimension(Integer.MAX_VALUE, 12)); + return sep; + } + + public static StyledCard createCard() { + return new StyledCard(); + } + + // ── Hover helper ───────────────────────────────────────────────────────── + + private static void addHoverSmooth(JButton btn, Color normal, Color hover) { + btn.addMouseListener(new MouseAdapter() { + private Timer timer; + private boolean targetHover = false; + private Color currentColor = normal; + + @Override public void mouseEntered(MouseEvent e) { + if (!btn.isEnabled()) return; + targetHover = true; + if (timer != null) timer.stop(); + animateColor(); + } + + @Override public void mouseExited(MouseEvent e) { + targetHover = false; + if (timer != null) timer.stop(); + animateColor(); + } + + private void animateColor() { + timer = new Timer(16, evt -> { + Color target = targetHover ? hover : normal; + if (!currentColor.equals(target)) { + currentColor = interpolate(currentColor, target, 0.3f); + btn.setBackground(currentColor); + } else { + ((Timer)evt.getSource()).stop(); + } + }); + timer.start(); + } + + private Color interpolate(Color a, Color b, float t) { + return new Color( + (int)(a.getRed() + (b.getRed() - a.getRed()) * t), + (int)(a.getGreen() + (b.getGreen() - a.getGreen()) * t), + (int)(a.getBlue() + (b.getBlue() - a.getBlue()) * t) + ); + } + }); + } +} diff --git a/src/main/java/io/github/compilerstuck/Control/Settings.java b/src/main/java/io/github/compilerstuck/Control/Settings.java index fa84040..b659f47 100644 --- a/src/main/java/io/github/compilerstuck/Control/Settings.java +++ b/src/main/java/io/github/compilerstuck/Control/Settings.java @@ -1,8 +1,5 @@ package io.github.compilerstuck.Control; -import com.intellij.uiDesigner.core.GridConstraints; -import com.intellij.uiDesigner.core.GridLayoutManager; -import com.intellij.uiDesigner.core.Spacer; import io.github.compilerstuck.SortingAlgorithms.*; import io.github.compilerstuck.Visual.*; import io.github.compilerstuck.Visual.Gradient.ColorGradient; @@ -13,118 +10,77 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.plaf.FontUIResource; -import javax.swing.text.StyleContext; import java.awt.*; import java.awt.event.*; import java.io.File; import java.util.ArrayList; import java.util.Arrays; -import java.util.Locale; import java.util.Objects; +/** + * Modernized Settings UI for the Sorting Algorithm Visualizer. + * Features: + * - Tabbed interface for better organization + * - Modern color scheme and typography + * - Improved spacing and visual hierarchy + * - Enhanced component styling for better UX + * - All original functionality preserved + */ public class Settings extends JFrame { protected PApplet proc; - JComboBox gradientListComboBox; - JSlider arraySizeSlider; + // UI Components private JSlider speedSlider; - private JPanel settingsPanel; - private JPanel colorChoose1; - private JPanel colorChoose2; - private JCheckBox muteCheckBox; + private JSlider arraySizeSlider; + private JTextField arraySizeTextField; + private JButton arraySizeOkButton; + private JComboBox algorithmListComboBox; - private JLabel gradientListLabel; - private JLabel algorithmListLabel; - private JLabel muteCheckBoxLabel; - private JButton runButton; private JCheckBox runAllCheckBox; + private JButton buttonRunAllSettings; private JComboBox shuffleListBox; - private JLabel shuffleListLabel; - private JButton cancelButton; - private JCheckBox comparisonTableCheckBox; - private JLabel arrayTitleLabel; - private JLabel visualTitleLabel; - private JProgressBar progressBarArray; - private JLabel soundTitleLabel; - private JLabel comparisonTableCheckBoxLabel; - private JLabel sortingTitleLabel; + private JComboBox visualizationListComboBox; - private JLabel visualizationListComboBoxLabel; - private JTextField arraySizeTextField; - private JButton arraySizeOkButton; + private JComboBox gradientListComboBox; + private JPanel colorChoose1; + private JPanel colorChoose2; private JCheckBox showMeasurementsCheckBox; - private JLabel showMeasurementsLabel; - private JButton buttonRunAllSettings; + private JCheckBox comparisonTableCheckBox; private JButton buttonSetImg; - - ArrayList algorithmList; - ArrayList gradientList; - ArrayList shuffleTypes; - ArrayList visualizationList; - + + private JCheckBox muteCheckBox; + + private JButton runButton; + private JButton cancelButton; + private JProgressBar progressBarArray; + + // Data + private ArrayList algorithmList; + private ArrayList gradientList; + private ArrayList shuffleTypes; + private ArrayList visualizationList; + + // State + private final Color errorColor = new Color(244, 67, 54); + private int maxSize = 20000; public Settings() throws UnsupportedLookAndFeelException, ClassNotFoundException, InstantiationException, IllegalAccessException { initialize(); } public void initialize() { - proc = (PApplet) MainController.processing; - int maxSize = 20000; - //Frame Settings - // Speed control — 5 named snap levels - // Level: 1=Very Slow 2=Slow 3=Normal 4=Fast 5=Max - // delayTime (ms): 50 10 1 1 1 - // delayFactor: 1.0 1.0 1.0 0.12 0.02 - final int[] DELAY_TIME = { 50, 10, 1, 1, 1 }; - final double[] DELAY_FACTOR = { 1.0, 1.0, 1.0, 0.12, 0.02 }; - - speedSlider = new JSlider(JSlider.HORIZONTAL, 1, 5, 3); - speedSlider.setSnapToTicks(true); - speedSlider.setPaintTicks(true); - speedSlider.setPaintLabels(true); - speedSlider.setMajorTickSpacing(1); - - java.util.Hashtable speedLabels = new java.util.Hashtable<>(); - speedLabels.put(1, new JLabel("Very Slow")); - speedLabels.put(2, new JLabel("Slow")); - speedLabels.put(3, new JLabel("Normal")); - speedLabels.put(4, new JLabel("Fast")); - speedLabels.put(5, new JLabel("Max")); - speedSlider.setLabelTable(speedLabels); - speedSlider.setToolTipText("Animation speed"); - - speedSlider.addChangeListener(e -> { - int level = speedSlider.getValue() - 1; // 0-based index - MainController.setDelayTime(DELAY_TIME[level]); - MainController.setDelayFactor(DELAY_FACTOR[level]); - }); - - JPanel speedPanel = new JPanel(new BorderLayout(6, 0)); - speedPanel.setBorder(BorderFactory.createCompoundBorder( - BorderFactory.createTitledBorder("Speed"), - BorderFactory.createEmptyBorder(2, 6, 6, 6) - )); - speedPanel.add(speedSlider, BorderLayout.CENTER); - - JPanel root = new JPanel(new BorderLayout()); - root.add(speedPanel, BorderLayout.NORTH); - root.add(settingsPanel, BorderLayout.CENTER); - - setContentPane(root); - setSize(650, 600); - setLocation(10, 10); + // Configure window + setTitle("Sorting Algorithm Visualizer - Settings"); setDefaultCloseOperation(EXIT_ON_CLOSE); setResizable(true); - setMinimumSize(new Dimension(650, 600)); - setTitle("Sorting Algorithm Visualizer - Settings"); - //setIconImage(new ImageIcon("src/main/resources/ChannelLogoWhite_64x64.png").getImage()); - - int arraySize = MainController.getSize(); - + setSize(1100, 640); + setMinimumSize(new Dimension(900, 580)); + setLocationRelativeTo(null); + + // Add window listener addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent windowEvent) { @@ -132,151 +88,219 @@ public void windowClosing(WindowEvent windowEvent) { } }); - gradientList = new ArrayList<>(Arrays.asList( - new ColorGradient(new Color(200, 0, 0), new Color(200, 0, 0), Color.WHITE, "Red"), - new ColorGradient(new Color(0, 200, 0), new Color(0, 200, 0), Color.WHITE, "Green"), - new ColorGradient(new Color(0, 0, 200), new Color(0, 0, 200), Color.WHITE, "Blue"), - new ColorGradient(Color.WHITE, Color.WHITE, Color.RED, "White"), - new ColorGradient(Color.WHITE, Color.BLACK, Color.WHITE, "White -> Black"), - new ColorGradient(Color.RED, Color.BLACK, Color.WHITE, "Red -> Black"), - new ColorGradient(Color.BLUE, Color.RED, Color.WHITE, "Blue -> Red"), - new ColorGradient(Color.BLACK, Color.WHITE, Color.WHITE, "Black -> White"), - new ColorGradient(Color.BLACK, Color.RED, Color.WHITE, "Black -> Red"), - new MultiGradient(Color.WHITE, "Rainbow"), - new ColorGradient(Color.PINK, Color.BLACK, Color.WHITE, "Custom Gradient") - )); + // Create main UI + JComponent mainPanel = createMainUI(); + setContentPane(mainPanel); + setVisible(true); + } - for (ColorGradient gradient : gradientList) { - gradientListComboBox.addItem(gradient.getName()); + /** + * Create the main one-page two-column interface + */ + private JComponent createMainUI() { + JPanel root = new JPanel(new BorderLayout()); + root.setBackground(UiTheme.BG_PRIMARY); + root.setBorder(BorderFactory.createEmptyBorder( + UiTheme.SPACING_LG, UiTheme.SPACING_LG, 0, UiTheme.SPACING_LG)); + + root.add(createHeaderPanel(), BorderLayout.NORTH); + + // Two equal columns separated by a gap + JPanel columns = new JPanel(new GridLayout(1, 2, UiTheme.SPACING_LG, 0)); + columns.setBackground(UiTheme.BG_PRIMARY); + columns.setBorder(BorderFactory.createEmptyBorder(UiTheme.SPACING_MD, 0, 0, 0)); + columns.add(createLeftColumn()); + columns.add(createRightColumn()); + + JScrollPane scroll = new JScrollPane(columns); + scroll.setBorder(null); + scroll.getViewport().setBackground(UiTheme.BG_PRIMARY); + scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + + root.add(scroll, BorderLayout.CENTER); + root.add(createActionPanel(), BorderLayout.SOUTH); + return root; + } + + /** Small uppercase section label placed above each card. */ + private JLabel createSectionLabel(String text) { + JLabel label = new JLabel(text.toUpperCase()); + label.setFont(UiTheme.FONT_SECTION); + label.setForeground(UiTheme.ACCENT_PRIMARY); + label.setAlignmentX(Component.LEFT_ALIGNMENT); + label.setBorder(BorderFactory.createEmptyBorder(0, 2, UiTheme.SPACING_XS, 0)); + return label; + } + + /** Left column: Array Size → Sorting → Speed */ + private JPanel createLeftColumn() { + JPanel col = new JPanel(); + col.setLayout(new BoxLayout(col, BoxLayout.Y_AXIS)); + col.setBackground(UiTheme.BG_PRIMARY); + + StyledCard arraySizeCard = createArraySizeCard(); + StyledCard sortingCard = createSortingCard(); + StyledCard speedCard = createSpeedCard(); + for (StyledCard c : new StyledCard[]{arraySizeCard, sortingCard, speedCard}) { + c.setAlignmentX(Component.LEFT_ALIGNMENT); + c.setMaximumSize(new Dimension(Integer.MAX_VALUE, 1000)); } - gradientListComboBox.setSelectedIndex(5); - Color color1 = MainController.getColorGradient().getMarkerColor(0, Marker.NORMAL); - colorChoose1.setBackground(color1); - Color color2 = MainController.getColorGradient().getMarkerColor(MainController.getSize() - 1, Marker.NORMAL); - colorChoose2.setBackground(color2); - colorChoose2.setVisible(true); + col.add(createSectionLabel("Array Size")); + col.add(arraySizeCard); + col.add(Box.createVerticalStrut(UiTheme.SPACING_LG)); + col.add(createSectionLabel("Sorting")); + col.add(sortingCard); + col.add(Box.createVerticalStrut(UiTheme.SPACING_LG)); + col.add(createSectionLabel("Speed")); + col.add(speedCard); + col.add(Box.createVerticalGlue()); + return col; + } - gradientListComboBox.addActionListener(e -> { - ColorGradient selected = gradientList.get(gradientListComboBox.getSelectedIndex()); - selected.updateGradient(MainController.getSize()); - MainController.setColorGradient(selected); - Color newColor1 = MainController.getColorGradient().getMarkerColor(0, Marker.NORMAL); - colorChoose1.setBackground(newColor1); - Color newColor2 = MainController.getColorGradient().getMarkerColor(MainController.getSize() - 1, Marker.NORMAL); - colorChoose2.setBackground(newColor2); - }); + /** Right column: Visualization → Gradient → Display → Sound */ + private JPanel createRightColumn() { + JPanel col = new JPanel(); + col.setLayout(new BoxLayout(col, BoxLayout.Y_AXIS)); + col.setBackground(UiTheme.BG_PRIMARY); + + StyledCard vizCard = createVisualizationCard(); + StyledCard gradientCard = createGradientCard(); + StyledCard displayCard = createDisplayCard(); + StyledCard soundCard = createSoundCard(); + for (StyledCard c : new StyledCard[]{vizCard, gradientCard, displayCard, soundCard}) { + c.setAlignmentX(Component.LEFT_ALIGNMENT); + c.setMaximumSize(new Dimension(Integer.MAX_VALUE, 1000)); + } - gradientListComboBox.actionPerformed(null); + col.add(createSectionLabel("Visualization")); + col.add(vizCard); + col.add(Box.createVerticalStrut(UiTheme.SPACING_LG)); + col.add(createSectionLabel("Gradient")); + col.add(gradientCard); + col.add(Box.createVerticalStrut(UiTheme.SPACING_LG)); + col.add(createSectionLabel("Display")); + col.add(displayCard); + col.add(Box.createVerticalStrut(UiTheme.SPACING_LG)); + col.add(createSectionLabel("Sound")); + col.add(soundCard); + col.add(Box.createVerticalGlue()); + return col; + } - MouseListener ml = new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - JPanel jPanel = (JPanel) e.getSource(); - Color initColor = jPanel.getBackground(); - Color selectedColor = JColorChooser.showDialog(null, - "Color picker", jPanel.getBackground()); - if (selectedColor != null && !initColor.equals(selectedColor)) { - jPanel.setBackground(selectedColor); - if (jPanel.getName().equals("colorChoose1")) { - gradientList.get(gradientList.size() - 1).setColor1(selectedColor); - gradientList.get(gradientList.size() - 1).setColor2(colorChoose2.getBackground()); - } else { - gradientList.get(gradientList.size() - 1).setColor2(selectedColor); - gradientList.get(gradientList.size() - 1).setColor1(colorChoose1.getBackground()); - } - gradientListComboBox.setSelectedIndex(gradientList.size() - 1); - } - } - }; + /** Slim title bar: "Sorting Visualizer" on the left, "Settings" on the right. */ + private JPanel createHeaderPanel() { + JPanel panel = new JPanel(new BorderLayout()); + panel.setBackground(UiTheme.BG_PRIMARY); + panel.setBorder(BorderFactory.createEmptyBorder(0, 0, UiTheme.SPACING_MD, 0)); + + JLabel title = new JLabel("Sorting Visualizer"); + title.setFont(UiTheme.FONT_TITLE); + title.setForeground(UiTheme.TEXT_PRIMARY); + panel.add(title, BorderLayout.WEST); + + JLabel subtitle = new JLabel("Settings"); + subtitle.setFont(UiTheme.FONT_BODY); + subtitle.setForeground(UiTheme.TEXT_SECONDARY); + panel.add(subtitle, BorderLayout.EAST); + return panel; + } - colorChoose1.addMouseListener(ml); - colorChoose2.addMouseListener(ml); + /** Array size: slider on top, then [text-field] [Apply] in one row. */ + private StyledCard createArraySizeCard() { + StyledCard card = ComponentFactory.createCard(); + card.setLayout(new BoxLayout(card, BoxLayout.Y_AXIS)); - //Array size slider + int arraySize = MainController.getSize(); + arraySizeSlider = ComponentFactory.createSlider(0, maxSize, arraySize); arraySizeSlider.setPaintTicks(true); - arraySizeSlider.setPaintTrack(true); - arraySizeSlider.setMinimum(0); - arraySizeSlider.setMaximum(maxSize); - arraySizeSlider.setValue(arraySize); + arraySizeSlider.setPaintLabels(true); arraySizeSlider.setMinorTickSpacing(maxSize / 8); arraySizeSlider.setMajorTickSpacing(maxSize / 4); - arraySizeSlider.setPaintLabels(true); + arraySizeSlider.setAlignmentX(Component.LEFT_ALIGNMENT); + arraySizeSlider.setMaximumSize(new Dimension(Integer.MAX_VALUE, 55)); - //Color normalSliderColor = arraySizeSlider.getBackground(); - Color errorColor = new Color(255, 72, 72); - Color normalTextFieldForegroundColor = arraySizeTextField.getForeground(); + arraySizeTextField = ComponentFactory.createTextField(); + arraySizeTextField.setText(String.valueOf(arraySize)); + arraySizeTextField.setMaximumSize(new Dimension(90, UiTheme.INPUT_HEIGHT)); + arraySizeTextField.setPreferredSize(new Dimension(90, UiTheme.INPUT_HEIGHT)); + arraySizeOkButton = ComponentFactory.createSmallButton("Apply"); + arraySizeOkButton.setEnabled(false); + + JPanel inputRow = new JPanel(); + inputRow.setLayout(new BoxLayout(inputRow, BoxLayout.X_AXIS)); + inputRow.setOpaque(false); + inputRow.setAlignmentX(Component.LEFT_ALIGNMENT); + inputRow.setMaximumSize(new Dimension(Integer.MAX_VALUE, UiTheme.INPUT_HEIGHT)); + inputRow.add(arraySizeTextField); + inputRow.add(Box.createHorizontalStrut(UiTheme.SPACING_SM)); + inputRow.add(arraySizeOkButton); + inputRow.add(Box.createHorizontalGlue()); + + Color normalColor = UiTheme.TEXT_PRIMARY; arraySizeSlider.addChangeListener(e -> { if (arraySizeSlider.getValue() <= 3) { - //arraySizeSlider.setValue(3); runButton.setEnabled(false); arraySizeSlider.setValue(3); arraySizeTextField.setText("3"); + arraySizeTextField.setForeground(errorColor); } else { MainController.updateArraySize(arraySizeSlider.getValue()); arraySizeTextField.setText(String.valueOf(arraySizeSlider.getValue())); + arraySizeTextField.setForeground(normalColor); runButton.setEnabled(true); } - arraySizeOkButton.setEnabled(false); }); - arraySizeTextField.setText(String.valueOf(arraySizeSlider.getValue())); arraySizeTextField.addActionListener(e -> { - if (arraySizeTextField.getText().equals(arraySizeTextField.getText().replaceAll("[^0-9]", "")) && arraySizeTextField.getText().length() < 6) { - if (Integer.parseInt(arraySizeTextField.getText()) > maxSize) { - arraySizeSlider.setValue(maxSize); - arraySizeTextField.setText(String.valueOf(maxSize)); - } else { - arraySizeSlider.setValue(Integer.parseInt(arraySizeTextField.getText())); - } - - } + validateAndApplySize(); arraySizeOkButton.setEnabled(false); }); - arraySizeOkButton.setEnabled(false); - arraySizeOkButton.addActionListener(e -> { - if (arraySizeTextField.getText().equals(arraySizeTextField.getText().replaceAll("[^0-9]", "")) && arraySizeTextField.getText().length() < 6) { - if (Integer.parseInt(arraySizeTextField.getText()) > maxSize) { - arraySizeSlider.setValue(maxSize); - arraySizeTextField.setText(String.valueOf(maxSize)); - } else { - arraySizeSlider.setValue(Integer.parseInt(arraySizeTextField.getText())); - } - } - }); - arraySizeTextField.getDocument().addDocumentListener(new DocumentListener() { - public void changedUpdate(DocumentEvent e) { - } - - public void removeUpdate(DocumentEvent e) { - if (!arraySizeTextField.getText().equals(arraySizeTextField.getText().replaceAll("[^0-9]", ""))) { - arraySizeOkButton.setEnabled(false); - arraySizeTextField.setForeground(errorColor); - } else { + public void changedUpdate(DocumentEvent e) { updateSizeInputState(); } + public void removeUpdate(DocumentEvent e) { updateSizeInputState(); } + public void insertUpdate(DocumentEvent e) { updateSizeInputState(); } + private void updateSizeInputState() { + String text = arraySizeTextField.getText(); + if (text.equals(text.replaceAll("[^0-9]", ""))) { arraySizeOkButton.setEnabled(true); - arraySizeTextField.setForeground(normalTextFieldForegroundColor); - } - } - - public void insertUpdate(DocumentEvent e) { - if (!arraySizeTextField.getText().equals(arraySizeTextField.getText().replaceAll("[^0-9]", ""))) { + arraySizeTextField.setForeground(normalColor); + } else { arraySizeOkButton.setEnabled(false); arraySizeTextField.setForeground(errorColor); - } else { - arraySizeOkButton.setEnabled(true); - arraySizeTextField.setForeground(normalTextFieldForegroundColor); } } }); + arraySizeOkButton.addActionListener(e -> validateAndApplySize()); - //Mute button - muteCheckBox.setSelected(true); - muteCheckBox.addChangeListener(e -> MainController.sound.setIsMuted(!muteCheckBox.isSelected())); + card.add(arraySizeSlider); + card.add(Box.createVerticalStrut(UiTheme.SPACING_SM)); + card.add(inputRow); + return card; + } + + private void validateAndApplySize() { + String text = arraySizeTextField.getText(); + if (text.matches("[0-9]+") && text.length() < 6) { + int value = Integer.parseInt(text); + if (value > maxSize) { + arraySizeSlider.setValue(maxSize); + } else if (value < 3) { + arraySizeSlider.setValue(3); + } else { + arraySizeSlider.setValue(value); + } + } + } + + /** Sorting: algorithm combo + run-all row + shuffle combo, all in one card. */ + private StyledCard createSortingCard() { + StyledCard card = ComponentFactory.createCard(); + card.setLayout(new BoxLayout(card, BoxLayout.Y_AXIS)); algorithmList = new ArrayList<>(Arrays.asList( new QuickSortMiddlePivot(MainController.getArrayController()), @@ -300,164 +324,109 @@ public void insertUpdate(DocumentEvent e) { new AmericanFlagSort(MainController.getArrayController()), new PigeonholeSort(MainController.getArrayController()), new TimSort(MainController.getArrayController()), - new BogoSort(MainController.getArrayController()))); + new BogoSort(MainController.getArrayController()) + )); + algorithmListComboBox = ComponentFactory.createComboBox(); for (SortingAlgorithm algorithm : algorithmList) { algorithmListComboBox.addItem(algorithm.getName()); } - algorithmListComboBox.setSelectedIndex(0); - final int[] selectedAlgorithmIndex = {0}; + algorithmListComboBox.setAlignmentX(Component.LEFT_ALIGNMENT); + algorithmListComboBox.setMaximumSize(new Dimension(Integer.MAX_VALUE, UiTheme.INPUT_HEIGHT)); + final int[] selectedAlgorithmIndex = {0}; algorithmListComboBox.addActionListener(e -> { MainController.setAlgorithm(algorithmList.get(algorithmListComboBox.getSelectedIndex())); selectedAlgorithmIndex[0] = algorithmListComboBox.getSelectedIndex(); }); - //Run All Algorithms Checkbox + // Run-all row + JPanel runAllRow = new JPanel(); + runAllRow.setLayout(new BoxLayout(runAllRow, BoxLayout.X_AXIS)); + runAllRow.setOpaque(false); + runAllRow.setAlignmentX(Component.LEFT_ALIGNMENT); + runAllRow.setMaximumSize(new Dimension(Integer.MAX_VALUE, UiTheme.BUTTON_HEIGHT)); + + runAllCheckBox = ComponentFactory.createCheckBox("Run all"); runAllCheckBox.setSelected(false); - //buttonRunAllSettings.setVisible(true); runAllCheckBox.addActionListener(e -> { algorithmListComboBox.setEnabled(!runAllCheckBox.isSelected()); buttonRunAllSettings.setEnabled(runAllCheckBox.isSelected()); }); + buttonRunAllSettings = ComponentFactory.createSmallButton("Configure"); + buttonRunAllSettings.setEnabled(false); + buttonRunAllSettings.addActionListener(e -> showRunAllDialog(selectedAlgorithmIndex[0])); - buttonRunAllSettings.addActionListener(e -> { - DefaultListModel runAllSettings = new DefaultListModel(); - JCheckBoxList checkBoxList = new JCheckBoxList(runAllSettings); - - for (SortingAlgorithm alg : algorithmList) { - JCheckBox algCheckBox = new JCheckBox(alg.getName()); - - algCheckBox.setSelected(alg.isSelected()); - - algCheckBox.addChangeListener(e2 -> { - alg.setSelected(algCheckBox.isSelected()); - }); - - runAllSettings.addElement(algCheckBox); - } - - final int[] dragFromIndex = {-1}; - final int[] originalIndex = {-1}; - final boolean[] wasSelected = {false}; - - checkBoxList.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - dragFromIndex[0] = checkBoxList.locationToIndex(e.getPoint()); - originalIndex[0] = checkBoxList.locationToIndex(e.getPoint()); - wasSelected[0] = !runAllSettings.getElementAt(dragFromIndex[0]).isSelected(); - - } - - @Override - public void mouseReleased(MouseEvent e) { - dragFromIndex[0] = -1; // Reset after the drag operation is complete - originalIndex[0] = -1; - wasSelected[0] = false; - } - }); - - checkBoxList.addMouseMotionListener(new MouseMotionAdapter() { - @Override - public void mouseDragged(MouseEvent e) { - int currentDragIndex = checkBoxList.locationToIndex(e.getPoint()); - - if (dragFromIndex[0] != -1 && currentDragIndex != -1 && dragFromIndex[0] != currentDragIndex) { - JCheckBox draggedItem = runAllSettings.getElementAt(dragFromIndex[0]); - runAllSettings.remove(dragFromIndex[0]); - runAllSettings.add(currentDragIndex, draggedItem); - - SortingAlgorithm temp = algorithmList.get(dragFromIndex[0]); - algorithmList.remove(dragFromIndex[0]); - algorithmList.add(currentDragIndex, temp); - - dragFromIndex[0] = currentDragIndex; // Update the dragFromIndex to its new location - if (wasSelected[0] != draggedItem.isSelected()) { - draggedItem.setSelected(wasSelected[0]); - } - } - - } - }); - - JDialog runAllSettingDialog = new JDialog(); - - runAllSettingDialog.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - for (SortingAlgorithm alg : algorithmList) { - algorithmListComboBox.addItem(alg.getName()); - algorithmListComboBox.removeItemAt(0); - } - algorithmListComboBox.setSelectedIndex(selectedAlgorithmIndex[0]); - } - }); - - runAllSettingDialog.setSize(300, 500); - runAllSettingDialog.setLocation(this.getLocation().x + this.getSize().width + 5, this.getLocation().y); - runAllSettingDialog.setTitle("Run All - Settings"); - runAllSettingDialog.add(checkBoxList); - runAllSettingDialog.setResizable(false); - runAllSettingDialog.setModal(true); - runAllSettingDialog.setVisible(true); - - - - }); - - + runAllRow.add(runAllCheckBox); + runAllRow.add(Box.createHorizontalGlue()); + runAllRow.add(buttonRunAllSettings); - //Shuffle type + // Shuffle combo shuffleTypes = new ArrayList<>(Arrays.asList( - ShuffleType.RANDOM, - ShuffleType.REVERSE, - ShuffleType.ALMOST_SORTED, - ShuffleType.SORTED + ShuffleType.RANDOM, ShuffleType.REVERSE, + ShuffleType.ALMOST_SORTED, ShuffleType.SORTED )); - for (ShuffleType shuffleType : shuffleTypes) { - shuffleListBox.addItem(shuffleType.toString()); + shuffleListBox = ComponentFactory.createComboBox(); + for (ShuffleType st : shuffleTypes) { + shuffleListBox.addItem(st.toString()); } shuffleListBox.setSelectedIndex(0); - shuffleListBox.addActionListener(e -> MainController.getArrayController().setShuffleType(shuffleTypes.get(shuffleListBox.getSelectedIndex()))); - + shuffleListBox.setAlignmentX(Component.LEFT_ALIGNMENT); + shuffleListBox.setMaximumSize(new Dimension(Integer.MAX_VALUE, UiTheme.INPUT_HEIGHT)); + shuffleListBox.addActionListener(e -> + MainController.getArrayController().setShuffleType(shuffleTypes.get(shuffleListBox.getSelectedIndex())) + ); + + card.add(algorithmListComboBox); + card.add(Box.createVerticalStrut(UiTheme.SPACING_SM)); + card.add(runAllRow); + card.add(Box.createVerticalStrut(UiTheme.SPACING_SM)); + card.add(shuffleListBox); + return card; + } - //Run button - runButton.addActionListener(e -> { + /** Speed slider with emoji labels. */ + private StyledCard createSpeedCard() { + StyledCard card = ComponentFactory.createCard(); + card.setLayout(new BoxLayout(card, BoxLayout.Y_AXIS)); - if (runAllCheckBox.isSelected()) { - MainController.setAlgorithms(algorithmList); - } else { - MainController.setAlgorithm(algorithmList.get(algorithmListComboBox.getSelectedIndex())); - } + final int[] DELAY_TIME = {50, 10, 1, 1, 1}; + final double[] DELAY_FACTOR = {1.0, 1.0, 1.0, 0.12, 0.02}; - MainController.setStart(true); - cancelButton.setEnabled(true); - }); + speedSlider = ComponentFactory.createSlider(1, 5, 3); + speedSlider.setSnapToTicks(true); + speedSlider.setMajorTickSpacing(1); + speedSlider.setToolTipText("Select animation speed level"); + speedSlider.setAlignmentX(Component.LEFT_ALIGNMENT); + speedSlider.setPreferredSize(new Dimension(400, 55)); + speedSlider.setMaximumSize(new Dimension(Integer.MAX_VALUE, 55)); - //Show measurements box - showMeasurementsCheckBox.setSelected(true); - showMeasurementsCheckBox.addActionListener(e -> { - MainController.setPrintMeasurements(showMeasurementsCheckBox.isSelected()); - }); + java.util.Hashtable speedLabels = new java.util.Hashtable<>(); + speedLabels.put(1, new JLabel("Very Slow")); + speedLabels.put(2, new JLabel("Slow")); + speedLabels.put(3, new JLabel("Normal")); + speedLabels.put(4, new JLabel("Fast")); + speedLabels.put(5, new JLabel("Max")); + speedSlider.setLabelTable(speedLabels); - //Show results Box - comparisonTableCheckBox.addActionListener(e -> { - MainController.setShowComparisonTable(comparisonTableCheckBox.isSelected()); - if (!MainController.isRunning() && cancelButton.isEnabled()) cancelButton.setEnabled(false); + speedSlider.addChangeListener(e -> { + int level = speedSlider.getValue() - 1; + MainController.setDelayTime(DELAY_TIME[level]); + MainController.setDelayFactor(DELAY_FACTOR[level]); }); + card.add(speedSlider); + return card; + } - //Progress bar - progressBarArray.setMinimum(0); - progressBarArray.setMaximum(100); - progressBarArray.setValue(100); - + /** Visualization type picker + conditional image-file button. */ + private StyledCard createVisualizationCard() { + StyledCard card = ComponentFactory.createCard(); + card.setLayout(new BoxLayout(card, BoxLayout.Y_AXIS)); - //Visual selection visualizationList = new ArrayList<>(Arrays.asList( new Bars(MainController.getArrayController(), MainController.getColorGradient(), MainController.getSound(), (RenderContext) MainController.processing), new ScatterPlot(MainController.getArrayController(), MainController.getColorGradient(), MainController.getSound(), (RenderContext) MainController.processing), @@ -488,72 +457,305 @@ public void windowClosing(WindowEvent e) { new Pyramid(MainController.getArrayController(), MainController.getColorGradient(), MainController.getSound(), (RenderContext) MainController.processing), new Plane(MainController.getArrayController(), MainController.getColorGradient(), MainController.getSound(), (RenderContext) MainController.processing), new DisparityPlane(MainController.getArrayController(), MainController.getColorGradient(), MainController.getSound(), (RenderContext) MainController.processing), - new MosaicSquares(MainController.getArrayController(), MainController.getColorGradient(), MainController.getSound(), (RenderContext) MainController.processing))); - + new MosaicSquares(MainController.getArrayController(), MainController.getColorGradient(), MainController.getSound(), (RenderContext) MainController.processing) + )); + visualizationListComboBox = ComponentFactory.createComboBox(); for (Visualization visualization : visualizationList) { visualizationListComboBox.addItem(visualization.getName()); } - - + visualizationListComboBox.setAlignmentX(Component.LEFT_ALIGNMENT); + visualizationListComboBox.setMaximumSize(new Dimension(Integer.MAX_VALUE, UiTheme.INPUT_HEIGHT)); visualizationListComboBox.addActionListener(e -> { int index = visualizationListComboBox.getSelectedIndex(); - Visualization visualization = visualizationList.get(index); - MainController.setVisualization(visualizationList.get(index)); + MainController.setVisualization(visualization); + boolean isImage = visualization instanceof ImageHorizontal || visualization instanceof ImageVertical; + buttonSetImg.setVisible(isImage); + buttonSetImg.setEnabled(isImage); + }); - if(visualization instanceof ImageHorizontal || visualization instanceof ImageVertical) { - buttonSetImg.setVisible(true); - buttonSetImg.setEnabled(true); - } else { - buttonSetImg.setVisible(false); - buttonSetImg.setEnabled(false); + buttonSetImg = ComponentFactory.createSmallButton("Select Image"); + buttonSetImg.setVisible(false); + buttonSetImg.setAlignmentX(Component.LEFT_ALIGNMENT); + buttonSetImg.addActionListener(e -> selectImageFile()); + + card.add(visualizationListComboBox); + card.add(Box.createVerticalStrut(UiTheme.SPACING_SM)); + card.add(buttonSetImg); + return card; + } + + /** Gradient picker + two clickable color swatches for custom colors. */ + private StyledCard createGradientCard() { + StyledCard card = ComponentFactory.createCard(); + card.setLayout(new BoxLayout(card, BoxLayout.Y_AXIS)); + + gradientList = new ArrayList<>(Arrays.asList( + new ColorGradient(new Color(200, 0, 0), new Color(200, 0, 0), Color.WHITE, "Red"), + new ColorGradient(new Color(0, 200, 0), new Color(0, 200, 0), Color.WHITE, "Green"), + new ColorGradient(new Color(0, 0, 200), new Color(0, 0, 200), Color.WHITE, "Blue"), + new ColorGradient(Color.WHITE, Color.WHITE, Color.RED, "White"), + new ColorGradient(Color.WHITE, Color.BLACK, Color.WHITE, "White -> Black"), + new ColorGradient(Color.RED, Color.BLACK, Color.WHITE, "Red -> Black"), + new ColorGradient(Color.BLUE, Color.RED, Color.WHITE, "Blue -> Red"), + new ColorGradient(Color.BLACK, Color.WHITE, Color.WHITE, "Black -> White"), + new ColorGradient(Color.BLACK, Color.RED, Color.WHITE, "Black -> Red"), + new MultiGradient(Color.WHITE, "Rainbow"), + new ColorGradient(Color.PINK, Color.BLACK, Color.WHITE, "Custom Gradient") + )); + + gradientListComboBox = ComponentFactory.createComboBox(); + for (ColorGradient gradient : gradientList) { + gradientListComboBox.addItem(gradient.getName()); + } + gradientListComboBox.setSelectedIndex(5); + gradientListComboBox.setAlignmentX(Component.LEFT_ALIGNMENT); + gradientListComboBox.setMaximumSize(new Dimension(Integer.MAX_VALUE, UiTheme.INPUT_HEIGHT)); + + Color color1 = MainController.getColorGradient().getMarkerColor(0, Marker.NORMAL); + colorChoose1 = ComponentFactory.createColorSwatch(color1); + + Color color2 = MainController.getColorGradient().getMarkerColor(MainController.getSize() - 1, Marker.NORMAL); + colorChoose2 = ComponentFactory.createColorSwatch(color2); + + JPanel swatchRow = new JPanel(); + swatchRow.setLayout(new BoxLayout(swatchRow, BoxLayout.X_AXIS)); + swatchRow.setOpaque(false); + swatchRow.setAlignmentX(Component.LEFT_ALIGNMENT); + swatchRow.add(colorChoose1); + swatchRow.add(Box.createHorizontalStrut(UiTheme.SPACING_SM)); + swatchRow.add(colorChoose2); + swatchRow.add(Box.createHorizontalGlue()); + + gradientListComboBox.addActionListener(e -> { + ColorGradient selected = gradientList.get(gradientListComboBox.getSelectedIndex()); + selected.updateGradient(MainController.getSize()); + MainController.setColorGradient(selected); + colorChoose1.setBackground(MainController.getColorGradient().getMarkerColor(0, Marker.NORMAL)); + colorChoose2.setBackground(MainController.getColorGradient().getMarkerColor(MainController.getSize() - 1, Marker.NORMAL)); + }); + + MouseListener ml = new java.awt.event.MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + JPanel jPanel = (JPanel) e.getSource(); + Color initColor = jPanel.getBackground(); + Color selectedColor = JColorChooser.showDialog(null, "Select Color", jPanel.getBackground()); + if (selectedColor != null && !initColor.equals(selectedColor)) { + jPanel.setBackground(selectedColor); + if (jPanel.getName().equals("colorChoose1")) { + gradientList.get(gradientList.size() - 1).setColor1(selectedColor); + gradientList.get(gradientList.size() - 1).setColor2(colorChoose2.getBackground()); + } else { + gradientList.get(gradientList.size() - 1).setColor2(selectedColor); + gradientList.get(gradientList.size() - 1).setColor1(colorChoose1.getBackground()); + } + gradientListComboBox.setSelectedIndex(gradientList.size() - 1); + } } + }; + colorChoose1.addMouseListener(ml); + colorChoose1.setName("colorChoose1"); + colorChoose2.addMouseListener(ml); + colorChoose2.setName("colorChoose2"); + + JLabel swatchHint = new JLabel("Click swatch to customize"); + swatchHint.setFont(UiTheme.FONT_SMALL); + swatchHint.setForeground(UiTheme.TEXT_SECONDARY); + swatchHint.setAlignmentX(Component.LEFT_ALIGNMENT); + + card.add(gradientListComboBox); + card.add(Box.createVerticalStrut(UiTheme.SPACING_SM)); + card.add(swatchRow); + card.add(Box.createVerticalStrut(UiTheme.SPACING_XS)); + card.add(swatchHint); + return card; + } + + /** Display options: show measurements + comparison table toggles. */ + private StyledCard createDisplayCard() { + StyledCard card = ComponentFactory.createCard(); + card.setLayout(new BoxLayout(card, BoxLayout.Y_AXIS)); + + showMeasurementsCheckBox = ComponentFactory.createCheckBox("Show measurements"); + showMeasurementsCheckBox.setSelected(true); + showMeasurementsCheckBox.addActionListener(e -> + MainController.setPrintMeasurements(showMeasurementsCheckBox.isSelected())); + showMeasurementsCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); + + comparisonTableCheckBox = ComponentFactory.createCheckBox("Show comparison table"); + comparisonTableCheckBox.addActionListener(e -> { + MainController.setShowComparisonTable(comparisonTableCheckBox.isSelected()); + if (!MainController.isRunning() && cancelButton.isEnabled()) cancelButton.setEnabled(false); }); + comparisonTableCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); + card.add(showMeasurementsCheckBox); + card.add(Box.createVerticalStrut(UiTheme.SPACING_SM)); + card.add(comparisonTableCheckBox); + return card; + } - buttonSetImg.setVisible(false); - buttonSetImg.addActionListener(e -> { - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setDialogTitle("Select an image"); - fileChooser.setAcceptAllFileFilterUsed(false); - FileNameExtensionFilter filter = new FileNameExtensionFilter("PNG and JPG images", "png", "jpg"); - fileChooser.addChoosableFileFilter(filter); - int fileChooserReturnValue = fileChooser.showDialog(null, "Select image"); - if (fileChooserReturnValue == JFileChooser.APPROVE_OPTION) { - File selectedFile = fileChooser.getSelectedFile(); - String imagePath = selectedFile.getAbsolutePath(); - - int index = visualizationListComboBox.getSelectedIndex(); - ImageVertical visualizationVertical = (ImageVertical) visualizationList.get(16); - ImageHorizontal visualizationHorizontal = (ImageHorizontal) visualizationList.get(17); - ImageHorizontal imageHorizontal = (ImageHorizontal) visualizationHorizontal; - imageHorizontal.setImg(imagePath); - ImageVertical imageVertical = (ImageVertical) visualizationVertical; - imageVertical.setImg(imagePath); - - if (Objects.equals(visualizationList.get(index).getName(), "Image - Vertical Sorting")) { - MainController.setVisualization(imageVertical); - } else { - MainController.setVisualization(imageHorizontal); - } + /** Sound enable toggle. */ + private StyledCard createSoundCard() { + StyledCard card = ComponentFactory.createCard(); + card.setLayout(new BoxLayout(card, BoxLayout.Y_AXIS)); - } + muteCheckBox = ComponentFactory.createCheckBox("Enable sound effects"); + muteCheckBox.setSelected(true); + muteCheckBox.addChangeListener(e -> MainController.sound.setIsMuted(!muteCheckBox.isSelected())); + muteCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); + card.add(muteCheckBox); + return card; + } + + /** Bottom bar: [Cancel] [RUN] buttons + thin progress strip. */ + private JPanel createActionPanel() { + JPanel panel = new JPanel(new BorderLayout()); + panel.setBackground(UiTheme.BG_PRIMARY); + panel.setBorder(BorderFactory.createEmptyBorder( + UiTheme.SPACING_MD, 0, UiTheme.SPACING_LG, 0)); + + runButton = ComponentFactory.createPrimaryButton("RUN"); + runButton.addActionListener(e -> { + if (runAllCheckBox.isSelected()) { + MainController.setAlgorithms(algorithmList); + } else { + MainController.setAlgorithm(algorithmList.get(algorithmListComboBox.getSelectedIndex())); + } + MainController.setStart(true); + cancelButton.setEnabled(true); }); - //Cancel button + cancelButton = ComponentFactory.createSecondaryButton("Cancel"); cancelButton.setEnabled(false); cancelButton.addActionListener(e -> { SortingAlgorithm.setRun(false); cancelButton.setEnabled(false); }); - //Error dialogs: -// JOptionPane.showMessageDialog(frame, "Eggs are not supposed to be green."); - setVisible(true); + JPanel buttonsRow = new JPanel(); + buttonsRow.setLayout(new BoxLayout(buttonsRow, BoxLayout.X_AXIS)); + buttonsRow.setOpaque(false); + buttonsRow.add(Box.createHorizontalGlue()); + buttonsRow.add(cancelButton); + buttonsRow.add(Box.createHorizontalStrut(UiTheme.SPACING_SM)); + buttonsRow.add(runButton); + + progressBarArray = ComponentFactory.createProgressBar(); + progressBarArray.setValue(100); + + panel.add(buttonsRow, BorderLayout.CENTER); + panel.add(progressBarArray, BorderLayout.SOUTH); + return panel; + } + + /** + * Show run all algorithms configuration dialog + */ + private void showRunAllDialog(int selectedIndex) { + DefaultListModel runAllSettings = new DefaultListModel<>(); + JCheckBoxList checkBoxList = new JCheckBoxList(runAllSettings); + + for (SortingAlgorithm alg : algorithmList) { + JCheckBox algCheckBox = new JCheckBox(alg.getName()); + algCheckBox.setSelected(alg.isSelected()); + algCheckBox.addChangeListener(e -> alg.setSelected(algCheckBox.isSelected())); + runAllSettings.addElement(algCheckBox); + } + + final int[] dragFromIndex = {-1}; + final boolean[] wasSelected = {false}; + + checkBoxList.addMouseListener(new java.awt.event.MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + dragFromIndex[0] = checkBoxList.locationToIndex(e.getPoint()); + wasSelected[0] = !runAllSettings.getElementAt(dragFromIndex[0]).isSelected(); + } + + @Override + public void mouseReleased(MouseEvent e) { + dragFromIndex[0] = -1; + wasSelected[0] = false; + } + }); + + checkBoxList.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { + @Override + public void mouseDragged(MouseEvent e) { + int currentDragIndex = checkBoxList.locationToIndex(e.getPoint()); + + if (dragFromIndex[0] != -1 && currentDragIndex != -1 && dragFromIndex[0] != currentDragIndex) { + JCheckBox draggedItem = runAllSettings.getElementAt(dragFromIndex[0]); + runAllSettings.remove(dragFromIndex[0]); + runAllSettings.add(currentDragIndex, draggedItem); + + SortingAlgorithm temp = algorithmList.get(dragFromIndex[0]); + algorithmList.remove(dragFromIndex[0]); + algorithmList.add(currentDragIndex, temp); + + dragFromIndex[0] = currentDragIndex; + if (wasSelected[0] != draggedItem.isSelected()) { + draggedItem.setSelected(wasSelected[0]); + } + } + } + }); + + JDialog runAllSettingDialog = new JDialog(); + runAllSettingDialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + for (SortingAlgorithm alg : algorithmList) { + algorithmListComboBox.addItem(alg.getName()); + algorithmListComboBox.removeItemAt(0); + } + algorithmListComboBox.setSelectedIndex(selectedIndex); + } + }); + + runAllSettingDialog.setSize(350, 500); + runAllSettingDialog.setLocationRelativeTo(this); + runAllSettingDialog.setTitle("Configure Algorithm Execution Order"); + runAllSettingDialog.add(new JScrollPane(checkBoxList)); + runAllSettingDialog.setResizable(false); + runAllSettingDialog.setModal(true); + runAllSettingDialog.setVisible(true); } + /** + * Open file chooser for image selection + */ + private void selectImageFile() { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setDialogTitle("Select an image for visualization"); + fileChooser.setAcceptAllFileFilterUsed(false); + FileNameExtensionFilter filter = new FileNameExtensionFilter("PNG and JPG images", "png", "jpg"); + fileChooser.addChoosableFileFilter(filter); + int retval = fileChooser.showDialog(null, "Select image"); + if (retval == JFileChooser.APPROVE_OPTION) { + File selectedFile = fileChooser.getSelectedFile(); + String imagePath = selectedFile.getAbsolutePath(); + + int index = visualizationListComboBox.getSelectedIndex(); + ImageVertical imageVertical = (ImageVertical) visualizationList.get(16); + ImageHorizontal imageHorizontal = (ImageHorizontal) visualizationList.get(17); + imageHorizontal.setImg(imagePath); + imageVertical.setImg(imagePath); + + if (Objects.equals(visualizationList.get(index).getName(), "Image - Vertical Sorting")) { + MainController.setVisualization(imageVertical); + } else { + MainController.setVisualization(imageHorizontal); + } + } + } + + // Public interface methods + public void setEnableInputs(boolean enabled) { arraySizeSlider.setEnabled(enabled); algorithmListComboBox.setEnabled(enabled); @@ -574,212 +776,4 @@ public void setEnableCancelButton(boolean enabled) { public void setProgressBar(int progress) { progressBarArray.setValue(progress); } - - { -// GUI initializer generated by IntelliJ IDEA GUI Designer -// >>> IMPORTANT!! <<< -// DO NOT EDIT OR ADD ANY CODE HERE! - $$$setupUI$$$(); - } - - /** - * Method generated by IntelliJ IDEA GUI Designer - * >>> IMPORTANT!! <<< - * DO NOT edit this method OR call it in your code! - * - * @noinspection ALL - */ - private void $$$setupUI$$$() { - settingsPanel = new JPanel(); - settingsPanel.setLayout(new GridLayoutManager(20, 6, new Insets(0, 0, 0, 0), -1, -1)); - settingsPanel.setName("settingsPanel"); - settingsPanel.setOpaque(false); - gradientListLabel = new JLabel(); - gradientListLabel.setText("Color gradient"); - settingsPanel.add(gradientListLabel, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(194, 16), null, 0, false)); - arrayTitleLabel = new JLabel(); - Font arrayTitleLabelFont = this.$$$getFont$$$(null, Font.BOLD, 16, arrayTitleLabel.getFont()); - if (arrayTitleLabelFont != null) arrayTitleLabel.setFont(arrayTitleLabelFont); - arrayTitleLabel.setText("Array"); - settingsPanel.add(arrayTitleLabel, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(194, 22), null, 0, false)); - algorithmListComboBox = new JComboBox<>(); - algorithmListComboBox.setMaximumRowCount(20); - settingsPanel.add(algorithmListComboBox, new GridConstraints(5, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(115, 30), null, 0, false)); - gradientListComboBox = new JComboBox<>(); - gradientListComboBox.setMaximumRowCount(20); - gradientListComboBox.setName(""); - settingsPanel.add(gradientListComboBox, new GridConstraints(10, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(115, 30), null, 0, false)); - algorithmListLabel = new JLabel(); - algorithmListLabel.setText("Sorting algorithm"); - settingsPanel.add(algorithmListLabel, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(194, 16), null, 0, false)); - shuffleListLabel = new JLabel(); - shuffleListLabel.setText("Shuffle type"); - settingsPanel.add(shuffleListLabel, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(194, 16), null, 0, false)); - shuffleListBox = new JComboBox<>(); - shuffleListBox.setMaximumRowCount(20); - settingsPanel.add(shuffleListBox, new GridConstraints(6, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(115, 30), null, 0, false)); - final Spacer spacer1 = new Spacer(); - settingsPanel.add(spacer1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, new Dimension(20, 11), null, 0, false)); - progressBarArray = new JProgressBar(); - settingsPanel.add(progressBarArray, new GridConstraints(19, 0, 1, 6, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - muteCheckBoxLabel = new JLabel(); - muteCheckBoxLabel.setText("Play sound"); - settingsPanel.add(muteCheckBoxLabel, new GridConstraints(15, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(194, 16), null, 0, false)); - muteCheckBox = new JCheckBox(); - muteCheckBox.setText(""); - settingsPanel.add(muteCheckBox, new GridConstraints(15, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(132, 18), null, 0, false)); - soundTitleLabel = new JLabel(); - Font soundTitleLabelFont = this.$$$getFont$$$(null, Font.BOLD, 16, soundTitleLabel.getFont()); - if (soundTitleLabelFont != null) soundTitleLabel.setFont(soundTitleLabelFont); - soundTitleLabel.setText("Sound"); - settingsPanel.add(soundTitleLabel, new GridConstraints(14, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(194, 22), null, 0, false)); - comparisonTableCheckBox = new JCheckBox(); - comparisonTableCheckBox.setText(""); - settingsPanel.add(comparisonTableCheckBox, new GridConstraints(11, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(132, 18), null, 0, false)); - comparisonTableCheckBoxLabel = new JLabel(); - comparisonTableCheckBoxLabel.setText("Show comparison table"); - settingsPanel.add(comparisonTableCheckBoxLabel, new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(194, 16), null, 0, false)); - final Spacer spacer2 = new Spacer(); - settingsPanel.add(spacer2, new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(194, 14), null, 0, false)); - runButton = new JButton(); - runButton.setText("run"); - settingsPanel.add(runButton, new GridConstraints(17, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(180, 30), null, 0, false)); - cancelButton = new JButton(); - cancelButton.setText("cancel"); - settingsPanel.add(cancelButton, new GridConstraints(17, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(132, 30), null, 0, false)); - final Spacer spacer3 = new Spacer(); - settingsPanel.add(spacer3, new GridConstraints(16, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(194, 14), null, 0, false)); - visualTitleLabel = new JLabel(); - Font visualTitleLabelFont = this.$$$getFont$$$(null, Font.BOLD, 16, visualTitleLabel.getFont()); - if (visualTitleLabelFont != null) visualTitleLabel.setFont(visualTitleLabelFont); - visualTitleLabel.setText("Visual"); - settingsPanel.add(visualTitleLabel, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(194, 22), null, 0, false)); - sortingTitleLabel = new JLabel(); - Font sortingTitleLabelFont = this.$$$getFont$$$(null, Font.BOLD, 16, sortingTitleLabel.getFont()); - if (sortingTitleLabelFont != null) sortingTitleLabel.setFont(sortingTitleLabelFont); - sortingTitleLabel.setText("Sorting"); - settingsPanel.add(sortingTitleLabel, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(194, 22), null, 0, false)); - final Spacer spacer4 = new Spacer(); - settingsPanel.add(spacer4, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(194, 14), null, 0, false)); - visualizationListComboBoxLabel = new JLabel(); - visualizationListComboBoxLabel.setText("Visualization"); - settingsPanel.add(visualizationListComboBoxLabel, new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(194, 16), null, 0, false)); - visualizationListComboBox = new JComboBox<>(); - visualizationListComboBox.setMaximumRowCount(20); - settingsPanel.add(visualizationListComboBox, new GridConstraints(9, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(115, 30), null, 0, false)); - final Spacer spacer5 = new Spacer(); - settingsPanel.add(spacer5, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, new Dimension(20, 11), null, 0, false)); - arraySizeSlider = new JSlider(); - arraySizeSlider.setInverted(false); - arraySizeSlider.setName(""); - arraySizeSlider.setOrientation(0); - arraySizeSlider.setPaintLabels(true); - arraySizeSlider.setPaintTicks(true); - arraySizeSlider.setSnapToTicks(false); - arraySizeSlider.setToolTipText(""); - arraySizeSlider.setValueIsAdjusting(false); - arraySizeSlider.putClientProperty("JSlider.isFilled", Boolean.FALSE); - arraySizeSlider.putClientProperty("Slider.paintThumbArrowShape", Boolean.FALSE); - settingsPanel.add(arraySizeSlider, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(180, 31), null, 0, false)); - arraySizeTextField = new JTextField(); - settingsPanel.add(arraySizeTextField, new GridConstraints(2, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(115, 30), null, 0, false)); - showMeasurementsLabel = new JLabel(); - showMeasurementsLabel.setText("Show measurements"); - settingsPanel.add(showMeasurementsLabel, new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(194, 16), null, 0, false)); - showMeasurementsCheckBox = new JCheckBox(); - showMeasurementsCheckBox.setText(""); - settingsPanel.add(showMeasurementsCheckBox, new GridConstraints(12, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(132, 18), null, 0, false)); - final Spacer spacer6 = new Spacer(); - settingsPanel.add(spacer6, new GridConstraints(1, 5, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, new Dimension(20, 11), null, 0, false)); - arraySizeOkButton = new JButton(); - arraySizeOkButton.setText("ok"); - settingsPanel.add(arraySizeOkButton, new GridConstraints(2, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(137, 30), new Dimension(50, -1), 0, false)); - final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - settingsPanel.add(panel1, new GridConstraints(10, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, 1, 1, null, new Dimension(80, 30), null, 0, false)); - colorChoose1 = new JPanel(); - colorChoose1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); - colorChoose1.setBackground(new Color(-47032)); - colorChoose1.setName("colorChoose1"); - panel1.add(colorChoose1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 10), null, 0, false)); - colorChoose2 = new JPanel(); - colorChoose2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); - colorChoose2.setBackground(new Color(-47032)); - colorChoose2.setDoubleBuffered(false); - colorChoose2.setName("colorChoose2"); - panel1.add(colorChoose2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 10), null, 0, false)); - final Spacer spacer7 = new Spacer(); - settingsPanel.add(spacer7, new GridConstraints(18, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(194, 14), null, 0, false)); - final Spacer spacer8 = new Spacer(); - settingsPanel.add(spacer8, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(194, 14), null, 0, false)); - final Spacer spacer9 = new Spacer(); - settingsPanel.add(spacer9, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(194, 14), null, 0, false)); - final JPanel panel2 = new JPanel(); - panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel2.setEnabled(true); - settingsPanel.add(panel2, new GridConstraints(5, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, 1, 1, null, new Dimension(80, 30), null, 0, false)); - runAllCheckBox = new JCheckBox(); - runAllCheckBox.setAlignmentX(0.5f); - runAllCheckBox.setDoubleBuffered(true); - runAllCheckBox.setText("All"); - panel2.add(runAllCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(40, 30), null, 0, false)); - buttonRunAllSettings = new JButton(); - buttonRunAllSettings.setAlignmentX(0.0f); - buttonRunAllSettings.setDoubleBuffered(false); - buttonRunAllSettings.setEnabled(false); - buttonRunAllSettings.setHorizontalAlignment(0); - buttonRunAllSettings.setHorizontalTextPosition(2); - buttonRunAllSettings.setIconTextGap(0); - buttonRunAllSettings.setText("Settings"); - buttonRunAllSettings.setToolTipText(""); - buttonRunAllSettings.setVerticalTextPosition(0); - buttonRunAllSettings.setVisible(true); - panel2.add(buttonRunAllSettings, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(30, 30), null, 0, false)); - buttonSetImg = new JButton(); - buttonSetImg.setAlignmentX(0.0f); - buttonSetImg.setDoubleBuffered(false); - buttonSetImg.setEnabled(false); - buttonSetImg.setHorizontalAlignment(0); - buttonSetImg.setHorizontalTextPosition(2); - buttonSetImg.setIconTextGap(0); - buttonSetImg.setText("Select Image"); - buttonSetImg.setToolTipText(""); - buttonSetImg.setVerticalTextPosition(0); - buttonSetImg.setVisible(true); - settingsPanel.add(buttonSetImg, new GridConstraints(9, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(30, 30), null, 0, false)); - } - - /** - * @noinspection ALL - */ - private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) { - if (currentFont == null) return null; - String resultName; - if (fontName == null) { - resultName = currentFont.getName(); - } else { - Font testFont = new Font(fontName, Font.PLAIN, 10); - if (testFont.canDisplay('a') && testFont.canDisplay('1')) { - resultName = fontName; - } else { - resultName = currentFont.getName(); - } - } - Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize()); - boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac"); - Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize()); - return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback); - } - - /** - * @noinspection ALL - */ - public JComponent $$$getRootComponent$$$() { - return settingsPanel; - } - - @SuppressWarnings("unused") - private void createUIComponents() { - } } - diff --git a/src/main/java/io/github/compilerstuck/Control/StyledCard.java b/src/main/java/io/github/compilerstuck/Control/StyledCard.java new file mode 100644 index 0000000..e272c35 --- /dev/null +++ b/src/main/java/io/github/compilerstuck/Control/StyledCard.java @@ -0,0 +1,79 @@ +package io.github.compilerstuck.Control; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * Styled card component with rounded corners, shadow effect, and consistent padding. + * Hover effects for modern feel with smooth transitions. + */ +public class StyledCard extends JPanel { + private boolean isHovered = false; + + private int cornerRadius = UiTheme.BORDER_RADIUS; + private int padding = UiTheme.SPACING_MD; + private Color borderColor = UiTheme.BORDER_COLOR; + + public StyledCard() { + this(new BorderLayout()); + } + + public StyledCard(LayoutManager layout) { + super(layout); + initialize(); + } + + private void initialize() { + setBackground(UiTheme.BG_SECONDARY); // white + setBorder(BorderFactory.createEmptyBorder(padding, padding, padding, padding)); + setOpaque(false); // we paint our own background + // Hover effect + addMouseListener(new MouseAdapter() { + @Override public void mouseEntered(MouseEvent e) { + isHovered = true; + repaint(); + } + @Override public void mouseExited(MouseEvent e) { + isHovered = false; + repaint(); + } + }); } + + @Override + protected void paintComponent(Graphics g) { + Graphics2D g2 = (Graphics2D) g.create(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + int w = getWidth(); + int h = getHeight(); + int shadowOffset = isHovered ? 3 : 2; // lift on hover + int shadowAlpha1 = isHovered ? 18 : 10; // deeper shadow on hover + int shadowAlpha2 = isHovered ? 12 : 6; + + // Layered soft shadow (more prominent on hover) + g2.setColor(new Color(0, 0, 0, shadowAlpha1)); + g2.fillRoundRect(0, shadowOffset, w, h, cornerRadius, cornerRadius); + g2.setColor(new Color(0, 0, 0, shadowAlpha2)); + g2.fillRoundRect(0, shadowOffset + 1, w, h, cornerRadius, cornerRadius); + + // White card background + g2.setColor(getBackground()); + g2.fillRoundRect(0, 0, w, h, cornerRadius, cornerRadius); + + // Border color shifts subtly on hover + Color border = isHovered ? new Color(219, 219, 227) : borderColor; // slightly darker on hover + g2.setColor(border); + g2.setStroke(new BasicStroke(UiTheme.BORDER_WIDTH)); + g2.drawRoundRect(0, 0, w - 1, h - 1, cornerRadius, cornerRadius); + + g2.dispose(); + super.paintComponent(g); + } + + public void setCornerRadius(int radius) { + this.cornerRadius = radius; + repaint(); + } +} diff --git a/src/main/java/io/github/compilerstuck/Control/UiTheme.java b/src/main/java/io/github/compilerstuck/Control/UiTheme.java new file mode 100644 index 0000000..3ac01d3 --- /dev/null +++ b/src/main/java/io/github/compilerstuck/Control/UiTheme.java @@ -0,0 +1,93 @@ +package io.github.compilerstuck.Control; + +import java.awt.*; + +/** + * UI theme constants for the application. + * 2025 design system: Tailwind CSS Zinc neutrals + Indigo accent. + * Inspired by Shadcn UI / Vercel / Linear visual language. + */ +public class UiTheme { + + // ── Backgrounds (Zinc scale) ────────────────────────────────────────────── + public static final Color BG_PRIMARY = new Color(250, 250, 250); // zinc-50 + public static final Color BG_SECONDARY = new Color(255, 255, 255); // white – cards + public static final Color BG_INPUT = new Color(244, 244, 245); // zinc-100 – input bg + public static final Color BG_HOVER = new Color(244, 244, 245); // zinc-100 + + // Legacy alias kept for any remaining callers + public static final Color BG_TERTIARY = BG_HOVER; + + // ── Borders ─────────────────────────────────────────────────────────────── + public static final Color BORDER_COLOR = new Color(228, 228, 231); // zinc-200 + public static final Color BORDER_FOCUS = new Color(99, 102, 241); // indigo-500 + + // ── Text (Zinc scale) ───────────────────────────────────────────────────── + public static final Color TEXT_PRIMARY = new Color(24, 24, 27); // zinc-900 + public static final Color TEXT_SECONDARY = new Color(113, 113, 122); // zinc-500 + public static final Color TEXT_TERTIARY = new Color(161, 161, 170); // zinc-400 + public static final Color TEXT_MUTED = TEXT_TERTIARY; + + // ── Accent: Indigo ──────────────────────────────────────────────────────── + public static final Color ACCENT_PRIMARY = new Color(99, 102, 241); // indigo-500 + public static final Color ACCENT_HOVER = new Color(79, 70, 229); // indigo-600 + public static final Color ACCENT_LIGHT = new Color(238, 242, 255); // indigo-50 + + // ── Semantic ────────────────────────────────────────────────────────────── + public static final Color ACCENT_SUCCESS = new Color(34, 197, 94); // green-500 + public static final Color ACCENT_WARNING = new Color(245, 158, 11); // amber-500 + public static final Color ACCENT_ERROR = new Color(239, 68, 68); // red-500 + public static final Color ACCENT_INFO = ACCENT_PRIMARY; + + // ── Buttons ─────────────────────────────────────────────────────────────── + // Primary: dark (Vercel / Linear style — near-black pill button) + public static final Color BUTTON_PRIMARY = new Color(24, 24, 27); // zinc-900 + public static final Color BUTTON_PRIMARY_HOVER = new Color(39, 39, 42); // zinc-800 + public static final Color BUTTON_PRIMARY_FG = new Color(250, 250, 250); // zinc-50 + + // Secondary: outlined white + public static final Color BUTTON_SECONDARY = Color.WHITE; + public static final Color BUTTON_SECONDARY_HOVER = new Color(244, 244, 245); // zinc-100 + + // ── Typography (system font stack) ──────────────────────────────────────── + private static final String[] FONT_CANDIDATES = { + "Segoe UI", "Ubuntu", "Liberation Sans", "Cantarell", Font.SANS_SERIF + }; + public static final String FONT_FAMILY; + static { + String chosen = Font.SANS_SERIF; + for (String name : FONT_CANDIDATES) { + Font probe = new Font(name, Font.PLAIN, 12); + if (!probe.getFamily().equals("Dialog")) { + chosen = name; + break; + } + } + FONT_FAMILY = chosen; + } + + public static final Font FONT_TITLE = new Font(FONT_FAMILY, Font.BOLD, 16); + /** Small, uppercase section header */ + public static final Font FONT_SECTION = new Font(FONT_FAMILY, Font.BOLD, 10); + public static final Font FONT_SUBTITLE = new Font(FONT_FAMILY, Font.BOLD, 13); + public static final Font FONT_LABEL = new Font(FONT_FAMILY, Font.PLAIN, 13); + public static final Font FONT_BODY = new Font(FONT_FAMILY, Font.PLAIN, 12); + public static final Font FONT_SMALL = new Font(FONT_FAMILY, Font.PLAIN, 11); + + // ── Spacing (8-pt grid) ─────────────────────────────────────────────────── + public static final int SPACING_XS = 4; + public static final int SPACING_SM = 8; + public static final int SPACING_MD = 12; + public static final int SPACING_LG = 16; + public static final int SPACING_XL = 24; + + // ── Component sizes ─────────────────────────────────────────────────────── + public static final int BUTTON_HEIGHT = 36; + public static final int BUTTON_HEIGHT_SMALL = 28; + public static final int INPUT_HEIGHT = 34; + public static final int COLOR_SWATCH_SIZE = 36; + + // ── Card styling ────────────────────────────────────────────────────────── + public static final int BORDER_RADIUS = 8; + public static final int BORDER_WIDTH = 1; +} From 3c60a204f7bcac4355ff7b9b7de9934b56e3a4c8 Mon Sep 17 00:00:00 2001 From: 66-m <53166536+66-m@users.noreply.github.com> Date: Thu, 12 Mar 2026 12:59:34 +0100 Subject: [PATCH 2/2] refactor(control): organize package into logical subpackages Reorganize the Control package into focused subpackages by concern: - ui/ - UI components, theming, settings (ComponentFactory, StyledCard, UiTheme, Settings) - model/ - Data models and state management (ArrayModel, ArrayController, SortingStateManager, SortingSessionManager) - config/ - Configuration and strategies (MainControllerConfig, DelayStrategy, ShuffleStrategy, ShuffleType) - render/ - Rendering contexts (RenderContext, HeadlessRenderContext, ProcessingContext) - shuffle/ - Shuffle implementations (unchanged, already separate) Updates all imports (100+) across main and test sources. Improves code organization, clarity of dependencies, and maintainability. --- .github/prompts/commit.prompt.md | 2 +- .../io/github/compilerstuck/Control/MainController.java | 7 +++++++ .../compilerstuck/Control/{ => config}/DelayStrategy.java | 2 +- .../Control/{ => config}/MainControllerConfig.java | 2 +- .../Control/{ => config}/ShuffleStrategy.java | 5 ++++- .../compilerstuck/Control/{ => config}/ShuffleType.java | 2 +- .../compilerstuck/Control/{ => model}/ArrayController.java | 5 ++++- .../compilerstuck/Control/{ => model}/ArrayModel.java | 2 +- .../Control/{ => model}/SortingSessionManager.java | 3 ++- .../Control/{ => model}/SortingStateManager.java | 2 +- .../Control/{ => render}/HeadlessRenderContext.java | 2 +- .../Control/{ => render}/ProcessingContext.java | 2 +- .../compilerstuck/Control/{ => render}/RenderContext.java | 2 +- .../Control/shuffle/AlmostSortedShuffleStrategy.java | 6 +++--- .../Control/shuffle/RandomShuffleStrategy.java | 6 +++--- .../Control/shuffle/ReverseShuffleStrategy.java | 6 +++--- .../Control/shuffle/SortedShuffleStrategy.java | 6 +++--- .../compilerstuck/Control/{ => ui}/ComponentFactory.java | 2 +- .../compilerstuck/Control/{ => ui}/JCheckBoxList.java | 2 +- .../io/github/compilerstuck/Control/{ => ui}/Settings.form | 0 .../io/github/compilerstuck/Control/{ => ui}/Settings.java | 5 ++++- .../github/compilerstuck/Control/{ => ui}/StyledCard.java | 2 +- .../io/github/compilerstuck/Control/{ => ui}/UiTheme.java | 2 +- .../compilerstuck/SortingAlgorithms/AmericanFlagSort.java | 2 +- .../github/compilerstuck/SortingAlgorithms/BogoSort.java | 2 +- .../github/compilerstuck/SortingAlgorithms/BubbleSort.java | 2 +- .../github/compilerstuck/SortingAlgorithms/BucketSort.java | 2 +- .../github/compilerstuck/SortingAlgorithms/CombSort.java | 2 +- .../compilerstuck/SortingAlgorithms/CountingSort.java | 2 +- .../github/compilerstuck/SortingAlgorithms/CycleSort.java | 2 +- .../SortingAlgorithms/DoubleSelectionSort.java | 2 +- .../github/compilerstuck/SortingAlgorithms/GnomeSort.java | 2 +- .../compilerstuck/SortingAlgorithms/GravitySort.java | 2 +- .../github/compilerstuck/SortingAlgorithms/HeapSort.java | 2 +- .../compilerstuck/SortingAlgorithms/InsertionSort.java | 2 +- .../github/compilerstuck/SortingAlgorithms/MergeSort.java | 2 +- .../compilerstuck/SortingAlgorithms/OddEvenSort.java | 2 +- .../compilerstuck/SortingAlgorithms/PigeonholeSort.java | 2 +- .../SortingAlgorithms/QuickSortDualPivot.java | 2 +- .../SortingAlgorithms/QuickSortMiddlePivot.java | 2 +- .../SortingAlgorithms/RadixLSDSortBase10.java | 2 +- .../compilerstuck/SortingAlgorithms/SelectionSort.java | 2 +- .../github/compilerstuck/SortingAlgorithms/ShakerSort.java | 2 +- .../github/compilerstuck/SortingAlgorithms/ShellSort.java | 2 +- .../compilerstuck/SortingAlgorithms/SortingAlgorithm.java | 6 +++--- .../io/github/compilerstuck/SortingAlgorithms/TimSort.java | 2 +- .../java/io/github/compilerstuck/Sound/HeadlessSound.java | 2 +- src/main/java/io/github/compilerstuck/Sound/MidiSys.java | 2 +- .../java/io/github/compilerstuck/Sound/MinimSound.java | 2 +- src/main/java/io/github/compilerstuck/Sound/Sound.java | 2 +- src/main/java/io/github/compilerstuck/Visual/Bars.java | 4 ++-- src/main/java/io/github/compilerstuck/Visual/Circle.java | 4 ++-- .../io/github/compilerstuck/Visual/ColorGradientGraph.java | 4 ++-- src/main/java/io/github/compilerstuck/Visual/Cube.java | 4 ++-- .../java/io/github/compilerstuck/Visual/CubicLines.java | 4 ++-- .../io/github/compilerstuck/Visual/DisparityChords.java | 4 ++-- .../io/github/compilerstuck/Visual/DisparityCircle.java | 4 ++-- .../compilerstuck/Visual/DisparityCircleScatter.java | 4 ++-- .../compilerstuck/Visual/DisparityCircleScatterLinked.java | 4 ++-- .../io/github/compilerstuck/Visual/DisparityGraph.java | 4 ++-- .../compilerstuck/Visual/DisparityGraphMirrored.java | 4 ++-- .../io/github/compilerstuck/Visual/DisparityPlane.java | 4 ++-- .../github/compilerstuck/Visual/DisparitySphereHoops.java | 4 ++-- .../compilerstuck/Visual/DisparitySquareScatter.java | 4 ++-- src/main/java/io/github/compilerstuck/Visual/Hoops.java | 4 ++-- .../io/github/compilerstuck/Visual/HorizontalPyramid.java | 4 ++-- .../io/github/compilerstuck/Visual/ImageHorizontal.java | 4 ++-- .../java/io/github/compilerstuck/Visual/ImageVertical.java | 4 ++-- .../java/io/github/compilerstuck/Visual/MorphingShell.java | 4 ++-- .../java/io/github/compilerstuck/Visual/MosaicSquares.java | 4 ++-- .../java/io/github/compilerstuck/Visual/NumberPlot.java | 4 ++-- .../java/io/github/compilerstuck/Visual/Phyllotaxis.java | 4 ++-- src/main/java/io/github/compilerstuck/Visual/Plane.java | 4 ++-- src/main/java/io/github/compilerstuck/Visual/Pyramid.java | 4 ++-- .../java/io/github/compilerstuck/Visual/ScatterPlot.java | 4 ++-- .../io/github/compilerstuck/Visual/ScatterPlotLinked.java | 4 ++-- src/main/java/io/github/compilerstuck/Visual/Sphere.java | 4 ++-- .../java/io/github/compilerstuck/Visual/SphereHoops.java | 4 ++-- .../github/compilerstuck/Visual/SphericDisparityLines.java | 4 ++-- .../java/io/github/compilerstuck/Visual/SwirlDots.java | 4 ++-- .../java/io/github/compilerstuck/Visual/Visualization.java | 4 ++-- .../compilerstuck/Control/ArrayModelAndStrategyTest.java | 4 ++++ .../Control/HeadlessVisualizationAndSoundTest.java | 2 ++ .../SortingAlgorithms/SortingAlgorithmsTest.java | 7 ++++--- 84 files changed, 147 insertions(+), 123 deletions(-) rename src/main/java/io/github/compilerstuck/Control/{ => config}/DelayStrategy.java (96%) rename src/main/java/io/github/compilerstuck/Control/{ => config}/MainControllerConfig.java (97%) rename src/main/java/io/github/compilerstuck/Control/{ => config}/ShuffleStrategy.java (80%) rename src/main/java/io/github/compilerstuck/Control/{ => config}/ShuffleType.java (83%) rename src/main/java/io/github/compilerstuck/Control/{ => model}/ArrayController.java (95%) rename src/main/java/io/github/compilerstuck/Control/{ => model}/ArrayModel.java (97%) rename src/main/java/io/github/compilerstuck/Control/{ => model}/SortingSessionManager.java (98%) rename src/main/java/io/github/compilerstuck/Control/{ => model}/SortingStateManager.java (98%) rename src/main/java/io/github/compilerstuck/Control/{ => render}/HeadlessRenderContext.java (96%) rename src/main/java/io/github/compilerstuck/Control/{ => render}/ProcessingContext.java (90%) rename src/main/java/io/github/compilerstuck/Control/{ => render}/RenderContext.java (93%) rename src/main/java/io/github/compilerstuck/Control/{ => ui}/ComponentFactory.java (99%) rename src/main/java/io/github/compilerstuck/Control/{ => ui}/JCheckBoxList.java (97%) rename src/main/java/io/github/compilerstuck/Control/{ => ui}/Settings.form (100%) rename src/main/java/io/github/compilerstuck/Control/{ => ui}/Settings.java (99%) rename src/main/java/io/github/compilerstuck/Control/{ => ui}/StyledCard.java (98%) rename src/main/java/io/github/compilerstuck/Control/{ => ui}/UiTheme.java (99%) diff --git a/.github/prompts/commit.prompt.md b/.github/prompts/commit.prompt.md index 61287d0..f6ec439 100644 --- a/.github/prompts/commit.prompt.md +++ b/.github/prompts/commit.prompt.md @@ -1,5 +1,5 @@ --- -mode: agent +agent: agent description: Create a meaningful branch and commit all pending changes, then advise on pushing. --- diff --git a/src/main/java/io/github/compilerstuck/Control/MainController.java b/src/main/java/io/github/compilerstuck/Control/MainController.java index 7a3f505..51f9b1c 100644 --- a/src/main/java/io/github/compilerstuck/Control/MainController.java +++ b/src/main/java/io/github/compilerstuck/Control/MainController.java @@ -1,6 +1,13 @@ package io.github.compilerstuck.Control; import com.formdev.flatlaf.FlatDarculaLaf; +import io.github.compilerstuck.Control.config.MainControllerConfig; +import io.github.compilerstuck.Control.model.ArrayController; +import io.github.compilerstuck.Control.model.SortingSessionManager; +import io.github.compilerstuck.Control.model.SortingStateManager; +import io.github.compilerstuck.Control.render.ProcessingContext; +import io.github.compilerstuck.Control.render.RenderContext; +import io.github.compilerstuck.Control.ui.Settings; import io.github.compilerstuck.SortingAlgorithms.QuickSortMiddlePivot; import io.github.compilerstuck.SortingAlgorithms.SortingAlgorithm; import io.github.compilerstuck.Sound.MidiSys; diff --git a/src/main/java/io/github/compilerstuck/Control/DelayStrategy.java b/src/main/java/io/github/compilerstuck/Control/config/DelayStrategy.java similarity index 96% rename from src/main/java/io/github/compilerstuck/Control/DelayStrategy.java rename to src/main/java/io/github/compilerstuck/Control/config/DelayStrategy.java index a96380a..78101c9 100644 --- a/src/main/java/io/github/compilerstuck/Control/DelayStrategy.java +++ b/src/main/java/io/github/compilerstuck/Control/config/DelayStrategy.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.config; /** * Strategy that decides whether a visualisation delay should fire for a given diff --git a/src/main/java/io/github/compilerstuck/Control/MainControllerConfig.java b/src/main/java/io/github/compilerstuck/Control/config/MainControllerConfig.java similarity index 97% rename from src/main/java/io/github/compilerstuck/Control/MainControllerConfig.java rename to src/main/java/io/github/compilerstuck/Control/config/MainControllerConfig.java index ae878ed..a436152 100644 --- a/src/main/java/io/github/compilerstuck/Control/MainControllerConfig.java +++ b/src/main/java/io/github/compilerstuck/Control/config/MainControllerConfig.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.config; /** * Configuration constants for MainController. diff --git a/src/main/java/io/github/compilerstuck/Control/ShuffleStrategy.java b/src/main/java/io/github/compilerstuck/Control/config/ShuffleStrategy.java similarity index 80% rename from src/main/java/io/github/compilerstuck/Control/ShuffleStrategy.java rename to src/main/java/io/github/compilerstuck/Control/config/ShuffleStrategy.java index 4dd88d4..1c95bf8 100644 --- a/src/main/java/io/github/compilerstuck/Control/ShuffleStrategy.java +++ b/src/main/java/io/github/compilerstuck/Control/config/ShuffleStrategy.java @@ -1,4 +1,7 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.config; + +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.ProcessingContext; /** * Strategy interface for array shuffle behaviours. diff --git a/src/main/java/io/github/compilerstuck/Control/ShuffleType.java b/src/main/java/io/github/compilerstuck/Control/config/ShuffleType.java similarity index 83% rename from src/main/java/io/github/compilerstuck/Control/ShuffleType.java rename to src/main/java/io/github/compilerstuck/Control/config/ShuffleType.java index 2d01dff..8711575 100644 --- a/src/main/java/io/github/compilerstuck/Control/ShuffleType.java +++ b/src/main/java/io/github/compilerstuck/Control/config/ShuffleType.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.config; import java.util.Locale; diff --git a/src/main/java/io/github/compilerstuck/Control/ArrayController.java b/src/main/java/io/github/compilerstuck/Control/model/ArrayController.java similarity index 95% rename from src/main/java/io/github/compilerstuck/Control/ArrayController.java rename to src/main/java/io/github/compilerstuck/Control/model/ArrayController.java index 438e7b5..bf8a62b 100644 --- a/src/main/java/io/github/compilerstuck/Control/ArrayController.java +++ b/src/main/java/io/github/compilerstuck/Control/model/ArrayController.java @@ -1,5 +1,8 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.model; +import io.github.compilerstuck.Control.MainController; +import io.github.compilerstuck.Control.config.ShuffleStrategy; +import io.github.compilerstuck.Control.config.ShuffleType; import io.github.compilerstuck.Control.shuffle.AlmostSortedShuffleStrategy; import io.github.compilerstuck.Control.shuffle.RandomShuffleStrategy; import io.github.compilerstuck.Control.shuffle.ReverseShuffleStrategy; diff --git a/src/main/java/io/github/compilerstuck/Control/ArrayModel.java b/src/main/java/io/github/compilerstuck/Control/model/ArrayModel.java similarity index 97% rename from src/main/java/io/github/compilerstuck/Control/ArrayModel.java rename to src/main/java/io/github/compilerstuck/Control/model/ArrayModel.java index f63b172..65241c1 100644 --- a/src/main/java/io/github/compilerstuck/Control/ArrayModel.java +++ b/src/main/java/io/github/compilerstuck/Control/model/ArrayModel.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.model; import io.github.compilerstuck.Visual.Marker; diff --git a/src/main/java/io/github/compilerstuck/Control/SortingSessionManager.java b/src/main/java/io/github/compilerstuck/Control/model/SortingSessionManager.java similarity index 98% rename from src/main/java/io/github/compilerstuck/Control/SortingSessionManager.java rename to src/main/java/io/github/compilerstuck/Control/model/SortingSessionManager.java index 4b0a5ca..24c6e7d 100644 --- a/src/main/java/io/github/compilerstuck/Control/SortingSessionManager.java +++ b/src/main/java/io/github/compilerstuck/Control/model/SortingSessionManager.java @@ -1,5 +1,6 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.model; +import io.github.compilerstuck.Control.config.MainControllerConfig; import io.github.compilerstuck.SortingAlgorithms.SortingAlgorithm; import io.github.compilerstuck.Sound.Sound; diff --git a/src/main/java/io/github/compilerstuck/Control/SortingStateManager.java b/src/main/java/io/github/compilerstuck/Control/model/SortingStateManager.java similarity index 98% rename from src/main/java/io/github/compilerstuck/Control/SortingStateManager.java rename to src/main/java/io/github/compilerstuck/Control/model/SortingStateManager.java index ee440eb..6009c81 100644 --- a/src/main/java/io/github/compilerstuck/Control/SortingStateManager.java +++ b/src/main/java/io/github/compilerstuck/Control/model/SortingStateManager.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.model; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/src/main/java/io/github/compilerstuck/Control/HeadlessRenderContext.java b/src/main/java/io/github/compilerstuck/Control/render/HeadlessRenderContext.java similarity index 96% rename from src/main/java/io/github/compilerstuck/Control/HeadlessRenderContext.java rename to src/main/java/io/github/compilerstuck/Control/render/HeadlessRenderContext.java index b40bdae..300d43a 100644 --- a/src/main/java/io/github/compilerstuck/Control/HeadlessRenderContext.java +++ b/src/main/java/io/github/compilerstuck/Control/render/HeadlessRenderContext.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.render; /** * A trivial {@link RenderContext} implementation that does nothing. Useful for diff --git a/src/main/java/io/github/compilerstuck/Control/ProcessingContext.java b/src/main/java/io/github/compilerstuck/Control/render/ProcessingContext.java similarity index 90% rename from src/main/java/io/github/compilerstuck/Control/ProcessingContext.java rename to src/main/java/io/github/compilerstuck/Control/render/ProcessingContext.java index c4b5c28..5975cf4 100644 --- a/src/main/java/io/github/compilerstuck/Control/ProcessingContext.java +++ b/src/main/java/io/github/compilerstuck/Control/render/ProcessingContext.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.render; /** * Minimal abstraction of the Processing runtime used by sorting algorithms to diff --git a/src/main/java/io/github/compilerstuck/Control/RenderContext.java b/src/main/java/io/github/compilerstuck/Control/render/RenderContext.java similarity index 93% rename from src/main/java/io/github/compilerstuck/Control/RenderContext.java rename to src/main/java/io/github/compilerstuck/Control/render/RenderContext.java index 00b2b25..0ba90c3 100644 --- a/src/main/java/io/github/compilerstuck/Control/RenderContext.java +++ b/src/main/java/io/github/compilerstuck/Control/render/RenderContext.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.render; /** * Abstraction over the minimal subset of Processing's drawing API used by diff --git a/src/main/java/io/github/compilerstuck/Control/shuffle/AlmostSortedShuffleStrategy.java b/src/main/java/io/github/compilerstuck/Control/shuffle/AlmostSortedShuffleStrategy.java index 8e93174..7ceae03 100644 --- a/src/main/java/io/github/compilerstuck/Control/shuffle/AlmostSortedShuffleStrategy.java +++ b/src/main/java/io/github/compilerstuck/Control/shuffle/AlmostSortedShuffleStrategy.java @@ -1,8 +1,8 @@ package io.github.compilerstuck.Control.shuffle; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.ProcessingContext; -import io.github.compilerstuck.Control.ShuffleStrategy; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.ProcessingContext; +import io.github.compilerstuck.Control.config.ShuffleStrategy; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.SortingAlgorithms.SortingAlgorithm; import io.github.compilerstuck.Visual.Marker; diff --git a/src/main/java/io/github/compilerstuck/Control/shuffle/RandomShuffleStrategy.java b/src/main/java/io/github/compilerstuck/Control/shuffle/RandomShuffleStrategy.java index b29374b..dc2237d 100644 --- a/src/main/java/io/github/compilerstuck/Control/shuffle/RandomShuffleStrategy.java +++ b/src/main/java/io/github/compilerstuck/Control/shuffle/RandomShuffleStrategy.java @@ -1,8 +1,8 @@ package io.github.compilerstuck.Control.shuffle; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.ProcessingContext; -import io.github.compilerstuck.Control.ShuffleStrategy; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.ProcessingContext; +import io.github.compilerstuck.Control.config.ShuffleStrategy; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.SortingAlgorithms.SortingAlgorithm; import io.github.compilerstuck.Visual.Marker; diff --git a/src/main/java/io/github/compilerstuck/Control/shuffle/ReverseShuffleStrategy.java b/src/main/java/io/github/compilerstuck/Control/shuffle/ReverseShuffleStrategy.java index 23140de..f648a00 100644 --- a/src/main/java/io/github/compilerstuck/Control/shuffle/ReverseShuffleStrategy.java +++ b/src/main/java/io/github/compilerstuck/Control/shuffle/ReverseShuffleStrategy.java @@ -1,8 +1,8 @@ package io.github.compilerstuck.Control.shuffle; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.ProcessingContext; -import io.github.compilerstuck.Control.ShuffleStrategy; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.ProcessingContext; +import io.github.compilerstuck.Control.config.ShuffleStrategy; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.SortingAlgorithms.SortingAlgorithm; import io.github.compilerstuck.Visual.Marker; diff --git a/src/main/java/io/github/compilerstuck/Control/shuffle/SortedShuffleStrategy.java b/src/main/java/io/github/compilerstuck/Control/shuffle/SortedShuffleStrategy.java index 006ea8d..5aa4d09 100644 --- a/src/main/java/io/github/compilerstuck/Control/shuffle/SortedShuffleStrategy.java +++ b/src/main/java/io/github/compilerstuck/Control/shuffle/SortedShuffleStrategy.java @@ -1,8 +1,8 @@ package io.github.compilerstuck.Control.shuffle; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.ProcessingContext; -import io.github.compilerstuck.Control.ShuffleStrategy; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.ProcessingContext; +import io.github.compilerstuck.Control.config.ShuffleStrategy; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.SortingAlgorithms.SortingAlgorithm; import io.github.compilerstuck.Visual.Marker; diff --git a/src/main/java/io/github/compilerstuck/Control/ComponentFactory.java b/src/main/java/io/github/compilerstuck/Control/ui/ComponentFactory.java similarity index 99% rename from src/main/java/io/github/compilerstuck/Control/ComponentFactory.java rename to src/main/java/io/github/compilerstuck/Control/ui/ComponentFactory.java index 449b9b8..4d4c363 100644 --- a/src/main/java/io/github/compilerstuck/Control/ComponentFactory.java +++ b/src/main/java/io/github/compilerstuck/Control/ui/ComponentFactory.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.ui; import javax.swing.*; import javax.swing.border.Border; diff --git a/src/main/java/io/github/compilerstuck/Control/JCheckBoxList.java b/src/main/java/io/github/compilerstuck/Control/ui/JCheckBoxList.java similarity index 97% rename from src/main/java/io/github/compilerstuck/Control/JCheckBoxList.java rename to src/main/java/io/github/compilerstuck/Control/ui/JCheckBoxList.java index 985977a..9ef682a 100644 --- a/src/main/java/io/github/compilerstuck/Control/JCheckBoxList.java +++ b/src/main/java/io/github/compilerstuck/Control/ui/JCheckBoxList.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.ui; import java.awt.Component; diff --git a/src/main/java/io/github/compilerstuck/Control/Settings.form b/src/main/java/io/github/compilerstuck/Control/ui/Settings.form similarity index 100% rename from src/main/java/io/github/compilerstuck/Control/Settings.form rename to src/main/java/io/github/compilerstuck/Control/ui/Settings.form diff --git a/src/main/java/io/github/compilerstuck/Control/Settings.java b/src/main/java/io/github/compilerstuck/Control/ui/Settings.java similarity index 99% rename from src/main/java/io/github/compilerstuck/Control/Settings.java rename to src/main/java/io/github/compilerstuck/Control/ui/Settings.java index b659f47..dbfda77 100644 --- a/src/main/java/io/github/compilerstuck/Control/Settings.java +++ b/src/main/java/io/github/compilerstuck/Control/ui/Settings.java @@ -1,5 +1,8 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.ui; +import io.github.compilerstuck.Control.MainController; +import io.github.compilerstuck.Control.config.ShuffleType; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.SortingAlgorithms.*; import io.github.compilerstuck.Visual.*; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Control/StyledCard.java b/src/main/java/io/github/compilerstuck/Control/ui/StyledCard.java similarity index 98% rename from src/main/java/io/github/compilerstuck/Control/StyledCard.java rename to src/main/java/io/github/compilerstuck/Control/ui/StyledCard.java index e272c35..4e1f881 100644 --- a/src/main/java/io/github/compilerstuck/Control/StyledCard.java +++ b/src/main/java/io/github/compilerstuck/Control/ui/StyledCard.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.ui; import javax.swing.*; import java.awt.*; diff --git a/src/main/java/io/github/compilerstuck/Control/UiTheme.java b/src/main/java/io/github/compilerstuck/Control/ui/UiTheme.java similarity index 99% rename from src/main/java/io/github/compilerstuck/Control/UiTheme.java rename to src/main/java/io/github/compilerstuck/Control/ui/UiTheme.java index 3ac01d3..9f01038 100644 --- a/src/main/java/io/github/compilerstuck/Control/UiTheme.java +++ b/src/main/java/io/github/compilerstuck/Control/ui/UiTheme.java @@ -1,4 +1,4 @@ -package io.github.compilerstuck.Control; +package io.github.compilerstuck.Control.ui; import java.awt.*; diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/AmericanFlagSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/AmericanFlagSort.java index 4447788..fb1ee72 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/AmericanFlagSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/AmericanFlagSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class AmericanFlagSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/BogoSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/BogoSort.java index 4b7ff83..2a4dce3 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/BogoSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/BogoSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Visual.Marker; diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/BubbleSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/BubbleSort.java index f58bba6..1620cef 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/BubbleSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/BubbleSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class BubbleSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/BucketSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/BucketSort.java index 1bf2aea..6fc2f24 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/BucketSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/BucketSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; import java.util.Arrays; diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/CombSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/CombSort.java index a982784..850961a 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/CombSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/CombSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class CombSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/CountingSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/CountingSort.java index 5e8553f..56f1812 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/CountingSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/CountingSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; import java.util.Arrays; diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/CycleSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/CycleSort.java index a7eba3c..07ff9e1 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/CycleSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/CycleSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class CycleSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/DoubleSelectionSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/DoubleSelectionSort.java index d2f6ceb..e7be248 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/DoubleSelectionSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/DoubleSelectionSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class DoubleSelectionSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/GnomeSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/GnomeSort.java index 9ff5357..7dc3835 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/GnomeSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/GnomeSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class GnomeSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/GravitySort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/GravitySort.java index 31c3d5b..d7acdf5 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/GravitySort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/GravitySort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class GravitySort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/HeapSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/HeapSort.java index 47b37b1..0c4c10a 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/HeapSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/HeapSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class HeapSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/InsertionSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/InsertionSort.java index b5d39eb..860b0c6 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/InsertionSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/InsertionSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class InsertionSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/MergeSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/MergeSort.java index e35cb56..7c20642 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/MergeSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/MergeSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class MergeSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/OddEvenSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/OddEvenSort.java index 3e6d717..581e428 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/OddEvenSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/OddEvenSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class OddEvenSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/PigeonholeSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/PigeonholeSort.java index 022c598..3815b46 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/PigeonholeSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/PigeonholeSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; import java.util.Arrays; diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/QuickSortDualPivot.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/QuickSortDualPivot.java index 5c93b16..40693eb 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/QuickSortDualPivot.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/QuickSortDualPivot.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class QuickSortDualPivot extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/QuickSortMiddlePivot.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/QuickSortMiddlePivot.java index f14f3dc..b07eb9d 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/QuickSortMiddlePivot.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/QuickSortMiddlePivot.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Visual.Marker; diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/RadixLSDSortBase10.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/RadixLSDSortBase10.java index d586dcb..e517579 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/RadixLSDSortBase10.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/RadixLSDSortBase10.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; import java.util.ArrayList; diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/SelectionSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/SelectionSort.java index f658819..b6df1e7 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/SelectionSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/SelectionSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class SelectionSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/ShakerSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/ShakerSort.java index b58bb08..abba9a2 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/ShakerSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/ShakerSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; public class ShakerSort extends SortingAlgorithm { diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/ShellSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/ShellSort.java index ca9b8ee..f4f751d 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/ShellSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/ShellSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Visual.Marker; diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/SortingAlgorithm.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/SortingAlgorithm.java index 1d89ee7..8c7a6ad 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/SortingAlgorithm.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/SortingAlgorithm.java @@ -1,9 +1,9 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.DelayStrategy; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.config.DelayStrategy; import io.github.compilerstuck.Control.MainController; -import io.github.compilerstuck.Control.ProcessingContext; +import io.github.compilerstuck.Control.render.ProcessingContext; import io.github.compilerstuck.Visual.Marker; diff --git a/src/main/java/io/github/compilerstuck/SortingAlgorithms/TimSort.java b/src/main/java/io/github/compilerstuck/SortingAlgorithms/TimSort.java index b8fc0a2..ff59eec 100644 --- a/src/main/java/io/github/compilerstuck/SortingAlgorithms/TimSort.java +++ b/src/main/java/io/github/compilerstuck/SortingAlgorithms/TimSort.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; import java.util.Random; diff --git a/src/main/java/io/github/compilerstuck/Sound/HeadlessSound.java b/src/main/java/io/github/compilerstuck/Sound/HeadlessSound.java index c7a485f..46f3537 100644 --- a/src/main/java/io/github/compilerstuck/Sound/HeadlessSound.java +++ b/src/main/java/io/github/compilerstuck/Sound/HeadlessSound.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.Sound; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; /** * No-op sound implementation used when audio output is not desired (e.g. in diff --git a/src/main/java/io/github/compilerstuck/Sound/MidiSys.java b/src/main/java/io/github/compilerstuck/Sound/MidiSys.java index ecaf02a..3eaa1ff 100644 --- a/src/main/java/io/github/compilerstuck/Sound/MidiSys.java +++ b/src/main/java/io/github/compilerstuck/Sound/MidiSys.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.Sound; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Visual.Marker; import processing.core.PApplet; diff --git a/src/main/java/io/github/compilerstuck/Sound/MinimSound.java b/src/main/java/io/github/compilerstuck/Sound/MinimSound.java index ae8fc0b..3be6746 100644 --- a/src/main/java/io/github/compilerstuck/Sound/MinimSound.java +++ b/src/main/java/io/github/compilerstuck/Sound/MinimSound.java @@ -2,7 +2,7 @@ import ddf.minim.AudioOutput; import ddf.minim.Minim; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import io.github.compilerstuck.Control.MainController; import processing.core.PApplet; diff --git a/src/main/java/io/github/compilerstuck/Sound/Sound.java b/src/main/java/io/github/compilerstuck/Sound/Sound.java index c76d127..882e88c 100644 --- a/src/main/java/io/github/compilerstuck/Sound/Sound.java +++ b/src/main/java/io/github/compilerstuck/Sound/Sound.java @@ -1,6 +1,6 @@ package io.github.compilerstuck.Sound; -import io.github.compilerstuck.Control.ArrayModel; +import io.github.compilerstuck.Control.model.ArrayModel; import processing.core.PApplet; public abstract class Sound { diff --git a/src/main/java/io/github/compilerstuck/Visual/Bars.java b/src/main/java/io/github/compilerstuck/Visual/Bars.java index 56a08d3..d28fc8a 100644 --- a/src/main/java/io/github/compilerstuck/Visual/Bars.java +++ b/src/main/java/io/github/compilerstuck/Visual/Bars.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/Circle.java b/src/main/java/io/github/compilerstuck/Visual/Circle.java index 865dd15..11259e3 100644 --- a/src/main/java/io/github/compilerstuck/Visual/Circle.java +++ b/src/main/java/io/github/compilerstuck/Visual/Circle.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/ColorGradientGraph.java b/src/main/java/io/github/compilerstuck/Visual/ColorGradientGraph.java index 43e5e67..200c1fd 100644 --- a/src/main/java/io/github/compilerstuck/Visual/ColorGradientGraph.java +++ b/src/main/java/io/github/compilerstuck/Visual/ColorGradientGraph.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/Cube.java b/src/main/java/io/github/compilerstuck/Visual/Cube.java index e4b25ed..fef4081 100644 --- a/src/main/java/io/github/compilerstuck/Visual/Cube.java +++ b/src/main/java/io/github/compilerstuck/Visual/Cube.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Sound.Sound; diff --git a/src/main/java/io/github/compilerstuck/Visual/CubicLines.java b/src/main/java/io/github/compilerstuck/Visual/CubicLines.java index 7f15f44..63bd603 100644 --- a/src/main/java/io/github/compilerstuck/Visual/CubicLines.java +++ b/src/main/java/io/github/compilerstuck/Visual/CubicLines.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Sound.Sound; diff --git a/src/main/java/io/github/compilerstuck/Visual/DisparityChords.java b/src/main/java/io/github/compilerstuck/Visual/DisparityChords.java index 4247a68..210c0c0 100644 --- a/src/main/java/io/github/compilerstuck/Visual/DisparityChords.java +++ b/src/main/java/io/github/compilerstuck/Visual/DisparityChords.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/DisparityCircle.java b/src/main/java/io/github/compilerstuck/Visual/DisparityCircle.java index 6c0ad85..5652566 100644 --- a/src/main/java/io/github/compilerstuck/Visual/DisparityCircle.java +++ b/src/main/java/io/github/compilerstuck/Visual/DisparityCircle.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/DisparityCircleScatter.java b/src/main/java/io/github/compilerstuck/Visual/DisparityCircleScatter.java index de42764..03675b7 100644 --- a/src/main/java/io/github/compilerstuck/Visual/DisparityCircleScatter.java +++ b/src/main/java/io/github/compilerstuck/Visual/DisparityCircleScatter.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/DisparityCircleScatterLinked.java b/src/main/java/io/github/compilerstuck/Visual/DisparityCircleScatterLinked.java index 7ff7b8b..b8207d0 100644 --- a/src/main/java/io/github/compilerstuck/Visual/DisparityCircleScatterLinked.java +++ b/src/main/java/io/github/compilerstuck/Visual/DisparityCircleScatterLinked.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/DisparityGraph.java b/src/main/java/io/github/compilerstuck/Visual/DisparityGraph.java index f917955..306d197 100644 --- a/src/main/java/io/github/compilerstuck/Visual/DisparityGraph.java +++ b/src/main/java/io/github/compilerstuck/Visual/DisparityGraph.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/DisparityGraphMirrored.java b/src/main/java/io/github/compilerstuck/Visual/DisparityGraphMirrored.java index cc2ab65..69f5a63 100644 --- a/src/main/java/io/github/compilerstuck/Visual/DisparityGraphMirrored.java +++ b/src/main/java/io/github/compilerstuck/Visual/DisparityGraphMirrored.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/DisparityPlane.java b/src/main/java/io/github/compilerstuck/Visual/DisparityPlane.java index 73b7cf4..28216a9 100644 --- a/src/main/java/io/github/compilerstuck/Visual/DisparityPlane.java +++ b/src/main/java/io/github/compilerstuck/Visual/DisparityPlane.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Sound.Sound; diff --git a/src/main/java/io/github/compilerstuck/Visual/DisparitySphereHoops.java b/src/main/java/io/github/compilerstuck/Visual/DisparitySphereHoops.java index b10d609..1378916 100644 --- a/src/main/java/io/github/compilerstuck/Visual/DisparitySphereHoops.java +++ b/src/main/java/io/github/compilerstuck/Visual/DisparitySphereHoops.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/DisparitySquareScatter.java b/src/main/java/io/github/compilerstuck/Visual/DisparitySquareScatter.java index ae6a599..70e3838 100644 --- a/src/main/java/io/github/compilerstuck/Visual/DisparitySquareScatter.java +++ b/src/main/java/io/github/compilerstuck/Visual/DisparitySquareScatter.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/Hoops.java b/src/main/java/io/github/compilerstuck/Visual/Hoops.java index 89978d2..238a3c0 100644 --- a/src/main/java/io/github/compilerstuck/Visual/Hoops.java +++ b/src/main/java/io/github/compilerstuck/Visual/Hoops.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/HorizontalPyramid.java b/src/main/java/io/github/compilerstuck/Visual/HorizontalPyramid.java index 5e92761..ba3a13d 100644 --- a/src/main/java/io/github/compilerstuck/Visual/HorizontalPyramid.java +++ b/src/main/java/io/github/compilerstuck/Visual/HorizontalPyramid.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/ImageHorizontal.java b/src/main/java/io/github/compilerstuck/Visual/ImageHorizontal.java index b423840..54c6b63 100644 --- a/src/main/java/io/github/compilerstuck/Visual/ImageHorizontal.java +++ b/src/main/java/io/github/compilerstuck/Visual/ImageHorizontal.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Sound.Sound; diff --git a/src/main/java/io/github/compilerstuck/Visual/ImageVertical.java b/src/main/java/io/github/compilerstuck/Visual/ImageVertical.java index fa5542e..cbd81c8 100644 --- a/src/main/java/io/github/compilerstuck/Visual/ImageVertical.java +++ b/src/main/java/io/github/compilerstuck/Visual/ImageVertical.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Sound.Sound; diff --git a/src/main/java/io/github/compilerstuck/Visual/MorphingShell.java b/src/main/java/io/github/compilerstuck/Visual/MorphingShell.java index f1f86da..93d2424 100644 --- a/src/main/java/io/github/compilerstuck/Visual/MorphingShell.java +++ b/src/main/java/io/github/compilerstuck/Visual/MorphingShell.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/MosaicSquares.java b/src/main/java/io/github/compilerstuck/Visual/MosaicSquares.java index 83bf3e1..b7a5ff4 100644 --- a/src/main/java/io/github/compilerstuck/Visual/MosaicSquares.java +++ b/src/main/java/io/github/compilerstuck/Visual/MosaicSquares.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/NumberPlot.java b/src/main/java/io/github/compilerstuck/Visual/NumberPlot.java index 21ecf5b..ec2a97c 100644 --- a/src/main/java/io/github/compilerstuck/Visual/NumberPlot.java +++ b/src/main/java/io/github/compilerstuck/Visual/NumberPlot.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/Phyllotaxis.java b/src/main/java/io/github/compilerstuck/Visual/Phyllotaxis.java index c7ad383..8887366 100644 --- a/src/main/java/io/github/compilerstuck/Visual/Phyllotaxis.java +++ b/src/main/java/io/github/compilerstuck/Visual/Phyllotaxis.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/Plane.java b/src/main/java/io/github/compilerstuck/Visual/Plane.java index 9d9953a..2664000 100644 --- a/src/main/java/io/github/compilerstuck/Visual/Plane.java +++ b/src/main/java/io/github/compilerstuck/Visual/Plane.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Sound.Sound; diff --git a/src/main/java/io/github/compilerstuck/Visual/Pyramid.java b/src/main/java/io/github/compilerstuck/Visual/Pyramid.java index e06ff1f..e47a9db 100644 --- a/src/main/java/io/github/compilerstuck/Visual/Pyramid.java +++ b/src/main/java/io/github/compilerstuck/Visual/Pyramid.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/ScatterPlot.java b/src/main/java/io/github/compilerstuck/Visual/ScatterPlot.java index 86d7215..ba73cd5 100644 --- a/src/main/java/io/github/compilerstuck/Visual/ScatterPlot.java +++ b/src/main/java/io/github/compilerstuck/Visual/ScatterPlot.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/ScatterPlotLinked.java b/src/main/java/io/github/compilerstuck/Visual/ScatterPlotLinked.java index aad318f..e68781c 100644 --- a/src/main/java/io/github/compilerstuck/Visual/ScatterPlotLinked.java +++ b/src/main/java/io/github/compilerstuck/Visual/ScatterPlotLinked.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/Sphere.java b/src/main/java/io/github/compilerstuck/Visual/Sphere.java index 9a3e7c5..919e6bd 100644 --- a/src/main/java/io/github/compilerstuck/Visual/Sphere.java +++ b/src/main/java/io/github/compilerstuck/Visual/Sphere.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Sound.Sound; diff --git a/src/main/java/io/github/compilerstuck/Visual/SphereHoops.java b/src/main/java/io/github/compilerstuck/Visual/SphereHoops.java index 440dc8b..bcf5abf 100644 --- a/src/main/java/io/github/compilerstuck/Visual/SphereHoops.java +++ b/src/main/java/io/github/compilerstuck/Visual/SphereHoops.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/SphericDisparityLines.java b/src/main/java/io/github/compilerstuck/Visual/SphericDisparityLines.java index 2f8aba0..c970963 100644 --- a/src/main/java/io/github/compilerstuck/Visual/SphericDisparityLines.java +++ b/src/main/java/io/github/compilerstuck/Visual/SphericDisparityLines.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Control.MainController; import io.github.compilerstuck.Sound.Sound; diff --git a/src/main/java/io/github/compilerstuck/Visual/SwirlDots.java b/src/main/java/io/github/compilerstuck/Visual/SwirlDots.java index c9f80b1..9f8dead 100644 --- a/src/main/java/io/github/compilerstuck/Visual/SwirlDots.java +++ b/src/main/java/io/github/compilerstuck/Visual/SwirlDots.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import processing.core.PApplet; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/main/java/io/github/compilerstuck/Visual/Visualization.java b/src/main/java/io/github/compilerstuck/Visual/Visualization.java index 0f2463a..e8c7063 100644 --- a/src/main/java/io/github/compilerstuck/Visual/Visualization.java +++ b/src/main/java/io/github/compilerstuck/Visual/Visualization.java @@ -1,7 +1,7 @@ package io.github.compilerstuck.Visual; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.RenderContext; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.RenderContext; import io.github.compilerstuck.Sound.Sound; import io.github.compilerstuck.Visual.Gradient.ColorGradient; diff --git a/src/test/java/io/github/compilerstuck/Control/ArrayModelAndStrategyTest.java b/src/test/java/io/github/compilerstuck/Control/ArrayModelAndStrategyTest.java index 9d67b9f..661d0ca 100644 --- a/src/test/java/io/github/compilerstuck/Control/ArrayModelAndStrategyTest.java +++ b/src/test/java/io/github/compilerstuck/Control/ArrayModelAndStrategyTest.java @@ -1,5 +1,9 @@ package io.github.compilerstuck.Control; +import io.github.compilerstuck.Control.config.DelayStrategy; +import io.github.compilerstuck.Control.config.ShuffleType; +import io.github.compilerstuck.Control.model.ArrayController; +import io.github.compilerstuck.Control.render.ProcessingContext; import io.github.compilerstuck.Control.shuffle.AlmostSortedShuffleStrategy; import io.github.compilerstuck.Control.shuffle.RandomShuffleStrategy; import io.github.compilerstuck.Control.shuffle.ReverseShuffleStrategy; diff --git a/src/test/java/io/github/compilerstuck/Control/HeadlessVisualizationAndSoundTest.java b/src/test/java/io/github/compilerstuck/Control/HeadlessVisualizationAndSoundTest.java index cc19465..0b85add 100644 --- a/src/test/java/io/github/compilerstuck/Control/HeadlessVisualizationAndSoundTest.java +++ b/src/test/java/io/github/compilerstuck/Control/HeadlessVisualizationAndSoundTest.java @@ -1,5 +1,7 @@ package io.github.compilerstuck.Control; +import io.github.compilerstuck.Control.model.ArrayController; +import io.github.compilerstuck.Control.render.HeadlessRenderContext; import io.github.compilerstuck.Sound.HeadlessSound; import io.github.compilerstuck.Visual.Bars; import io.github.compilerstuck.Visual.Circle; diff --git a/src/test/java/io/github/compilerstuck/SortingAlgorithms/SortingAlgorithmsTest.java b/src/test/java/io/github/compilerstuck/SortingAlgorithms/SortingAlgorithmsTest.java index 1684d64..f726ef2 100644 --- a/src/test/java/io/github/compilerstuck/SortingAlgorithms/SortingAlgorithmsTest.java +++ b/src/test/java/io/github/compilerstuck/SortingAlgorithms/SortingAlgorithmsTest.java @@ -1,8 +1,9 @@ package io.github.compilerstuck.SortingAlgorithms; -import io.github.compilerstuck.Control.ArrayModel; -import io.github.compilerstuck.Control.ArrayController; import io.github.compilerstuck.Control.MainController; +import io.github.compilerstuck.Control.model.ArrayController; +import io.github.compilerstuck.Control.model.ArrayModel; +import io.github.compilerstuck.Control.render.ProcessingContext; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -25,7 +26,7 @@ class SortingAlgorithmsTest { * Most of the sorting code only ever calls {@code delay(int)}, so we provide a * no-op implementation to avoid starting a real graphics context during tests. */ - static class DummyProcessing extends PApplet implements io.github.compilerstuck.Control.ProcessingContext { + static class DummyProcessing extends PApplet implements ProcessingContext { @Override public void delay(int ms) { // do nothing, keep tests fast