Commit 4ed39d8d authored by Stephan Kreutzer's avatar Stephan Kreutzer
Browse files

hyperdex_1: Expanded into an editor.

parent cef78824
/* Copyright (C) 2020 Stephan Kreutzer
*
* This file is part of hyperdex_1, a submodule of the
* digital_publishing_workflow_tools package.
*
* hyperdex_1 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License version 3 or any later version,
* as published by the Free Software Foundation.
*
* hyperdex_1 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License 3 for more details.
*
* You should have received a copy of the GNU Affero General Public License 3
* along with hyperdex_1. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file $/htx/gui/hyperdex/hyperdex_1/ActionListenerMenuItem.java
* @author Stephan Kreutzer
* @since 2020-11-26
*/
import java.awt.event.*;
class ActionListenerMenuItem
implements ActionListener
{
public ActionListenerMenuItem(hyperdex_1 parent, String command)
{
super();
this.parent = parent;
this.command = command;
}
public void actionPerformed(ActionEvent event)
{
this.parent.menuEvent(command);
}
protected hyperdex_1 parent = null;
protected String command = null;
}
/* Copyright (C) 2020 Stephan Kreutzer
*
* This file is part of hyperdex_1, a submodule of the
* digital_publishing_workflow_tools package.
*
* hyperdex_1 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License version 3 or any later version,
* as published by the Free Software Foundation.
*
* hyperdex_1 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License 3 for more details.
*
* You should have received a copy of the GNU Affero General Public License 3
* along with hyperdex_1. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file $/htx/gui/hyperdex/hyperdex_1/ActionListenerNodeDialogResult.java
* @author Stephan Kreutzer
* @since 2020-11-29
*/
import java.awt.event.*;
import javax.swing.JFrame;
import javax.swing.JTextField;
class ActionListenerNodeDialogResult
implements ActionListener
{
public ActionListenerNodeDialogResult(NodeDialog parent, JTextField control)
{
super();
this.parent = parent;
this.control = control;
}
public void actionPerformed(ActionEvent event)
{
this.parent.SetResultValue(control.getText());
this.parent.setVisible(false);
this.parent.dispose();
}
protected NodeDialog parent = null;
protected JTextField control = null;
}
/* Copyright (C) 2020 Stephan Kreutzer
*
* This file is part of hyperdex_1, a submodule of the
* digital_publishing_workflow_tools package.
*
* hyperdex_1 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License version 3 or any later version,
* as published by the Free Software Foundation.
*
* hyperdex_1 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License 3 for more details.
*
* You should have received a copy of the GNU Affero General Public License 3
* along with hyperdex_1. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file $/htx/gui/hyperdex/hyperdex_1/ActionListenerOperationButton.java
* @author Stephan Kreutzer
* @since 2020-11-27
*/
import java.awt.event.*;
class ActionListenerOperationButton
implements ActionListener
{
public ActionListenerOperationButton(hyperdex_1 parent, String node, String command, String previousValue)
{
super();
this.parent = parent;
this.node = node;
this.command = command;
this.previousValue = previousValue;
}
public void actionPerformed(ActionEvent event)
{
if (this.command.equals("add") == true)
{
NodeDialog dialog = new NodeDialog(this.parent, null);
dialog.setVisible(true);
String newValue = dialog.GetNewValue();
if (newValue != null)
{
if (newValue.length() > 0)
{
this.parent.addNode(node, newValue);
}
}
}
else if (this.command.equals("up") == true)
{
this.parent.moveNode(node, "up");
}
else if (this.command.equals("down") == true)
{
this.parent.moveNode(node, "down");
}
else if (this.command.equals("remove") == true)
{
this.parent.removeNode(node);
}
else if (this.command.equals("edit") == true)
{
NodeDialog dialog = new NodeDialog(this.parent, this.previousValue);
dialog.setVisible(true);
String newValue = dialog.GetNewValue();
if (newValue != null)
{
if (newValue.length() > 0)
{
this.parent.updateNode(node, newValue);
}
}
}
else if (this.command.equals("connect") == true)
{
this.parent.toggleConnection(node, true);
}
else if (this.command.equals("disconnect") == true)
{
this.parent.toggleConnection(node, false);
}
else
{
/** @todo Exception? */
}
}
protected hyperdex_1 parent = null;
protected String node = null;
protected String command = null;
protected String previousValue = null;
}
/* Copyright (C) 2020 Stephan Kreutzer
*
* This file is part of hyperdex_1, a submodule of the
* digital_publishing_workflow_tools package.
*
* hyperdex_1 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License version 3 or any later version,
* as published by the Free Software Foundation.
*
* hyperdex_1 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License 3 for more details.
*
* You should have received a copy of the GNU Affero General Public License 3
* along with hyperdex_1. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file $/htx/gui/hyperdex/hyperdex_1/ItemEventXAxisComboBox.java
* @author Stephan Kreutzer
* @since 2020-12-03
*/
import java.awt.event.*;
class ItemEventXAxisComboBox
implements ItemListener
{
public ItemEventXAxisComboBox(hyperdex_1 parent, char axis)
{
super();
this.parent = parent;
this.axis = axis;
}
public void itemStateChanged(ItemEvent item)
{
if (item.getStateChange() == ItemEvent.SELECTED)
{
this.parent.changeAxisDimension(this.axis, item.getItem().toString(), this.parent.getCurrentNodeY(), false);
}
}
protected hyperdex_1 parent = null;
protected char axis = '\0';
}
......@@ -42,6 +42,12 @@ class Node
return this.value;
}
public int SetValue(String value)
{
this.value = value;
return 0;
}
protected String id;
protected String value;
}
/* Copyright (C) 2020 Stephan Kreutzer
*
* This file is part of hyperdex_1, a submodule of the
* digital_publishing_workflow_tools package.
*
* hyperdex_1 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License version 3 or any later version,
* as published by the Free Software Foundation.
*
* hyperdex_1 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License 3 for more details.
*
* You should have received a copy of the GNU Affero General Public License 3
* along with hyperdex_1. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file $/htx/gui/hyperdex/hyperdex_1/NodeDialog.java
* @author Stephan Kreutzer
* @since 2020-11-26
*/
import javax.swing.*;
import java.util.Locale;
import java.util.ResourceBundle;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.UnsupportedEncodingException;
import java.io.File;
import java.io.IOException;
import java.net.URLDecoder;
class NodeDialog extends JDialog
{
public NodeDialog(JFrame parent, String value)
{
generateGUI(parent, value);
}
public final void generateGUI(JFrame parent, String value)
{
GridBagLayout gridbag = new GridBagLayout();
setLayout(gridbag);
JTextField textFieldNewEntry = new JTextField(value);
GridBagConstraints gridbagConstraints = new GridBagConstraints();
gridbagConstraints.anchor = GridBagConstraints.PAGE_START;
gridbagConstraints.weightx = 1.0;
//gridbagConstraints.weighty = 0.0;
//gridbagConstraints.gridx = 0;
//gridbagConstraints.gridy = 0;
gridbagConstraints.gridwidth = GridBagConstraints.REMAINDER;
gridbagConstraints.fill = GridBagConstraints.HORIZONTAL;
add(textFieldNewEntry, gridbagConstraints);
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(gridbag);
JButton closeButton = new JButton(getI10nString("buttonCancel"));
closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
dispose();
}
});
buttonPanel.add(closeButton);
JButton acceptButton = new JButton(getI10nString("buttonOK"));
acceptButton.addActionListener(new ActionListenerNodeDialogResult(this, textFieldNewEntry));
buttonPanel.add(acceptButton);
gridbagConstraints = new GridBagConstraints();
gridbagConstraints.anchor = GridBagConstraints.PAGE_START;
//gridbagConstraints.weightx = 1.0;
//gridbagConstraints.weighty = 0.0;
gridbagConstraints.gridx = 0;
gridbagConstraints.gridy = 1;
gridbagConstraints.gridwidth = GridBagConstraints.REMAINDER;
gridbagConstraints.fill = GridBagConstraints.HORIZONTAL;
add(buttonPanel, gridbagConstraints);
setModalityType(ModalityType.APPLICATION_MODAL);
setTitle(getI10nString("dialogCaption"));
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
pack();
setLocationRelativeTo(parent);
}
public int SetResultValue(String newValue)
{
this.newValue = newValue;
return 0;
}
public String GetNewValue()
{
return this.newValue;
}
public Locale getLocale()
{
return Locale.getDefault();
}
/**
* @brief This method interprets i10n strings from a .properties file as encoded in UTF-8.
*/
public String getI10nString(String key)
{
if (this.i10nGUI == null)
{
this.i10nGUI = ResourceBundle.getBundle("l10n.l10nNodeDialog", getLocale());
}
try
{
return new String(this.i10nGUI.getString(key).getBytes("ISO-8859-1"), "UTF-8");
}
catch (UnsupportedEncodingException ex)
{
return this.i10nGUI.getString(key);
}
}
protected String newValue = null;
private ResourceBundle i10nGUI;
}
This diff is collapsed.
......@@ -19,5 +19,6 @@ along with hyperdex_1. If not, see <http://www.gnu.org/licenses/>.
-->
<hyperdex-1-jobfile>
<input-file path="input.xml"/>
<output-file path="output.xml"/>
<options log-data="false" fullscreen="false"/>
</hyperdex-1-jobfile>
......@@ -27,11 +27,14 @@ messageJobFileIsntReadable = Job file "{0}" isn''t readable.
messageCallDetails = Called with job file "{0}" and result information file "{1}".
messageJobFileEntryIsMissingAnAttribute = Element "{1}" in job file "{0}" is missing its "{2}" attribute.
messageJobFileElementConfiguredMoreThanOnce = Element "{1}" in job file "{0}" configured more than once.
messageInputFileCantGetCanonicalPath = Can''t get canonical path of the input file "{0}" as specified in job file "{1}".
messageJobFileInputFileDoesntExist = Input file "{1}", configured in job file "{0}", doesn''t exist.
messageJobFileInputPathIsntAFile = Input file path "{1}", configured in job file "{0}", isn''t a file.
messageJobFileInputFileIsntReadable = Input file "{1}", configured in job file "{0}", isn''t readable.
messageOutputFileCantGetCanonicalPath = Can''t get canonical path of the output file "{0}" as specified in job file "{1}".
messageOutputFileExists = The output file "{0}" as specified in job file "{1}" exists already.
messageJobFileErrorWhileReading = An error occurred while reading job file "{0}".
messageJobFileInputFileIsntConfigured = No input file configured in job file "{0}".
messageJobFileOutputFileIsntConfigured = No output file configured in job file "{0}".
messageInputFileErrorWhileReading = An error occurred while reading input file "{0}".
messageDuplicateNodeId = Duplicate node ID "{0}" encountered.
messageDuplicateNodeIdInEstablishingDimension = Node with ID "{1}" is entered twice into establishing dimension "{0}".
......@@ -40,4 +43,26 @@ messageNodeMissingInEstablishingDimension = Node with ID "{1}" is missing in est
messageEdgeIsConnectingANodeToItself = An edge is connecting the node with ID "{0}" to itself.
messageEdgeIsReferencingASourceNodeWhichDoesntExist = An edge is referencing a source node with the ID "{0}" which doesn''t exist.
messageEdgeIsReferencingATargetNodeWhichDoesntExist = An edge is referencing a target node with the ID "{0}" which doesn''t exist.
messageNodeWithoutEdgeOtherThanItsEstablishingDimension = The node with ID "{0}" and value "{1}" is not connected by any edge to a dimension other than its establishing dimension "{2}".
messageUnknownMode = Unknown mode "{0}".
messageUnknownAxis = Change of unknown axis "{0}".
messageUnknownMenuCommand = Unknown menu command "{0}".
messageUnknownNodeMoveDirection = Unknown node move direction "{0}".
messageCurrentNodeYMissingInConnections = Currently selected node "{0}" on the y-axis is missing in the list of connections.
messageRemoveConnectionDidntFindCurrentDimensionXInConnectionsOfCurrentNodeY = Didn''t find current x-dimension "{0}" in connections of current y-node "{1}" while attempting to remove the connection.
messageRemoveConnectionDidntFindTargetNode = Didn''t find target node "{0}" on the current x-dimension "{1}" while attempting to remove the connection.
messageRemoveConnectionDidntFindCurrentDimensionYInConnectionsOfTargetNode = Didn''t find current y-dimension "{0}" in connections of target node "{1}" while attempting to remove the connection.
messageRemoveConnectionDidntFindCurrentNodeY = Didn''t find current y-node "{0}" on the current y-dimension "{1}" while attempting to remove the connection.
messageAddConnectionDidntFindTargetNodeInCurrentDimensionX = Didn''t find target node "{0}" in current x-dimension "{1}" while attempting to establish the connection.
messageAddConnectionDidntFindCurrentNodeYInCurrentDimensionY = Didn''t find current y-node "{0}" in current y-dimension "{1}" while attempting to establish the connection.
messageOutputFileErrorWhileWriting = An error occurred while writing to output file "{0}".
guiMenuBarFileCaption = File
guiMenuNewCaption = New
guiMenuSaveAsCaption = Save as
guiMenuBarEditCaption = Edit
guiAddDimensionCaption = Add dimension
guiRenameDimensionCaption = Rename dimension
guiMenuBarModeCaption = Mode
guiModeOptionViewCaption = View
guiModeOptionEditCaption = Edit
guiEntryEditButtonCaption = e
......@@ -27,11 +27,14 @@ messageJobFileIsntReadable = Jobdatei "{0}" ist nicht lesbar.
messageCallDetails = Aufgerufen mit Jobdatei "{0}" und Ergebnisinformationsdatei "{1}".
messageJobFileEntryIsMissingAnAttribute = Element "{1}" in Jobdatei "{0}" fehlt das "{2}"-Attribut.
messageJobFileElementConfiguredMoreThanOnce = Element "{1}" in Jobdatei "{0}" mehr als einmal konfiguriert.
messageInputFileCantGetCanonicalPath = Kann keinen kanonischen Pfad für die Eingabedatei "{0}" wie in Jobdatei "{1}" spezifiziert ermitteln.
messageJobFileInputFileDoesntExist = Eingabedatei "{1}" wie in "{0}" konfiguriert existiert nicht.
messageJobFileInputPathIsntAFile = Eingabedateipfad "{1}" wie in "{0}" konfiguriert ist keine Datei.
messageJobFileInputFileIsntReadable = Eingabedatei "{1}" wie in "{0}" konfiguriert ist nicht lesbar.
messageOutputFileCantGetCanonicalPath = Kann keinen kanonischen Pfad für die Ausgabedatei "{0}" wie in Jobdatei "{1}" spezifiziert ermitteln.
messageOutputFileExists = Die Ausgabedatei "{0}" wie in Jobdatei "{1}" spezifiziert existiert bereits.
messageJobFileErrorWhileReading = Während die Jobdatei "{0}" ausgelesen wurde, ist ein Fehler aufgetreten.
messageJobFileInputFileIsntConfigured = Keine Eingabedatei konfiguriert in Jobdatei "{0}".
messageJobFileOutputFileIsntConfigured = Keine Eingabedatei konfiguriert in Jobdatei "{0}".
messageInputFileErrorWhileReading = Während dem Lesen der Eingabedatei "{0}" ist ein Fehler aufgetreten.
messageDuplicateNodeId = Knoten-/Ecken-ID "{0}" ist doppelt.
messageDuplicateNodeIdInEstablishingDimension = Knoten/Ecke mit ID "{1}" wurde zweimal in die etablierende Dimension "{0}" eingetragen.
......@@ -40,4 +43,26 @@ messageNodeMissingInEstablishingDimension = Knoten/Ecke mit ID "{1}" fehlt in et
messageEdgeIsConnectingANodeToItself = Eine Kante verbindet eine(n) Knoten/Ecke mit der ID "{0}" mit sich selbst.
messageEdgeIsReferencingASourceNodeWhichDoesntExist = Eine Kante referenziert eine(n) Quell-Knoten/-Ecke mit ID "{0}", die nicht existiert.
messageEdgeIsReferencingATargetNodeWhichDoesntExist = Eine Kante referenziert eine(n) Ziel-Knoten/-Ecke mit ID "{0}", die nicht existiert.
messageNodeWithoutEdgeOtherThanItsEstablishingDimension = Knoten/Ecke mit ID "{0}" und Wert "{1}" ist mit keiner Kante zu einer anderen Dimension verbunden außer seiner etablierenden Dimension "{2}".
messageUnknownMode = Unbekannter Modus "{0}".
messageUnknownAxis = Wechsel der unbekannten Achse "{0}".
messageUnknownMenuCommand = Unbekanntes Menü-Kommando "{0}".
messageUnknownNodeMoveDirection = Unbekannte Knoten-/Ecken-Bewegungsrichtung "{0}".
messageCurrentNodeYMissingInConnections = Der aktuell auf der y-Achse selektierte Knoten "{0}" fehlt in der Liste der Verbindungen.
messageRemoveConnectionDidntFindCurrentDimensionXInConnectionsOfCurrentNodeY = Konnte beim Auflösen der Verbindung die aktuelle x-Dimension "{0}" nicht in den Verbindungen des/der aktuellen y-Knotens/-Ecke "{1}" finden.
messageRemoveConnectionDidntFindTargetNode = Konnte Ziel-Knoten/-Ecke "{0}" auf der aktuellen x-Dimension "{1}" nicht finden beim Auflösen der Verbindung.
messageRemoveConnectionDidntFindCurrentDimensionYInConnectionsOfTargetNode = Konnte beim Auflösen der Verbindung die aktuelle y-Dimension "{0}" nicht in den Verbindungen des/der Ziel-Knotens/-Ecke "{1}" finden.
messageRemoveConnectionDidntFindCurrentNodeY = Konnte aktuelle(n) y-Knoten/-Ecke "{0}" auf der aktuellen y-Dimension "{1}" nicht finden beim Auflösen der Verbindung.
messageAddConnectionDidntFindTargetNodeInCurrentDimensionX = Konnte Ziel-Knoten/-Ecke "{0}" nicht in der aktuellen x-Dimension "{1}" finden beim Herstellen der Verbindung.
messageAddConnectionDidntFindCurrentNodeYInCurrentDimensionY = Konnte aktuelle(n) y-Knoten/-Ecke "{0}" nicht in der aktuellen y-Dimension "{1}" finden beim Herstellen der Verbindung.
messageOutputFileErrorWhileWriting = Während des Schreibens in die Ausgabedatei "{0}" ist ein Fehler aufgetreten.
guiMenuBarFileCaption = Datei
guiMenuNewCaption = Neu
guiMenuSaveAsCaption = Speichern unter
guiMenuBarEditCaption = Bearbeiten
guiAddDimensionCaption = Dimension hinzufügen
guiRenameDimensionCaption = Dimension umbenennen
guiMenuBarModeCaption = Modus
guiModeOptionViewCaption = Betrachten
guiModeOptionEditCaption = Bearbeiten
guiEntryEditButtonCaption = e
# Copyright (C) 2020 Stephan Kreutzer
#
# This file is part of hyperdex_1, a submodule of the
# digital_publishing_workflow_tools package.
#
# hyperdex_1 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3 or any later version,
# as published by the Free Software Foundation.
#
# hyperdex_1 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License 3 for more details.
#
# You should have received a copy of the GNU Affero General Public License 3
# along with hyperdex_1. If not, see <http://www.gnu.org/licenses/>.
dialogCaption = New Value
buttonCancel = Cancel
buttonOK = OK
# Copyright (C) 2020 Stephan Kreutzer
#
# This file is part of hyperdex_1, a submodule of the
# digital_publishing_workflow_tools package.
#
# hyperdex_1 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3 or any later version,
# as published by the Free Software Foundation.
#
# hyperdex_1 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License 3 for more details.
#
# You should have received a copy of the GNU Affero General Public License 3
# along with hyperdex_1. If not, see <http://www.gnu.org/licenses/>.
dialogCaption = Neuer Wert
buttonCancel = Abbrechen
buttonOK = OK
......@@ -26,7 +26,7 @@ hyperdex_1: hyperdex_1.class
hyperdex_1.class: hyperdex_1.java InfoMessage.class ProgramTerminationException.class ActionListenerButtonNode.class Node.class Edge.class DataFileLoader.class
hyperdex_1.class: hyperdex_1.java InfoMessage.class ProgramTerminationException.class ActionListenerButtonNode.class ActionListenerMenuItem.class ActionListenerOperationButton.class ItemEventXAxisComboBox.class Node.class Edge.class DataFileLoader.class
javac -encoding UTF-8 hyperdex_1.java
InfoMessage.class: InfoMessage.java
......@@ -35,9 +35,24 @@ InfoMessage.class: InfoMessage.java
ProgramTerminationException.class: ProgramTerminationException.java
javac -encoding UTF-8 ProgramTerminationException.java
ActionListenerOperationButton.class: ActionListenerOperationButton.java NodeDialog.class
javac -encoding UTF-8 ActionListenerOperationButton.java
ActionListenerNodeDialogResult.class: ActionListenerNodeDialogResult.java
javac -encoding UTF-8 ActionListenerNodeDialogResult.java
NodeDialog.class: NodeDialog.java ActionListenerNodeDialogResult.class
javac -encoding UTF-8 NodeDialog.java
ActionListenerButtonNode.class: ActionListenerButtonNode.java
javac -encoding UTF-8 ActionListenerButtonNode.java
ActionListenerMenuItem.class: ActionListenerMenuItem.java
javac -encoding UTF-8 ActionListenerMenuItem.java
ItemEventXAxisComboBox.class: ItemEventXAxisComboBox.java
javac -encoding UTF-8 ItemEventXAxisComboBox.java
Node.class: Node.java
javac -encoding UTF-8 Node.java