projects
/
sonitus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f761d81
)
Add name to controllers.
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Sun, 26 May 2013 12:22:49 +0000
(14:22 +0200)
committer
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Mon, 27 May 2013 20:54:38 +0000
(22:54 +0200)
src/main/java/net/pterodactylus/sonitus/data/Controller.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sonitus/data/controller/AbstractController.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sonitus/data/controller/Fader.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sonitus/data/controller/Switch.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sonitus/data/sink/AudioSink.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sonitus/gui/FaderPanel.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sonitus/gui/SwitchPanel.java
patch
|
blob
|
history
diff --git
a/src/main/java/net/pterodactylus/sonitus/data/Controller.java
b/src/main/java/net/pterodactylus/sonitus/data/Controller.java
index
afc92c0
..
6f9de5b
100644
(file)
--- a/
src/main/java/net/pterodactylus/sonitus/data/Controller.java
+++ b/
src/main/java/net/pterodactylus/sonitus/data/Controller.java
@@
-25,6
+25,13
@@
package net.pterodactylus.sonitus.data;
public interface Controller<V extends Comparable<V>> {
/**
public interface Controller<V extends Comparable<V>> {
/**
+ * Returns the name of this controller.
+ *
+ * @return The name of this controller
+ */
+ String name();
+
+ /**
* Returns the minimum value of this controller.
*
* @return The minimum value of this controller
* Returns the minimum value of this controller.
*
* @return The minimum value of this controller
diff --git
a/src/main/java/net/pterodactylus/sonitus/data/controller/AbstractController.java
b/src/main/java/net/pterodactylus/sonitus/data/controller/AbstractController.java
index
c091573
..
b355a89
100644
(file)
--- a/
src/main/java/net/pterodactylus/sonitus/data/controller/AbstractController.java
+++ b/
src/main/java/net/pterodactylus/sonitus/data/controller/AbstractController.java
@@
-30,6
+30,9
@@
import net.pterodactylus.sonitus.data.Controller;
*/
public abstract class AbstractController<V extends Comparable<V>> implements Controller<V> {
*/
public abstract class AbstractController<V extends Comparable<V>> implements Controller<V> {
+ /** The name of this controller. */
+ private final String name;
+
/** The minimum value of this controller. */
private final V minimum;
/** The minimum value of this controller. */
private final V minimum;
@@
-45,6
+48,8
@@
public abstract class AbstractController<V extends Comparable<V>> implements Con
/**
* Creates a new abstract controller.
*
/**
* Creates a new abstract controller.
*
+ * @param name
+ * The name of the controller
* @param minimum
* The minimum value of the controller
* @param maximum
* @param minimum
* The minimum value of the controller
* @param maximum
@@
-53,9
+58,9
@@
public abstract class AbstractController<V extends Comparable<V>> implements Con
* {@code true} if this controller has a “center” position, {@code false}
* otherwise
* @param currentValue
* {@code true} if this controller has a “center” position, {@code false}
* otherwise
* @param currentValue
- * The current value of this controller
*/
*/
- public AbstractController(V minimum, V maximum, boolean centered, V currentValue) {
+ public AbstractController(String name, V minimum, V maximum, boolean centered, V currentValue) {
+ this.name = name;
this.minimum = minimum;
this.maximum = maximum;
this.centered = centered;
this.minimum = minimum;
this.maximum = maximum;
this.centered = centered;
@@
-67,6
+72,11
@@
public abstract class AbstractController<V extends Comparable<V>> implements Con
//
@Override
//
@Override
+ public String name() {
+ return name;
+ }
+
+ @Override
public V minimum() {
return minimum;
}
public V minimum() {
return minimum;
}
diff --git
a/src/main/java/net/pterodactylus/sonitus/data/controller/Fader.java
b/src/main/java/net/pterodactylus/sonitus/data/controller/Fader.java
index
0f78ea2
..
279da03
100644
(file)
--- a/
src/main/java/net/pterodactylus/sonitus/data/controller/Fader.java
+++ b/
src/main/java/net/pterodactylus/sonitus/data/controller/Fader.java
@@
-26,19
+26,26
@@
import net.pterodactylus.sonitus.data.Controller;
*/
public abstract class Fader extends AbstractController<Double> {
*/
public abstract class Fader extends AbstractController<Double> {
- /** Creates a new fader that is at maximum position. */
- public Fader() {
- this(1.0);
+ /**
+ * Creates a new fader that is at maximum position.
+ *
+ * @param name
+ * The name of the fader
+ */
+ public Fader(String name) {
+ this(name, 1.0);
}
/**
* Creates a new fader that is at the given position.
*
}
/**
* Creates a new fader that is at the given position.
*
+ * @param name
+ * The name of the fader
* @param currentValue
* The current value of the fader (from {@code 0.0} to {@code 1.0})
*/
* @param currentValue
* The current value of the fader (from {@code 0.0} to {@code 1.0})
*/
- public Fader(Double currentValue) {
- super(0.0, 1.0, false, currentValue);
+ public Fader(
String name,
Double currentValue) {
+ super(
name,
0.0, 1.0, false, currentValue);
}
}
}
}
diff --git
a/src/main/java/net/pterodactylus/sonitus/data/controller/Switch.java
b/src/main/java/net/pterodactylus/sonitus/data/controller/Switch.java
index
cb853a3
..
1b997d4
100644
(file)
--- a/
src/main/java/net/pterodactylus/sonitus/data/controller/Switch.java
+++ b/
src/main/java/net/pterodactylus/sonitus/data/controller/Switch.java
@@
-24,19
+24,26
@@
package net.pterodactylus.sonitus.data.controller;
*/
public abstract class Switch extends AbstractController<Boolean> {
*/
public abstract class Switch extends AbstractController<Boolean> {
- /** Creates a new switch that is off. */
- public Switch() {
- this(false);
+ /**
+ * Creates a new switch that is off.
+ *
+ * @param name
+ * The name of the switch
+ */
+ public Switch(String name) {
+ this(name, false);
}
/**
* Creates a new switch with the given state.
*
}
/**
* Creates a new switch with the given state.
*
+ * @param name
+ * The name of the switch
* @param active
* The state of the switch
*/
* @param active
* The state of the switch
*/
- public Switch(boolean active) {
- super(false, true, false, active);
+ public Switch(
String name,
boolean active) {
+ super(
name,
false, true, false, active);
}
}
}
}
diff --git
a/src/main/java/net/pterodactylus/sonitus/data/sink/AudioSink.java
b/src/main/java/net/pterodactylus/sonitus/data/sink/AudioSink.java
index
fdcbbd6
..
611dcd9
100644
(file)
--- a/
src/main/java/net/pterodactylus/sonitus/data/sink/AudioSink.java
+++ b/
src/main/java/net/pterodactylus/sonitus/data/sink/AudioSink.java
@@
-64,7
+64,7
@@
public class AudioSink implements Sink {
/** Creates a new audio sink. */
public AudioSink() {
super();
/** Creates a new audio sink. */
public AudioSink() {
super();
- volumeFader = new Fader() {
+ volumeFader = new Fader(
"Volume"
) {
@Override
protected void valueSet(Double value) {
@Override
protected void valueSet(Double value) {
@@
-74,7
+74,7
@@
public class AudioSink implements Sink {
}
}
};
}
}
};
- muteSwitch = new Switch() {
+ muteSwitch = new Switch(
"Mute"
) {
private float previousValue;
private float previousValue;
diff --git
a/src/main/java/net/pterodactylus/sonitus/gui/FaderPanel.java
b/src/main/java/net/pterodactylus/sonitus/gui/FaderPanel.java
index
68ca774
..
b37fec6
100644
(file)
--- a/
src/main/java/net/pterodactylus/sonitus/gui/FaderPanel.java
+++ b/
src/main/java/net/pterodactylus/sonitus/gui/FaderPanel.java
@@
-48,7
+48,7
@@
public class FaderPanel extends JPanel {
setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
/* create label. */
setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
/* create label. */
- JLabel label = new JLabel(
"Volume"
);
+ JLabel label = new JLabel(
fader.name()
);
add(label, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
/* create fader labels. */
add(label, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
/* create fader labels. */
diff --git
a/src/main/java/net/pterodactylus/sonitus/gui/SwitchPanel.java
b/src/main/java/net/pterodactylus/sonitus/gui/SwitchPanel.java
index
40ba4d8
..
5ffd8a2
100644
(file)
--- a/
src/main/java/net/pterodactylus/sonitus/gui/SwitchPanel.java
+++ b/
src/main/java/net/pterodactylus/sonitus/gui/SwitchPanel.java
@@
-47,7
+47,7
@@
public class SwitchPanel extends JPanel {
setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
/* create label. */
setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
/* create label. */
- JLabel label = new JLabel(
"Mute"
);
+ JLabel label = new JLabel(
switchController.name()
);
add(label, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
/* create checkbox. */
add(label, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
/* create checkbox. */