Skip to content
This repository was archived by the owner on Nov 7, 2026. It is now read-only.

Commit 78b7dd9

Browse files
Web 0.10.0: VisuObject wie Eclipse und Astah (#178)
Enthält #175, #176, #177: Rolle an der Linie, Werkzeugleiste wie Astah, Navigierbarkeit je Ende, Package Explorer, Workspace-Ordner. Claude-Session: https://claude.ai/code/session_01Ugz28SuLhbcLydch8nbzdQ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8b415d6 commit 78b7dd9

31 files changed

Lines changed: 1433 additions & 359 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is loosely inspired by Keep a Changelog.
88

99
### Added
1010

11+
- **Web 0.10.0, VisuObject like Eclipse and Astah:** an Astah-style toolbar above the class diagram to drag classes and interfaces onto the canvas and draw association, aggregation, composition, inheritance and realization between two classes. Attributes whose type is another class are shown only as a role on the line (with visibility, e.g. `-meineKatzen`), not inside the class box. Object inspector for a relationship: name with reading direction taken from the drag direction (“reverse” button), navigability at each end (navigable = arrowhead, non-navigable = ×, unspecified = open), role and multiplicity at both ends; making the other end navigable adds an attribute named after the role. Inheritance only via the arrow (no “inherits from” choice in the class box). The left area is called “Package Explorer”. Workspace folder like Eclipse (Chrome/Edge, File System Access API): create “VisuObject-Workspace” or open an existing one, one folder per project with `src/package/Class.java`, `visuobject.json` (UML extras and box positions), `.project` and `.classpath` for importing into Eclipse; all projects listed in the Package Explorer, Ctrl+S saves, unsaved tabs show ● instead of × like VS Code, ZIP download stays (#175, #176, #177, #178).
1112
- **Web 0.9.0, VisuObject projects and relationships:** a project with packages like in Eclipse: a package explorer on the left (project › src › packages › files › classes › attributes/methods), every level collapsible, one file per class, `package` line follows the folder, UML package frames in the class diagram, open and save as ZIP (`Name/src/package/Class.java`, fflate, MIT). Layout like WebGoatCode: flat areas with a grey header bar, “–” collapses an area to a strip with its name, splitters between the areas, file tabs above the code. Relationships are drawn by dragging from a handle on the selected class to another class (association, aggregation, composition, inheritance, realization); an object inspector sets kind, name with reading direction, navigability (one way, both ways, no arrow), role and multiplicity at both ends. Java parts go into the code (attribute, list type, imports, `extends`/`implements`), UML-only details into `visuobject.json` in the ZIP. Hollow inheritance triangle; roles at the same distance as multiplicities. The website's VisuStruct links always open VisuStruct (#171, #172, #173).
1213
- **Web 0.8.0, VisuObject:** a third world next to VisuStruct and VisuBot, for object-oriented programming from year 12 (`?visuobject`, petrol colours). On the left the Java code, on the right the class diagram, both linked: typing classes builds the diagram (attributes, methods, constructors, `static`, `abstract`, inheritance, interfaces, associations with multiplicity from attributes like `ArrayList<Hund>`); adding classes, interfaces, attributes and methods in the diagram, double-clicking to change them in UML notation (`- name: String`, `+ bark(): void`), choosing the superclass or making a class abstract writes Java at exactly that spot, method bodies and comments stay. Plan for the next stages: `docs/visuobject/PLAN.md` (#167).
1314
- **Web 0.7.0, VisuBot upload to the mBot2:** a new button “⬆ Upload” (Chrome/Edge, USB) saves the finished program on the mBot2, like uploading in mBlock. Then it drives without a cable, for example through a maze: after switching on, the screen shows “A = Start”, and button A starts the program. VisuStruct translates the structogram or Java code into MicroPython for the CyberPi in the background (case selection as if/elif, Java string concatenation with numbers). The upload frames are identical to mBlock 5's (protocol from cyberpi-uploader, MIT). New step “Driving without a cable” in VisuBot lesson 2 and in the reference.

‎web/package-lock.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎web/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "visustruct-web",
33
"private": true,
4-
"version": "0.9.0",
4+
"version": "0.10.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

‎web/src/core/umlRelations.ts‎

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@
99
import { associationTarget, relations, type UmlClass, type UmlMember } from './classModel'
1010

1111
export type AssocKind = 'association' | 'aggregation' | 'composition'
12+
/** Navigierbarkeit eines Endes: Pfeilspitze, Kreuz × oder ohne Kennzeichnung (offen). */
13+
export type EndNav = 'navigable' | 'non-navigable' | 'unspecified'
1214

1315
/** Zusatz aus UML zu einem Attribut. */
1416
export interface AssocInfo {
1517
kind?: AssocKind
1618
name?: string
17-
/** Leserichtung des Namens: von der Klasse mit dem Attribut zum Typ oder zurück. */
19+
/** Leserichtung des Namens: von der Klasse mit dem Attribut zum Typ (Zugrichtung) oder zurück. */
1820
reading?: 'forward' | 'backward'
19-
/** `false`: Linie ohne Pfeilspitze (Richtung offen). */
21+
/** Ende beim Typ des Attributs; ohne Angabe navigierbar. */
22+
targetEnd?: EndNav
23+
/** Ende bei der Klasse mit dem Attribut, wenn es dort kein Gegen-Attribut gibt; ohne Angabe offen. */
24+
sourceEnd?: EndNav
25+
/** Alte Fassung: `false` hieß „ohne Pfeil“. */
2026
navigable?: boolean
2127
multiplicity?: string
2228
sourceMultiplicity?: string
@@ -34,10 +40,10 @@ export interface Assoc {
3440
kind: AssocKind
3541
name?: string
3642
reading?: 'forward' | 'backward'
37-
/** Pfeil an `to`. */
38-
navigable: boolean
39-
/** Pfeil an `from`: `to` hat ein Attribut vom Typ `from`. */
40-
backNavigable: boolean
43+
/** Ende an `to`. */
44+
navTo: EndNav
45+
/** Ende an `from`: navigierbar, wenn `to` ein Attribut vom Typ `from` hat. */
46+
navFrom: EndNav
4147
role: string
4248
multiplicity: string
4349
sourceRole?: string
@@ -82,7 +88,7 @@ export function associations(classes: UmlClass[], uml: UmlInfo = {}): Assoc[] {
8288
// Was die ganze Beziehung betrifft (nicht nur ein Ende), entscheidet, welches Attribut vorne steht.
8389
const hasInfo = (x: (typeof raw)[number]) => {
8490
const i = uml[relationKey(x.cls.name, x.field.name)]
85-
return !!i && (i.kind !== undefined || i.name !== undefined || i.reading !== undefined || i.navigable !== undefined)
91+
return !!i && (i.kind !== undefined || i.name !== undefined || i.reading !== undefined || i.navigable !== undefined || i.targetEnd !== undefined || i.sourceEnd !== undefined)
8692
}
8793
for (const first of raw) {
8894
if (used.has(first)) continue
@@ -103,9 +109,10 @@ export function associations(classes: UmlClass[], uml: UmlInfo = {}): Assoc[] {
103109
to: r.target,
104110
kind: info.kind ?? 'association',
105111
name: info.name,
106-
reading: info.reading,
107-
navigable: info.navigable !== false,
108-
backNavigable: !!back,
112+
// Ein Name liest sich in Zugrichtung, solange niemand umdreht.
113+
reading: info.reading ?? (info.name ? 'forward' : undefined),
114+
navTo: info.targetEnd ?? (info.navigable === false ? 'unspecified' : 'navigable'),
115+
navFrom: back ? 'navigable' : (info.sourceEnd ?? 'unspecified'),
109116
role: r.field.name,
110117
multiplicity: multiplicity(info.multiplicity, r.many),
111118
sourceRole: back ? back.field.name : info.sourceRole,
@@ -152,7 +159,9 @@ export function withInfo(uml: UmlInfo, key: string, change: Partial<AssocInfo>):
152159
const next: AssocInfo = { ...uml[key], ...change }
153160
for (const k of Object.keys(next) as (keyof AssocInfo)[]) if (next[k] === undefined || next[k] === '') delete next[k]
154161
if (next.kind === 'association') delete next.kind
155-
if (next.navigable === true) delete next.navigable
162+
delete next.navigable
163+
if (next.targetEnd === 'navigable') delete next.targetEnd
164+
if (next.sourceEnd === 'unspecified') delete next.sourceEnd
156165
const out = { ...uml }
157166
if (Object.keys(next).length) out[key] = next
158167
else delete out[key]

‎web/src/i18n/de.strings‎

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,6 @@
411411
"web_visuobject_layout_tip" = "Alle Klassen automatisch anordnen: Oberklassen oben";
412412
"web_visuobject_add_field" = "Attribut";
413413
"web_visuobject_add_method" = "Methode";
414-
"web_visuobject_superclass" = "erbt von";
415-
"web_visuobject_no_superclass" = "keiner Klasse";
416414
"web_visuobject_abstract" = "abstrakt";
417415
"web_visuobject_delete_class" = "Klasse löschen";
418416
"web_visuobject_new_class_name" = "NeueKlasse";
@@ -428,6 +426,52 @@
428426
"web_visuobject_bad_line" = "„%@“ verstehe ich nicht. Beispiel: - name: String oder + bellen(): void";
429427
"web_visuobject_open_failed" = "Die Datei konnte nicht gelesen werden.";
430428
"web_visuobject_field_ph" = "- name: String";
429+
"web_visuobject_ws_title" = "Workspace-Ordner auf deinem Rechner";
430+
"web_visuobject_ws_question" = "Wo speicherst du deine Projekte?";
431+
"web_visuobject_ws_hint" = "Wie in Eclipse: ein Workspace-Ordner auf deinem Rechner, darin ein Ordner je Projekt mit src und den .java-Dateien.";
432+
"web_visuobject_ws_create" = "Ordner „%@“ anlegen";
433+
"web_visuobject_ws_open" = "Vorhandenen Workspace öffnen";
434+
"web_visuobject_ws_skip" = "Ohne Ordner (nur im Browser)";
435+
"web_visuobject_ws_choose" = "Workspace wählen";
436+
"web_visuobject_ws_reopen" = "Workspace „%@“ öffnen";
437+
"web_visuobject_ws_switch" = "Wechseln";
438+
"web_visuobject_ws_zip" = "ZIP";
439+
"web_visuobject_ws_zip_tip" = "Projekt als .zip herunterladen, z. B. zum Abgeben";
440+
"web_visuobject_ws_saved" = "Gespeichert in %@/%@";
441+
"web_visuobject_ws_created" = "Neues Projekt „%@“ im Workspace";
442+
"web_visuobject_ws_failed" = "Speichern im Workspace hat nicht geklappt: %@";
443+
"web_visuobject_ws_taken" = "Im Workspace gibt es schon ein Projekt „%@“.";
444+
"web_visuobject_ws_open_project" = "Projekt %@ öffnen";
445+
"web_visuobject_save_ws_tip" = "Im Workspace speichern (Strg+S)";
446+
"web_visuobject_unsaved" = "nicht gespeichert";
447+
"web_visuobject_rel_nav_navigable" = "navigierbar (Pfeil)";
448+
"web_visuobject_rel_nav_non-navigable" = "nicht navigierbar (Kreuz ×)";
449+
"web_visuobject_rel_nav_unspecified" = "nicht spezifiziert (offen)";
450+
"web_visuobject_rel_reading_flip" = "umdrehen";
451+
"web_visuobject_rel_reading_auto" = "Mit einem Namen liest sich die Beziehung in Zugrichtung.";
452+
"web_visuobject_tools" = "Werkzeuge";
453+
"web_visuobject_tool_select" = "Auswahl";
454+
"web_visuobject_tool_select_tip" = "Auswählen und verschieben";
455+
"web_visuobject_tool_class" = "Klasse";
456+
"web_visuobject_tool_class_tip" = "Klasse: auf die Fläche ziehen oder wählen und auf die Fläche klicken";
457+
"web_visuobject_tool_interface" = "Interface";
458+
"web_visuobject_tool_interface_tip" = "Interface: auf die Fläche ziehen oder wählen und auf die Fläche klicken";
459+
"web_visuobject_tool_association" = "Assoziation";
460+
"web_visuobject_tool_association_tip" = "Assoziation: von einer Klasse zur anderen ziehen (kennt)";
461+
"web_visuobject_tool_aggregation" = "Aggregation";
462+
"web_visuobject_tool_aggregation_tip" = "Aggregation: vom Ganzen zum Teil ziehen (hat, Teile leben weiter)";
463+
"web_visuobject_tool_composition" = "Komposition";
464+
"web_visuobject_tool_composition_tip" = "Komposition: vom Ganzen zum Teil ziehen (besteht aus, Teile gehören fest dazu)";
465+
"web_visuobject_tool_extends" = "Vererbung";
466+
"web_visuobject_tool_extends_tip" = "Vererbung: von der Unterklasse zur Oberklasse ziehen (erbt von)";
467+
"web_visuobject_tool_implements" = "Realisierung";
468+
"web_visuobject_tool_implements_tip" = "Realisierung: von der Klasse zum Interface ziehen (implementiert)";
469+
"web_visuobject_tool_pick_second" = "Jetzt die zweite Klasse anklicken (von %@ aus). Esc bricht ab.";
470+
"web_visuobject_tool_not_association" = "%@ ist ein Interface und kann keine Attribute haben. Zieh die Beziehung von einer Klasse aus.";
471+
"web_visuobject_tool_not_aggregation" = "%@ ist ein Interface und kann keine Attribute haben. Zieh die Beziehung von einer Klasse aus.";
472+
"web_visuobject_tool_not_composition" = "%@ ist ein Interface und kann keine Attribute haben. Zieh die Beziehung von einer Klasse aus.";
473+
"web_visuobject_tool_not_extends" = "%@ kann nicht von %@ erben: Klassen erben von Klassen, Interfaces von Interfaces. Für ein Interface nimm Realisierung.";
474+
"web_visuobject_tool_not_implements" = "%@ kann %@ nicht implementieren: Nur eine Klasse implementiert ein Interface.";
431475
"web_visuobject_inspector" = "Objektinspektor";
432476
"web_visuobject_inspector_close" = "Objektinspektor schließen";
433477
"web_visuobject_connect" = "Ziehen: Beziehung zu einer anderen Klasse";
@@ -438,8 +482,6 @@
438482
"web_visuobject_rel_implements" = "Realisierung (implementiert)";
439483
"web_visuobject_rel_extends_text" = "%@ erbt von %@ (extends im Code).";
440484
"web_visuobject_rel_implements_text" = "%@ implementiert das Interface %@ (implements im Code).";
441-
"web_visuobject_rel_undirected" = "%@ – %@ (ohne Pfeil)";
442-
"web_visuobject_rel_reading_none" = "keine";
443485
"web_visuobject_rel_kind" = "Art";
444486
"web_visuobject_rel_name" = "Name der Beziehung";
445487
"web_visuobject_rel_name_ph" = "z. B. besitzt";
@@ -468,9 +510,9 @@
468510
"web_visuobject_project_name" = "MeinProjekt";
469511
"web_visuobject_add_package_tip" = "Neues Package (Ordner) im Projekt anlegen";
470512
"web_visuobject_add_package" = "Package";
471-
"web_visuobject_explorer_show" = "Projektansicht zeigen";
472-
"web_visuobject_explorer_hide" = "Projektansicht einklappen";
473-
"web_visuobject_explorer" = "Projekt";
513+
"web_visuobject_explorer_show" = "Package Explorer zeigen";
514+
"web_visuobject_explorer_hide" = "Package Explorer einklappen";
515+
"web_visuobject_explorer" = "Package Explorer";
474516
"web_visuobject_save_tip" = "Projekt als .zip speichern: Projektname/src/package/Klasse.java";
475517
"web_visuobject_open_tip" = "Projekt öffnen (.zip wie aus Eclipse oder BlueJ) oder .java-Dateien ins Projekt holen";
476518
"web_visuobject_method_ph" = "+ bellen(): void";

‎web/src/i18n/en.strings‎

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,6 @@
411411
"web_visuobject_layout_tip" = "Arrange all classes automatically: superclasses at the top";
412412
"web_visuobject_add_field" = "Attribute";
413413
"web_visuobject_add_method" = "Method";
414-
"web_visuobject_superclass" = "extends";
415-
"web_visuobject_no_superclass" = "no class";
416414
"web_visuobject_abstract" = "abstract";
417415
"web_visuobject_delete_class" = "Delete class";
418416
"web_visuobject_new_class_name" = "NewClass";
@@ -428,6 +426,52 @@
428426
"web_visuobject_bad_line" = "I don’t understand “%@”. Example: - name: String or + bark(): void";
429427
"web_visuobject_open_failed" = "The file could not be read.";
430428
"web_visuobject_field_ph" = "- name: String";
429+
"web_visuobject_ws_title" = "Workspace folder on your computer";
430+
"web_visuobject_ws_question" = "Where do you keep your projects?";
431+
"web_visuobject_ws_hint" = "Like in Eclipse: a workspace folder on your computer with one folder per project, holding src and the .java files.";
432+
"web_visuobject_ws_create" = "Create folder “%@”";
433+
"web_visuobject_ws_open" = "Open existing workspace";
434+
"web_visuobject_ws_skip" = "Without a folder (browser only)";
435+
"web_visuobject_ws_choose" = "Choose workspace";
436+
"web_visuobject_ws_reopen" = "Open workspace “%@”";
437+
"web_visuobject_ws_switch" = "Switch";
438+
"web_visuobject_ws_zip" = "ZIP";
439+
"web_visuobject_ws_zip_tip" = "Download the project as .zip, e.g. to hand it in";
440+
"web_visuobject_ws_saved" = "Saved to %@/%@";
441+
"web_visuobject_ws_created" = "New project “%@” in the workspace";
442+
"web_visuobject_ws_failed" = "Saving to the workspace failed: %@";
443+
"web_visuobject_ws_taken" = "The workspace already has a project “%@”.";
444+
"web_visuobject_ws_open_project" = "Open project %@";
445+
"web_visuobject_save_ws_tip" = "Save to the workspace (Ctrl+S)";
446+
"web_visuobject_unsaved" = "not saved";
447+
"web_visuobject_rel_nav_navigable" = "navigable (arrow)";
448+
"web_visuobject_rel_nav_non-navigable" = "non-navigable (cross ×)";
449+
"web_visuobject_rel_nav_unspecified" = "unspecified (open)";
450+
"web_visuobject_rel_reading_flip" = "reverse";
451+
"web_visuobject_rel_reading_auto" = "With a name, the relationship reads in the direction you dragged.";
452+
"web_visuobject_tools" = "Tools";
453+
"web_visuobject_tool_select" = "Select";
454+
"web_visuobject_tool_select_tip" = "Select and move";
455+
"web_visuobject_tool_class" = "Class";
456+
"web_visuobject_tool_class_tip" = "Class: drag onto the canvas, or pick it and click on the canvas";
457+
"web_visuobject_tool_interface" = "Interface";
458+
"web_visuobject_tool_interface_tip" = "Interface: drag onto the canvas, or pick it and click on the canvas";
459+
"web_visuobject_tool_association" = "Association";
460+
"web_visuobject_tool_association_tip" = "Association: drag from one class to the other (knows)";
461+
"web_visuobject_tool_aggregation" = "Aggregation";
462+
"web_visuobject_tool_aggregation_tip" = "Aggregation: drag from the whole to the part (has, parts live on)";
463+
"web_visuobject_tool_composition" = "Composition";
464+
"web_visuobject_tool_composition_tip" = "Composition: drag from the whole to the part (consists of, parts belong to it)";
465+
"web_visuobject_tool_extends" = "Inheritance";
466+
"web_visuobject_tool_extends_tip" = "Inheritance: drag from the subclass to the superclass (extends)";
467+
"web_visuobject_tool_implements" = "Realization";
468+
"web_visuobject_tool_implements_tip" = "Realization: drag from the class to the interface (implements)";
469+
"web_visuobject_tool_pick_second" = "Now click the second class (from %@). Esc cancels.";
470+
"web_visuobject_tool_not_association" = "%@ is an interface and cannot have attributes. Drag the relationship from a class.";
471+
"web_visuobject_tool_not_aggregation" = "%@ is an interface and cannot have attributes. Drag the relationship from a class.";
472+
"web_visuobject_tool_not_composition" = "%@ is an interface and cannot have attributes. Drag the relationship from a class.";
473+
"web_visuobject_tool_not_extends" = "%@ cannot inherit from %@: classes extend classes, interfaces extend interfaces. For an interface use realization.";
474+
"web_visuobject_tool_not_implements" = "%@ cannot implement %@: only a class implements an interface.";
431475
"web_visuobject_inspector" = "Object inspector";
432476
"web_visuobject_inspector_close" = "Close object inspector";
433477
"web_visuobject_connect" = "Drag: relationship to another class";
@@ -438,8 +482,6 @@
438482
"web_visuobject_rel_implements" = "Realization (implements)";
439483
"web_visuobject_rel_extends_text" = "%@ inherits from %@ (extends in the code).";
440484
"web_visuobject_rel_implements_text" = "%@ implements the interface %@ (implements in the code).";
441-
"web_visuobject_rel_undirected" = "%@ – %@ (no arrow)";
442-
"web_visuobject_rel_reading_none" = "none";
443485
"web_visuobject_rel_kind" = "Kind";
444486
"web_visuobject_rel_name" = "Name of the relationship";
445487
"web_visuobject_rel_name_ph" = "e.g. owns";
@@ -468,9 +510,9 @@
468510
"web_visuobject_project_name" = "MyProject";
469511
"web_visuobject_add_package_tip" = "Create a new package (folder) in the project";
470512
"web_visuobject_add_package" = "Package";
471-
"web_visuobject_explorer_show" = "Show project view";
472-
"web_visuobject_explorer_hide" = "Collapse project view";
473-
"web_visuobject_explorer" = "Project";
513+
"web_visuobject_explorer_show" = "Show Package Explorer";
514+
"web_visuobject_explorer_hide" = "Collapse Package Explorer";
515+
"web_visuobject_explorer" = "Package Explorer";
474516
"web_visuobject_save_tip" = "Save the project as .zip: ProjectName/src/package/Class.java";
475517
"web_visuobject_open_tip" = "Open a project (.zip as from Eclipse or BlueJ) or add .java files to the project";
476518
"web_visuobject_method_ph" = "+ bark(): void";

0 commit comments

Comments
 (0)