feat(doc): F4.4a devices and cables in the document, undo per person; NewDeviceRun

A new device is what Java's palette makes, measured with the new oracle
NewDeviceRun (every kind and router size saved as FILIUS saves). Devices
move to whole pixels and go with their cables; a cable takes the first free
port, a home router's WAN port unless its LAN port is asked for, a wireless
host only joins a switch, two devices join once, each refusal named with
Java's message. Each person's undo takes back their own changes only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 09:18:14 +00:00
co-authored by Claude Opus 5.5
parent 63273916b5
commit 27ab7a1f49
9 changed files with 595 additions and 9 deletions
+62
View File
@@ -0,0 +1,62 @@
// Makes every kind of device as FILIUS' palette makes it
// (GUIContainer.neuerKnoten: the constructor, a router's number of interfaces
// from its dialog, the label, setProperty, which opens the device's settings)
// and saves them in one project, as FILIUS saves (SzenarioVerwaltung.speichern).
// The editor's new devices must be what this file holds once read
// (packages/doc/test/devices.test.ts).
//
// NewDeviceRun <out.fls>
//
// In the file's order: Rechner, Notebook, Switch, Vermittlungsrechner with 2
// to 8 interfaces, Gateway (Heimrouter), Modem.
import filius.gui.GUIContainer;
import filius.gui.netzwerksicht.GUIDesignSidebar;
import filius.gui.netzwerksicht.GUIKabelItem;
import filius.gui.netzwerksicht.GUIKnotenItem;
import filius.gui.netzwerksicht.JSidebarButton;
import filius.gui.netzwerksicht.GUIDocuItem;
import filius.hardware.knoten.Gateway;
import filius.hardware.knoten.Knoten;
import filius.hardware.knoten.Modem;
import filius.hardware.knoten.Notebook;
import filius.hardware.knoten.Rechner;
import filius.hardware.knoten.Switch;
import filius.hardware.knoten.Vermittlungsrechner;
import filius.rahmenprogramm.SzenarioVerwaltung;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ImageIcon;
public class NewDeviceRun {
static void add(List<GUIKnotenItem> items, Knoten device, String icon, int x, int y) {
JSidebarButton label = new JSidebarButton(new ImageIcon(NewDeviceRun.class.getResource("/" + icon + ".png")), device.holeHardwareTyp());
label.setBounds(x, y, label.getWidth(), label.getHeight());
label.initTextAndUpdateLocation(device.holeAnzeigeName());
GUIKnotenItem item = new GUIKnotenItem();
item.setKnoten(device);
item.setImageLabel(label);
GUIContainer.getGUIContainer().setProperty(device);
items.add(item);
}
public static void main(String[] args) throws Exception {
GUIContainer.getGUIContainer();
List<GUIKnotenItem> items = new ArrayList<>();
add(items, new Rechner(), GUIDesignSidebar.RECHNER, 100, 100);
add(items, new Notebook(), GUIDesignSidebar.NOTEBOOK, 300, 100);
add(items, new Switch(), GUIDesignSidebar.SWITCH, 500, 100);
for (int interfaces = 2; interfaces <= 8; interfaces++) {
Vermittlungsrechner router = new Vermittlungsrechner();
router.setzeAnzahlAnschluesse(interfaces);
add(items, router, GUIDesignSidebar.VERMITTLUNGSRECHNER, 100 * interfaces, 300);
}
add(items, new Gateway(), GUIDesignSidebar.GATEWAY, 100, 500);
add(items, new Modem(), GUIDesignSidebar.MODEM, 300, 500);
if (!SzenarioVerwaltung.getInstance().speichern(args[0], items, new ArrayList<GUIKabelItem>(), new ArrayList<GUIDocuItem>())) {
throw new IllegalStateException("FILIUS could not save " + args[0]);
}
System.exit(0);
}
}