schon richtig schön mit daten holen

This commit is contained in:
da
2015-11-07 00:19:11 +01:00
parent 73c595806f
commit a9739f57f8
4 changed files with 166 additions and 31 deletions
+56 -21
View File
@@ -1,49 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.ixab.GUI.StreamChooserMenu">
<grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="3" column-count="10" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="5" column-count="8" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="556" height="400"/>
<xy x="20" y="20" width="650" height="400"/>
</constraints>
<properties/>
<properties>
<minimumSize width="650" height="130"/>
<preferredSize width="650" height="130"/>
</properties>
<border type="none"/>
<children>
<component id="cb567" class="javax.swing.JComboBox" binding="comboBox1" default-binding="true">
<component id="cb567" class="javax.swing.JComboBox" binding="comboBoxStreams">
<constraints>
<grid row="0" column="1" row-span="1" col-span="6" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="1" row-span="1" col-span="4" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="c34b7" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Zuschauer:"/>
</properties>
</component>
<component id="65a1f" class="javax.swing.JLabel">
<component id="65a1f" class="javax.swing.JLabel" binding="labelStreamViewers">
<constraints>
<grid row="1" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="nyi"/>
<text value=""/>
</properties>
</component>
<hspacer id="a6e26">
<constraints>
<grid row="1" column="5" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" column="4" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="35b31" class="javax.swing.JComboBox" binding="comboBox2" default-binding="true">
<constraints>
<grid row="0" column="9" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="7" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="afcf8" class="javax.swing.JTextField" binding="textField1" default-binding="true">
<constraints>
<grid row="2" column="2" row-span="1" col-span="7" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="4" column="1" row-span="1" col-span="6" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
@@ -51,7 +54,7 @@
</component>
<component id="a3649" class="javax.swing.JButton" binding="hinzufügenButton" default-binding="true">
<constraints>
<grid row="2" column="9" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="4" column="7" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Hinzufügen"/>
@@ -59,7 +62,7 @@
</component>
<component id="16c11" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Neuer Stream:"/>
@@ -75,7 +78,7 @@
</component>
<component id="bbe9d" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="39" height="14"/>
</grid>
</constraints>
@@ -83,17 +86,17 @@
<text value="Status:"/>
</properties>
</component>
<component id="e40fa" class="javax.swing.JLabel">
<component id="e40fa" class="javax.swing.JLabel" binding="labelStreamStatus">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="nyi"/>
<text value=""/>
</properties>
</component>
<component id="be49e" class="javax.swing.JButton" binding="streamAbspielenButton" default-binding="true">
<constraints>
<grid row="1" column="9" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" column="7" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Stream abspielen"/>
@@ -101,7 +104,7 @@
</component>
<component id="3b81f" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="8" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Qualität:"/>
@@ -109,12 +112,44 @@
</component>
<component id="7c5a1" class="javax.swing.JButton" binding="entfernenButton" default-binding="true">
<constraints>
<grid row="0" column="7" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="5" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Entfernen"/>
</properties>
</component>
<component id="a5f20" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Streamtitel:"/>
</properties>
</component>
<component id="2a9d4" class="javax.swing.JLabel" binding="labelStreamTitle">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
<component id="a1140" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Kategorie:"/>
</properties>
</component>
<component id="dcbec" class="javax.swing.JLabel" binding="labelStreamGame">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
</children>
</grid>
</form>
+16 -9
View File
@@ -1,11 +1,9 @@
package com.ixab.GUI;
import com.ixab.*;
import com.ixab.ConfigHandling.Config;
import com.ixab.ConfigHandling.ConfigFileIOHandler;
import com.ixab.ConfigHandling.ConfigFileInstanceHandler;
import com.ixab.StreamHandling.StreamInfo;
import com.ixab.StreamHandling.StreamOpener;
import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils;
import javax.swing.*;
import java.awt.event.ActionEvent;
@@ -15,19 +13,23 @@ import java.awt.event.KeyEvent;
public class StreamChooserMenu {
private JPanel panel;
private JComboBox comboBox1;
private JComboBox comboBoxStreams;
private JComboBox comboBox2;
private JTextField textField1;
private JButton hinzufügenButton;
private JButton streamAbspielenButton;
private JButton entfernenButton;
private JLabel labelStreamStatus;
private JLabel labelStreamViewers;
private JLabel labelStreamTitle;
private JLabel labelStreamGame;
public StreamChooserMenu() {
this.initComboBoxes();
streamAbspielenButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
StreamOpener so = new StreamOpener(ConfigFileInstanceHandler.getConfig(), ConfigFileInstanceHandler.getConfig().getStreams().indexOf(comboBox1.getSelectedItem()), comboBox2.getSelectedItem().toString());
StreamOpener so = new StreamOpener(ConfigFileInstanceHandler.getConfig(), ConfigFileInstanceHandler.getConfig().getStreams().indexOf(comboBoxStreams.getSelectedItem()), comboBox2.getSelectedItem().toString());
so.start();
}
});
@@ -40,15 +42,20 @@ public class StreamChooserMenu {
entfernenButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ConfigFileInstanceHandler.getConfig().removeStream(comboBox1.getSelectedItem());
ConfigFileInstanceHandler.getConfig().removeStream(comboBoxStreams.getSelectedItem());
ConfigFileIOHandler.save(ConfigFileInstanceHandler.getConfig());
initStreamsComboBox();
}
});
comboBox1.addActionListener(new ActionListener() {
comboBoxStreams.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO: implement twitch api and update stream info
StreamInfo.getStreamInfo(comboBoxStreams.getSelectedItem().toString());
labelStreamStatus.setText(StreamInfo.getStatus());
labelStreamGame.setText(StreamInfo.getGame());
labelStreamViewers.setText(StreamInfo.getViewers());
labelStreamTitle.setText(StreamInfo.getTitle());
}
});
textField1.addKeyListener(new KeyAdapter() {
@@ -72,10 +79,10 @@ public class StreamChooserMenu {
initStreamsComboBox();
}
private void initStreamsComboBox() {
comboBox1.removeAllItems();
comboBoxStreams.removeAllItems();
for (String streamName :
ConfigFileInstanceHandler.getConfig().getStreams()) {
comboBox1.addItem(streamName);
comboBoxStreams.addItem(streamName);
}
}
private void initQualityComboBox() {