-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switched from javafx to swing, implemented persistance layer
- Loading branch information
Showing
10 changed files
with
555 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>over9000</groupId> | ||
<artifactId>Skadi</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<name>Skadi</name> | ||
<description>livestreamer java gui</description> | ||
|
||
<dependencies><dependency> | ||
<groupId>javafx</groupId> | ||
<artifactId>jfxrt</artifactId> | ||
<version>${java.version}</version> | ||
<scope>system</scope> | ||
<systemPath>${java.home}/lib/jfxrt.jar</systemPath> | ||
</dependency></dependencies> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>over9000</groupId> | ||
<artifactId>Skadi</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<name>Skadi</name> | ||
<description>livestreamer java gui</description> | ||
|
||
<organization> | ||
<name>s1mpl3x</name> | ||
</organization> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.0</version> | ||
<configuration> | ||
<source>1.7</source> | ||
<target>1.7</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/eu/over9000/skadi/gui/ChannelDataListModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package eu.over9000.skadi.gui; | ||
|
||
import javax.swing.AbstractListModel; | ||
|
||
import eu.over9000.skadi.SkadiMain; | ||
import eu.over9000.skadi.channel.ChannelInstance; | ||
|
||
public class ChannelDataListModel extends AbstractListModel<ChannelInstance> { | ||
|
||
/** | ||
* serialVersionUID | ||
*/ | ||
private static final long serialVersionUID = 7576558662916716790L; | ||
|
||
@Override | ||
public int getSize() { | ||
return SkadiMain.getInstance().getChannels().size(); | ||
} | ||
|
||
@Override | ||
public ChannelInstance getElementAt(final int index) { | ||
return SkadiMain.getInstance().getChannels().values().toArray(new ChannelInstance[0])[index]; | ||
} | ||
|
||
public void handleUpdate() { | ||
this.fireContentsChanged(this, 0, this.getSize()); | ||
} | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/eu/over9000/skadi/gui/ChannelDataListRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package eu.over9000.skadi.gui; | ||
|
||
import java.awt.Component; | ||
|
||
import javax.swing.JLabel; | ||
import javax.swing.JList; | ||
import javax.swing.JPanel; | ||
import javax.swing.ListCellRenderer; | ||
|
||
import eu.over9000.skadi.channel.ChannelInstance; | ||
|
||
public class ChannelDataListRenderer implements ListCellRenderer<ChannelInstance> { | ||
|
||
private final ChannelDataListDisplayer displayer = new ChannelDataListDisplayer(); | ||
|
||
@Override | ||
public Component getListCellRendererComponent(final JList<? extends ChannelInstance> list, | ||
final ChannelInstance value, final int index, final boolean isSelected, final boolean cellHasFocus) { | ||
return this.displayer.renderFor(list, value, isSelected); | ||
} | ||
|
||
private class ChannelDataListDisplayer extends JPanel { | ||
|
||
/** | ||
* serialVersionUID | ||
*/ | ||
private static final long serialVersionUID = 3574128645388761068L; | ||
|
||
private final JLabel labelURL; | ||
|
||
public ChannelDataListDisplayer() { | ||
this.labelURL = new JLabel(); | ||
|
||
this.add(this.labelURL); | ||
} | ||
|
||
public Component renderFor(final JList<? extends ChannelInstance> list, final ChannelInstance value, | ||
final boolean isSelected) { | ||
this.labelURL.setText(value.getURL()); | ||
|
||
if (isSelected) { | ||
this.setBackground(list.getSelectionBackground()); | ||
this.setForeground(list.getSelectionForeground()); | ||
} else { | ||
this.setBackground(list.getBackground()); | ||
this.setForeground(list.getForeground()); | ||
} | ||
return this; | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.