Class EffectGUI

java.lang.Object
org.emrick.project.effect.EffectGUI
All Implemented Interfaces:
ActionListener, EventListener

public class EffectGUI extends Object implements ActionListener
  • Field Details

    • DEFAULT_DURATION_COUNTS

      private static final int DEFAULT_DURATION_COUNTS
      See Also:
    • EFFECTS_GROUPS

      private static List<EffectsGroup> EFFECTS_GROUPS
    • noProjectSyncMsg

      public static String noProjectSyncMsg
    • selectEffectMsg

      public static String selectEffectMsg
    • noCommonEffectMsg

      public static String noCommonEffectMsg
    • noEffectGroupMsg

      public static String noEffectGroupMsg
    • effectPanel

      JPanel effectPanel
    • effect

      Effect effect
    • effectMod

      Effect effectMod
    • effectListener

      EffectListener effectListener
    • isNewEffect

      boolean isNewEffect
    • startTimeLabel

      JLabel startTimeLabel
    • endTimeLabel

      JLabel endTimeLabel
    • startColorLabel

      JLabel startColorLabel
    • endColorLabel

      JLabel endColorLabel
    • delayLabel

      JLabel delayLabel
    • durationLabel

      JLabel durationLabel
    • timeoutLabel

      JLabel timeoutLabel
    • staticColorLabel

      JLabel staticColorLabel
    • waveColorLabel

      JLabel waveColorLabel
    • color1Label

      JLabel color1Label
    • color2Label

      JLabel color2Label
    • rateLabel

      JLabel rateLabel
    • speedLabel

      JLabel speedLabel
    • angleLabel

      JLabel angleLabel
    • startColorBtn

      JButton startColorBtn
    • endColorBtn

      JButton endColorBtn
    • delayField

      JTextField delayField
    • durationField

      JTextField durationField
    • timeoutField

      JTextField timeoutField
    • speedField

      JTextField speedField
    • angleField

      JTextField angleField
    • applyBtn

      JButton applyBtn
    • deleteBtn

      JButton deleteBtn
    • previewOnHardwareBtn

      JButton previewOnHardwareBtn
    • stopPreviewBtn

      JButton stopPreviewBtn
    • batteryEstLabel

      JLabel batteryEstLabel
    • colorButtons

      ArrayList<JButton> colorButtons
    • durationTypeOptions

      String[] durationTypeOptions
    • durationTypeSelect

      JComboBox<String> durationTypeSelect
    • durationType

      String durationType
    • panelComponents

      ArrayList<JComponent[]> panelComponents
    • addShapeLabel

      JLabel addShapeLabel
    • addShapeBtn

      JButton addShapeBtn
    • showGridIndex

      int showGridIndex
    • hMovementField

      JTextField hMovementField
    • vMovementField

      JTextField vMovementField
    • wholePerformer

      JCheckBox wholePerformer
    • rotationOptions

      String[] rotationOptions
    • rotationSelect

      JComboBox<String> rotationSelect
    • directionOptions

      String[] directionOptions
    • directionSelect

      JComboBox<String> directionSelect
    • varyBrightnessBox

      JCheckBox varyBrightnessBox
    • varyColorBox

      JCheckBox varyColorBox
    • varyTimeBox

      JCheckBox varyTimeBox
    • fadeBox

      JCheckBox fadeBox
    • colorVarianceField

      JTextField colorVarianceField
    • minBrightnessField

      JTextField minBrightnessField
    • maxBrightnessField

      JTextField maxBrightnessField
    • maxTimeField

      JTextField maxTimeField
    • minTimeField

      JTextField minTimeField
    • placeholderLabel

      private JLabel placeholderLabel
    • effectType

      private EffectList effectType
    • standalonePreview

      private boolean standalonePreview
  • Constructor Details

    • EffectGUI

      public EffectGUI(Effect effect, long startTime, EffectListener effectListener, EffectList effectType, boolean isNew, int index)
      Parameters:
      effect - The current effect, as it exists. Passed in null if it doesn't exist.
      startTime - In the case that no effect exists for the performer at the given time, we still need the current time for gui display.
    • EffectGUI

      public EffectGUI(Effect effect, long startTime, EffectListener effectListener, EffectList effectType, boolean isNew, int index, boolean standalonePreview)
      Parameters:
      standalonePreview - When true, hides the "Create effect"/"Update effect" and "Delete effect" buttons, since the standalone Preview Effect window isn't meant to commit/delete effects directly.
    • EffectGUI

      public EffectGUI(String placeholderText)
      This alternative constructor can deliver a placeholder panel with instructions about working with effects. You can call this when the program is first started and the project isn't loaded or synced.
  • Method Details

    • setupGUI

      private void setupGUI()
    • setupComponent

      private void setupComponent(JComponent component, int width, int height)
    • createCheckBoxPanel

      private JPanel createCheckBoxPanel(JCheckBox checkBox)
    • addComponentPair

      private void addComponentPair(JComponent comp1, JComponent comp2)
    • setupNoiseGUI

      private void setupNoiseGUI()
    • setupGridGUI

      private void setupGridGUI()
    • setupChaseGUI

      private void setupChaseGUI()
    • setupWaveGUI

      private void setupWaveGUI()
    • setupCircleChaseGUI

      private void setupCircleChaseGUI()
    • setupRippleGUI

      private void setupRippleGUI()
    • setupStaticColorGUI

      private void setupStaticColorGUI()
    • setupFadeGUI

      private void setupFadeGUI()
    • setupAlternatingColorGUI

      private void setupAlternatingColorGUI()
    • getDocumentListener

      private DocumentListener getDocumentListener()
    • calcBattery

      private double calcBattery(int R, int G, int B, double secondsDuration)
    • loadEffectToGUI

      private void loadEffectToGUI(Effect effect)
    • convertMsecDurationToCounts

      private int convertMsecDurationToCounts(long startTimeMsec, long durationMsec)
    • liveUpdateEndTime

      private void liveUpdateEndTime()
    • getEffectPanel

      public JPanel getEffectPanel()
    • getLivePreviewEffect

      public Effect getLivePreviewEffect()
      Syncs current field values into the working effect and returns it, for external live-preview use (e.g. an animated timeline swatch). Invalid/mid-edit field text is ignored, keeping the last valid snapshot rather than throwing.
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • showColorChooserWithPreview

      private Color showColorChooserWithPreview(String title, Color initialColor)
      Shows a color chooser with a "Preview on Hardware" button next to OK/Cancel/Reset, letting the user check a color on a connected Receiver before committing to it. Built manually (rather than JColorChooser.createDialog(java.awt.Component, java.lang.String, boolean, javax.swing.JColorChooser, java.awt.event.ActionListener, java.awt.event.ActionListener)) so that button can sit in the same row instead of a separate nested panel. The preview is always stopped when the picker closes.
    • applyToEffectMod

      private void applyToEffectMod()