|
@@ -63,6 +63,8 @@ public class LinkCreationPanel extends JScrollPane{
|
|
|
}
|
|
|
|
|
|
private void initializePanel() {
|
|
|
+ LinkedList<Class<? extends Link>> availableLinks = controller.getControllerImport().getLinks();
|
|
|
+
|
|
|
setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
|
|
this.setPreferredSize(new Dimension(600, 170 + devices.length*20));
|
|
|
content = new JPanel();
|
|
@@ -98,22 +100,31 @@ public class LinkCreationPanel extends JScrollPane{
|
|
|
content.add(lblLinkType);
|
|
|
|
|
|
JComboBox<String> cmbLinkType = new JComboBox<String>();
|
|
|
- cmbLinkType.addItem("SimpleLink");
|
|
|
- cmbLinkType.addItem("testZigbee");
|
|
|
- cmbLinkType.setBounds(162, 68, 116, 22);
|
|
|
+ for(Class<? extends Link> linkClass:availableLinks){
|
|
|
+ cmbLinkType.addItem(linkClass.getSimpleName());
|
|
|
+ }
|
|
|
+ int linkCounter = -1;
|
|
|
+ for(Class<? extends Link> linkClass:availableLinks){
|
|
|
+ linkCounter++;
|
|
|
+ if(newLink.getClass().equals(linkClass))
|
|
|
+ cmbLinkType.setSelectedIndex(linkCounter);
|
|
|
+ }
|
|
|
+ cmbLinkType.setBounds(162, 68, 216, 22);
|
|
|
content.add(cmbLinkType);
|
|
|
cmbLinkType.addActionListener(new ActionListener() {
|
|
|
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
- System.out.println("WARNING: No further Link Types implemented");
|
|
|
+ System.out.println("WARNING: Link Type Changing not implemented");
|
|
|
}
|
|
|
});
|
|
|
|
|
|
JButton btnImportLink = new JButton("Import Link Type");
|
|
|
- btnImportLink.setBounds(290, 67, 144, 25);
|
|
|
+ btnImportLink.setBounds(390, 67, 144, 25);
|
|
|
content.add(btnImportLink);
|
|
|
- btnImportLink.addActionListener(a->System.out.println("WARNING: No import yet"));
|
|
|
+ btnImportLink.addActionListener(a->{
|
|
|
+ System.out.println("WARNING: No import yet");
|
|
|
+ });
|
|
|
|
|
|
JButton btnCreate = new JButton("Verify and Create");
|
|
|
btnCreate.setBounds(121, 103, 206, 25);
|