Fix PizzaShop
This commit is contained in:
parent
31ac2d05c3
commit
c99d22d7c1
26 changed files with 1613 additions and 240 deletions
6
de.hhn.ai.prog2.blatt3.pizzashop/.idea/misc.xml
Normal file
6
de.hhn.ai.prog2.blatt3.pizzashop/.idea/misc.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/classes" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
de.hhn.ai.prog2.blatt3.pizzashop/.idea/modules.xml
Normal file
8
de.hhn.ai.prog2.blatt3.pizzashop/.idea/modules.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/de.hhn.ai.prog2.blatt3.pizzashop.iml" filepath="$PROJECT_DIR$/de.hhn.ai.prog2.blatt3.pizzashop.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
124
de.hhn.ai.prog2.blatt3.pizzashop/.idea/uiDesigner.xml
Normal file
124
de.hhn.ai.prog2.blatt3.pizzashop/.idea/uiDesigner.xml
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
de.hhn.ai.prog2.blatt3.pizzashop/.idea/vcs.xml
Normal file
6
de.hhn.ai.prog2.blatt3.pizzashop/.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
472
de.hhn.ai.prog2.blatt3.pizzashop/.idea/workspace.xml
Normal file
472
de.hhn.ai.prog2.blatt3.pizzashop/.idea/workspace.xml
Normal file
|
@ -0,0 +1,472 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="c3029575-d261-4918-aab3-2430f13ccc38" name="Default Changelist" comment="">
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/de.hhn.ai.prog2.blatt3.pizzashop.iml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/pizza.txt" beforeDir="false" afterPath="$PROJECT_DIR$/pizza.txt" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/app/Adresse.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/model/Adresse.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/app/App.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/services/App.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/app/KontaktDaten.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/model/KontaktDaten.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/app/Kunde.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/model/Kunde.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/app/KundenService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/services/KundenService.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/app/MyPizzaShop.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/view/MyPizzaShop.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/app/Order.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/model/Order.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/app/Pizza.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/model/Pizza.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/app/PizzaSize.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/model/PizzaSize.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/app/Topping.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/model/Topping.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/app/io/PizzaIOHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/services/io/PizzaIOHandler.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../de.hhn.ai.prog2.blatt8.internationalisierung/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../de.hhn.ai.prog2.blatt8.internationalisierung/.idea/workspace.xml" afterDir="false" />
|
||||||
|
</list>
|
||||||
|
<ignored path="$PROJECT_DIR$/classes/" />
|
||||||
|
<ignored path="$PROJECT_DIR$/bin/" />
|
||||||
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="DefaultGradleProjectSettings">
|
||||||
|
<option name="isMigrated" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="FileEditorManager">
|
||||||
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/KontaktDaten.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="30">
|
||||||
|
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/Kunde.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="60">
|
||||||
|
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="true">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/view/MyPizzaShop.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="453">
|
||||||
|
<caret line="175" column="23" selection-start-line="175" selection-start-column="23" selection-end-line="175" selection-end-column="23" />
|
||||||
|
<folding>
|
||||||
|
<element signature="imports" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/services/KundenService.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="600">
|
||||||
|
<caret line="47" column="20" selection-start-line="47" selection-start-column="20" selection-end-line="47" selection-end-column="20" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/view/util/ButtonColumn.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="585">
|
||||||
|
<caret line="43" column="19" selection-start-line="43" selection-start-column="19" selection-end-line="43" selection-end-column="19" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/Pizza.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="60">
|
||||||
|
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/PizzaSize.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="30">
|
||||||
|
<caret line="2" column="12" selection-start-line="2" selection-start-column="12" selection-end-line="2" selection-end-column="12" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/Topping.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="30">
|
||||||
|
<caret line="2" column="12" selection-start-line="2" selection-start-column="12" selection-end-line="2" selection-end-column="12" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/Order.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="60">
|
||||||
|
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/Adresse.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="30">
|
||||||
|
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
</leaf>
|
||||||
|
</component>
|
||||||
|
<component name="FileTemplateManagerImpl">
|
||||||
|
<option name="RECENT_TEMPLATES">
|
||||||
|
<list>
|
||||||
|
<option value="Class" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="FindInProjectRecents">
|
||||||
|
<findStrings>
|
||||||
|
<find>JList</find>
|
||||||
|
</findStrings>
|
||||||
|
</component>
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||||
|
</component>
|
||||||
|
<component name="IdeDocumentHistory">
|
||||||
|
<option name="CHANGED_PATHS">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/src/app/App.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/model/Adresse.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/model/Kunde.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/model/Order.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/model/Pizza.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/model/PizzaSize.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/services/KundenService.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/view/util/ButtonColumn.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/view/MyPizzaShop.java" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectConfigurationFiles">
|
||||||
|
<option name="files">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/de.hhn.ai.prog2.blatt3.pizzashop.iml" />
|
||||||
|
<option value="$PROJECT_DIR$/.idea/misc.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/.idea/vcs.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/.idea/modules.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/.idea/uiDesigner.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectFrameBounds" extendedState="6">
|
||||||
|
<option name="x" value="1280" />
|
||||||
|
<option name="width" value="2560" />
|
||||||
|
<option name="height" value="1410" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||||
|
<component name="ProjectView">
|
||||||
|
<navigator proportions="" version="1">
|
||||||
|
<foldersAlwaysOnTop value="true" />
|
||||||
|
</navigator>
|
||||||
|
<panes>
|
||||||
|
<pane id="Scope" />
|
||||||
|
<pane id="ProjectPane">
|
||||||
|
<subPane>
|
||||||
|
<expand>
|
||||||
|
<path>
|
||||||
|
<item name="de.hhn.ai.prog2.blatt3.pizzashop" type="b2602c69:ProjectViewProjectNode" />
|
||||||
|
<item name="de.hhn.ai.prog2.blatt3.pizzashop" type="462c0819:PsiDirectoryNode" />
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<item name="de.hhn.ai.prog2.blatt3.pizzashop" type="b2602c69:ProjectViewProjectNode" />
|
||||||
|
<item name="de.hhn.ai.prog2.blatt3.pizzashop" type="462c0819:PsiDirectoryNode" />
|
||||||
|
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<item name="de.hhn.ai.prog2.blatt3.pizzashop" type="b2602c69:ProjectViewProjectNode" />
|
||||||
|
<item name="de.hhn.ai.prog2.blatt3.pizzashop" type="462c0819:PsiDirectoryNode" />
|
||||||
|
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||||
|
<item name="model" type="462c0819:PsiDirectoryNode" />
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<item name="de.hhn.ai.prog2.blatt3.pizzashop" type="b2602c69:ProjectViewProjectNode" />
|
||||||
|
<item name="de.hhn.ai.prog2.blatt3.pizzashop" type="462c0819:PsiDirectoryNode" />
|
||||||
|
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||||
|
<item name="services" type="462c0819:PsiDirectoryNode" />
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<item name="de.hhn.ai.prog2.blatt3.pizzashop" type="b2602c69:ProjectViewProjectNode" />
|
||||||
|
<item name="de.hhn.ai.prog2.blatt3.pizzashop" type="462c0819:PsiDirectoryNode" />
|
||||||
|
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||||
|
<item name="view" type="462c0819:PsiDirectoryNode" />
|
||||||
|
</path>
|
||||||
|
</expand>
|
||||||
|
<select />
|
||||||
|
</subPane>
|
||||||
|
</pane>
|
||||||
|
<pane id="PackagesPane" />
|
||||||
|
</panes>
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent">
|
||||||
|
<property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||||
|
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||||
|
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||||
|
<property name="project.structure.last.edited" value="Project" />
|
||||||
|
<property name="project.structure.proportion" value="0.0" />
|
||||||
|
<property name="project.structure.side.proportion" value="0.0" />
|
||||||
|
</component>
|
||||||
|
<component name="RunDashboard">
|
||||||
|
<option name="ruleStates">
|
||||||
|
<list>
|
||||||
|
<RuleState>
|
||||||
|
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||||
|
</RuleState>
|
||||||
|
<RuleState>
|
||||||
|
<option name="name" value="StatusDashboardGroupingRule" />
|
||||||
|
</RuleState>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="RunManager">
|
||||||
|
<configuration name="App" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="services.App" />
|
||||||
|
<module name="de.hhn.ai.prog2.blatt3.pizzashop" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="model.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<recent_temporary>
|
||||||
|
<list>
|
||||||
|
<item itemvalue="Application.App" />
|
||||||
|
</list>
|
||||||
|
</recent_temporary>
|
||||||
|
</component>
|
||||||
|
<component name="SvnConfiguration">
|
||||||
|
<configuration />
|
||||||
|
</component>
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="c3029575-d261-4918-aab3-2430f13ccc38" name="Default Changelist" comment="" />
|
||||||
|
<created>1562236408943</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1562236408943</updated>
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="ToolWindowManager">
|
||||||
|
<frame x="1280" y="0" width="2560" height="1410" extended-state="6" />
|
||||||
|
<layout>
|
||||||
|
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25774425" />
|
||||||
|
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||||
|
<window_info id="Image Layers" order="2" />
|
||||||
|
<window_info id="Designer" order="3" />
|
||||||
|
<window_info id="UI Designer" order="4" />
|
||||||
|
<window_info id="Capture Tool" order="5" />
|
||||||
|
<window_info id="Favorites" order="6" side_tool="true" />
|
||||||
|
<window_info anchor="bottom" id="Message" order="0" />
|
||||||
|
<window_info anchor="bottom" id="Find" order="1" />
|
||||||
|
<window_info anchor="bottom" id="Run" order="2" weight="0.32945737" />
|
||||||
|
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||||
|
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||||
|
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||||
|
<window_info anchor="bottom" id="TODO" order="6" />
|
||||||
|
<window_info anchor="bottom" id="Terminal" order="7" />
|
||||||
|
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
|
||||||
|
<window_info anchor="bottom" id="Version Control" order="9" />
|
||||||
|
<window_info anchor="bottom" id="Messages" order="10" weight="0.32945737" />
|
||||||
|
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||||
|
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||||
|
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||||
|
<window_info anchor="right" id="Palette" order="3" />
|
||||||
|
<window_info anchor="right" id="Maven" order="4" />
|
||||||
|
<window_info anchor="right" id="Theme Preview" order="5" />
|
||||||
|
<window_info anchor="right" id="Capture Analysis" order="6" />
|
||||||
|
<window_info anchor="right" id="Palette	" order="7" />
|
||||||
|
</layout>
|
||||||
|
</component>
|
||||||
|
<component name="editorHistoryManager">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/services/App.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="135">
|
||||||
|
<caret line="9" column="1" selection-start-line="9" selection-start-column="1" selection-end-line="9" selection-end-column="1" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/KontaktDaten.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="30">
|
||||||
|
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/Kunde.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="60">
|
||||||
|
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/services/KundenService.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="600">
|
||||||
|
<caret line="47" column="20" selection-start-line="47" selection-start-column="20" selection-end-line="47" selection-end-column="20" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/view/util/ButtonColumn.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="585">
|
||||||
|
<caret line="43" column="19" selection-start-line="43" selection-start-column="19" selection-end-line="43" selection-end-column="19" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/Pizza.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="60">
|
||||||
|
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/PizzaSize.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="30">
|
||||||
|
<caret line="2" column="12" selection-start-line="2" selection-start-column="12" selection-end-line="2" selection-end-column="12" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/Topping.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="30">
|
||||||
|
<caret line="2" column="12" selection-start-line="2" selection-start-column="12" selection-end-line="2" selection-end-column="12" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/Order.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="60">
|
||||||
|
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/model/Adresse.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="30">
|
||||||
|
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/view/MyPizzaShop.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="453">
|
||||||
|
<caret line="175" column="23" selection-start-line="175" selection-start-column="23" selection-end-line="175" selection-end-column="23" />
|
||||||
|
<folding>
|
||||||
|
<element signature="imports" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</component>
|
||||||
|
<component name="masterDetails">
|
||||||
|
<states>
|
||||||
|
<state key="ArtifactsStructureConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<artifact-editor />
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="FacetStructureConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="GlobalLibrariesConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="JdkListConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="ModuleStructureConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="ProjectJDKs.UI">
|
||||||
|
<settings>
|
||||||
|
<last-edited>1.8</last-edited>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="ProjectLibrariesConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
</states>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<output url="file://$MODULE_DIR$/bin" />
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
3
de.hhn.ai.prog2.blatt3.pizzashop/kunden.txt
Normal file
3
de.hhn.ai.prog2.blatt3.pizzashop/kunden.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
1#Mustermann#Max
|
||||||
|
2#Doe#John
|
||||||
|
3#Musterfrau#Frau
|
|
@ -1,3 +0,0 @@
|
||||||
Test#LARGE#CHEESE#TOMATO#HAM#
|
|
||||||
Hello World#FAMILY#CHEESE#TOMATO#HAM#MUSHROOM#
|
|
||||||
Test#SMALL#HAM#
|
|
4
de.hhn.ai.prog2.blatt3.pizzashop/pizzas.txt
Normal file
4
de.hhn.ai.prog2.blatt3.pizzashop/pizzas.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Only Cheese#SMALL#CHEESE#
|
||||||
|
Margaritha#LARGE#CHEESE#TOMATO#
|
||||||
|
Multi Fruit#FAMILY#CHEESE#TOMATO#MUSHROOM#
|
||||||
|
Neue Pizza#MEDIUM#CHEESE#TOMATO#HAM#MUSHROOM#
|
|
@ -1,34 +0,0 @@
|
||||||
package app;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class KundenService {
|
|
||||||
private List<Kunde> kunden = new ArrayList<Kunde>();
|
|
||||||
|
|
||||||
public void create(Kunde kunde) {
|
|
||||||
kunden.add(kunde);
|
|
||||||
}
|
|
||||||
|
|
||||||
// public void update(); // TODO:
|
|
||||||
|
|
||||||
public void delete(Kunde kunde) {
|
|
||||||
kunden.remove(kunde);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Kunde read(int id) {
|
|
||||||
for (Kunde kunde : kunden) {
|
|
||||||
if (kunde.getId() == id)
|
|
||||||
return kunde;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Kunde read(String name, String lastName) {
|
|
||||||
for (Kunde kunde : kunden) {
|
|
||||||
if (kunde.getName() == name && kunde.getLastName() == lastName)
|
|
||||||
return kunde;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,169 +0,0 @@
|
||||||
package app;
|
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Component;
|
|
||||||
import java.awt.Container;
|
|
||||||
import java.awt.GridLayout;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JList;
|
|
||||||
import javax.swing.JMenu;
|
|
||||||
import javax.swing.JMenuBar;
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
import javax.swing.ListSelectionModel;
|
|
||||||
import javax.swing.WindowConstants;
|
|
||||||
|
|
||||||
import app.io.PizzaIOHandler;
|
|
||||||
|
|
||||||
public class MyPizzaShop extends JFrame {
|
|
||||||
private static final long serialVersionUID = -5421020006317002203L;
|
|
||||||
|
|
||||||
private Container container;
|
|
||||||
|
|
||||||
public MyPizzaShop() {
|
|
||||||
super("My Pizza Shop");
|
|
||||||
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
|
||||||
this.setSize(800, 600);
|
|
||||||
this.setJMenuBar(new MenuBar());
|
|
||||||
container = this.getContentPane();
|
|
||||||
container.setLayout(new BorderLayout());
|
|
||||||
StatusPanel panel = new StatusPanel();
|
|
||||||
container.add(panel, BorderLayout.SOUTH);
|
|
||||||
showCenterPanel(new CenterPanel());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showCenterPanel(JPanel panel) {
|
|
||||||
container.add(panel, BorderLayout.CENTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class StatusPanel extends JPanel {
|
|
||||||
private static final long serialVersionUID = -5777179157927719004L;
|
|
||||||
|
|
||||||
private StatusPanel() {
|
|
||||||
this.setBorder(BorderFactory.createLineBorder(Color.black));
|
|
||||||
JLabel label = new JLabel("Wilkommen");
|
|
||||||
this.add(label);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class MenuBar extends JMenuBar {
|
|
||||||
private static final long serialVersionUID = 7457449847994117214L;
|
|
||||||
|
|
||||||
private MenuBar() {
|
|
||||||
JMenu menu = new JMenu("Datei");
|
|
||||||
JMenuItem quit = new JMenuItem("Beenden");
|
|
||||||
quit.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
JPanel panel = new JPanel();
|
|
||||||
panel.add(new JLabel("Hallo, das ist ein Begrüßungstext"));
|
|
||||||
menu.add(panel);
|
|
||||||
menu.add(quit);
|
|
||||||
this.add(menu);
|
|
||||||
|
|
||||||
JMenu configurator = new JMenu("Konfigurator");
|
|
||||||
JMenuItem listPizzas = new JMenuItem("Zeige definierte Pizzen");
|
|
||||||
JMenuItem createPizza = new JMenuItem("Konfiguriere Pizza");
|
|
||||||
createPizza.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
container.setVisible(!container.isVisible());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
configurator.add(listPizzas);
|
|
||||||
configurator.add(createPizza);
|
|
||||||
this.add(configurator);
|
|
||||||
|
|
||||||
JMenu management = new JMenu("Verwaltung");
|
|
||||||
JMenuItem listStaff = new JMenuItem("Liste der Mitarbeiter");
|
|
||||||
management.add(listStaff);
|
|
||||||
this.add(management);
|
|
||||||
|
|
||||||
JMenu customer = new JMenu("Kunden");
|
|
||||||
JMenuItem listCustomer = new JMenuItem("Liste der Kunden");
|
|
||||||
JMenuItem manageCustomer = new JMenuItem("Kunde bearbeiten");
|
|
||||||
customer.add(listCustomer);
|
|
||||||
customer.add(manageCustomer);
|
|
||||||
this.add(customer);
|
|
||||||
|
|
||||||
JMenu order = new JMenu("Bestellung");
|
|
||||||
JMenuItem listOders = new JMenuItem("Liste der Bestellungen");
|
|
||||||
order.add(listOders);
|
|
||||||
this.add(order);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class CenterPanel extends JPanel {
|
|
||||||
private static final long serialVersionUID = 3527260169526726295L;
|
|
||||||
private JLabel priceLabel = new JLabel();
|
|
||||||
private int price = 200;
|
|
||||||
|
|
||||||
private CenterPanel() {
|
|
||||||
this.setLayout(new GridLayout(5, 2));
|
|
||||||
this.add(wrap(new JLabel("Name:")));
|
|
||||||
JTextField name = new JTextField(20);
|
|
||||||
this.add(wrap(name));
|
|
||||||
this.add(wrap(new JLabel("Größe:")));
|
|
||||||
String[] availPizzaSizes = new String[EnumSet.allOf(PizzaSize.class).size()];
|
|
||||||
int i = 0;
|
|
||||||
for (PizzaSize size : EnumSet.allOf(PizzaSize.class)) {
|
|
||||||
availPizzaSizes[i++] = size.getName();
|
|
||||||
}
|
|
||||||
JList<String> pizzaSize = new JList<String>(availPizzaSizes);
|
|
||||||
this.add(wrap(pizzaSize));
|
|
||||||
this.add(wrap(new JLabel("Belag:")));
|
|
||||||
String[] availToppings = new String[EnumSet.allOf(Topping.class).size()];
|
|
||||||
i = 0;
|
|
||||||
for (Topping topping : EnumSet.allOf(Topping.class)) {
|
|
||||||
availToppings[i++] = topping.getName();
|
|
||||||
}
|
|
||||||
JList<String> toppings = new JList<String>(availToppings);
|
|
||||||
toppings.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
|
||||||
this.add(wrap(toppings));
|
|
||||||
this.add(wrap(new JPanel()));
|
|
||||||
this.add(wrap(priceLabel));
|
|
||||||
JButton sendBtn = new JButton("Abschicken");
|
|
||||||
sendBtn.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
List<Pizza> pizzas = PizzaIOHandler.read(null);
|
|
||||||
List<Topping> toppingList = new ArrayList<Topping>();
|
|
||||||
for (int t : toppings.getSelectedIndices()) {
|
|
||||||
toppingList.add(Topping.values()[t]);
|
|
||||||
}
|
|
||||||
pizzas.add(
|
|
||||||
new Pizza(name.getText(), PizzaSize.values()[pizzaSize.getSelectedIndex()], toppingList));
|
|
||||||
PizzaIOHandler.write(pizzas, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.add(wrap(sendBtn));
|
|
||||||
this.add(wrap(new JButton("Ausdrucken")));
|
|
||||||
setPrice(price);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrice(int price) {
|
|
||||||
this.price = price;
|
|
||||||
priceLabel.setText("Preis: " + price + " Cent");
|
|
||||||
}
|
|
||||||
|
|
||||||
private JPanel wrap(Component comp) {
|
|
||||||
JPanel panel = new JPanel();
|
|
||||||
panel.add(comp);
|
|
||||||
return panel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package app;
|
package model;
|
||||||
|
|
||||||
public class Adresse {
|
public class Adresse {
|
||||||
private int id;
|
private int id;
|
|
@ -1,4 +1,4 @@
|
||||||
package app;
|
package model;
|
||||||
|
|
||||||
public class KontaktDaten {
|
public class KontaktDaten {
|
||||||
private int id;
|
private int id;
|
|
@ -1,4 +1,7 @@
|
||||||
package app;
|
package model;
|
||||||
|
|
||||||
|
import model.Adresse;
|
||||||
|
import model.KontaktDaten;
|
||||||
|
|
||||||
public class Kunde {
|
public class Kunde {
|
||||||
private int id;
|
private int id;
|
||||||
|
@ -9,6 +12,12 @@ public class Kunde {
|
||||||
private Adresse address;
|
private Adresse address;
|
||||||
private Adresse shippingAddress;
|
private Adresse shippingAddress;
|
||||||
|
|
||||||
|
public Kunde(int id, String lastName, String name) {
|
||||||
|
this.id = id;
|
||||||
|
this.lastName = lastName;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -27,4 +36,12 @@ public class Kunde {
|
||||||
return lastName;
|
return lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastName(String lastName) {
|
||||||
|
this.lastName = lastName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app;
|
package model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
||||||
package app;
|
package model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -22,10 +22,18 @@ public class Pizza {
|
||||||
return this.size;
|
return this.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSize(PizzaSize size) {
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Topping> getToppings() {
|
public List<Topping> getToppings() {
|
||||||
return this.toppings;
|
return this.toppings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setToppings(List<Topping> toppings) {
|
||||||
|
this.toppings = toppings;
|
||||||
|
}
|
||||||
|
|
||||||
public int getPrice() {
|
public int getPrice() {
|
||||||
int price = size.getPrice();
|
int price = size.getPrice();
|
||||||
for (int i = 0; i < toppings.size(); i++) {
|
for (int i = 0; i < toppings.size(); i++) {
|
|
@ -1,4 +1,4 @@
|
||||||
package app;
|
package model;
|
||||||
|
|
||||||
public enum PizzaSize {
|
public enum PizzaSize {
|
||||||
SMALL(400, "klein"), MEDIUM(500, "mittel"), LARGE(600, "groß"), FAMILY(1000, "extra groß");
|
SMALL(400, "klein"), MEDIUM(500, "mittel"), LARGE(600, "groß"), FAMILY(1000, "extra groß");
|
|
@ -1,4 +1,4 @@
|
||||||
package app;
|
package model;
|
||||||
|
|
||||||
public enum Topping {
|
public enum Topping {
|
||||||
CHEESE(50, "Käse"), TOMATO(25, "Tomate"), HAM(80, "Schinken"), MUSHROOM(40, "Champignon");
|
CHEESE(50, "Käse"), TOMATO(25, "Tomate"), HAM(80, "Schinken"), MUSHROOM(40, "Champignon");
|
|
@ -1,7 +1,9 @@
|
||||||
package app;
|
package services;
|
||||||
|
|
||||||
|
import view.MyPizzaShop;
|
||||||
|
|
||||||
public class App {
|
public class App {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) {
|
||||||
MyPizzaShop myPizzaShop = new MyPizzaShop();
|
MyPizzaShop myPizzaShop = new MyPizzaShop();
|
||||||
myPizzaShop.setVisible(true);
|
myPizzaShop.setVisible(true);
|
||||||
}
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
package services;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import model.Kunde;
|
||||||
|
import services.io.KundenIOHandler;
|
||||||
|
|
||||||
|
public class KundenService {
|
||||||
|
private List<Kunde> kunden = new ArrayList<Kunde>();
|
||||||
|
|
||||||
|
public KundenService() {
|
||||||
|
this.kunden = getAll(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create(Kunde kunde) {
|
||||||
|
kunden.add(kunde);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(int id, String name, String lastName) {
|
||||||
|
Kunde kunde = new Kunde(-1, "", "");
|
||||||
|
for (Kunde k : kunden)
|
||||||
|
if (k.getId() == id)
|
||||||
|
kunde = k;
|
||||||
|
kunde.setName(name);
|
||||||
|
kunde.setLastName(lastName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(int id) {
|
||||||
|
Kunde kunde = new Kunde(-1, "", "");
|
||||||
|
for (Kunde k : kunden)
|
||||||
|
if (k.getId() == id)
|
||||||
|
kunde = k;
|
||||||
|
kunden.remove(kunde);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Kunde read(int id) {
|
||||||
|
for (Kunde kunde : kunden) {
|
||||||
|
if (kunde.getId() == id)
|
||||||
|
return kunde;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUnusedId() {
|
||||||
|
int id = 0;
|
||||||
|
for (Kunde k : kunden)
|
||||||
|
if (k.getId() >= id)
|
||||||
|
id = k.getId() + 1;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Kunde read(String name, String lastName) {
|
||||||
|
for (Kunde kunde : kunden) {
|
||||||
|
if (kunde.getName() == name && kunde.getLastName() == lastName)
|
||||||
|
return kunde;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[][] getTableData() {
|
||||||
|
Object[][] data = new Object[kunden.size()][];
|
||||||
|
int id = 0;
|
||||||
|
for (Kunde kunde : kunden) {
|
||||||
|
data[id] = new Object[] { kunde.getId(), kunde.getName(), kunde.getLastName(), "Location" };
|
||||||
|
id += 1;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Kunde> getAll(String fileName) {
|
||||||
|
return KundenIOHandler.read(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveAll(List<Kunde> kunden, String fileName) {
|
||||||
|
KundenIOHandler.write(kunden, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveAllFromInternData() {
|
||||||
|
saveAll(kunden, null);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package services;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import model.Pizza;
|
||||||
|
import model.PizzaSize;
|
||||||
|
import model.Topping;
|
||||||
|
import services.io.PizzaIOHandler;
|
||||||
|
|
||||||
|
public class PizzaService {
|
||||||
|
private List<Pizza> pizzas = new ArrayList<Pizza>();
|
||||||
|
|
||||||
|
public PizzaService() {
|
||||||
|
this.pizzas = getAll(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create(Pizza pizza) {
|
||||||
|
pizzas.add(pizza);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(String name, PizzaSize pizzaSize, ArrayList<Topping> toppings) {
|
||||||
|
Pizza pizza = new Pizza("", PizzaSize.SMALL, new ArrayList<Topping>());
|
||||||
|
for (Pizza p : pizzas)
|
||||||
|
if (p.getName() == name)
|
||||||
|
pizza = p;
|
||||||
|
pizza.setSize(pizzaSize);
|
||||||
|
pizza.setToppings(toppings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(String name) {
|
||||||
|
Pizza pizza = new Pizza("", PizzaSize.SMALL, new ArrayList<Topping>());
|
||||||
|
for (Pizza p : pizzas)
|
||||||
|
if (p.getName() == name)
|
||||||
|
pizza = p;
|
||||||
|
pizzas.remove(pizza);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pizza read(String name) {
|
||||||
|
for (Pizza pizza : pizzas) {
|
||||||
|
if (pizza.getName() == name)
|
||||||
|
return pizza;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[][] getTableData() {
|
||||||
|
Object[][] data = new Object[pizzas.size()][];
|
||||||
|
int id = 0;
|
||||||
|
for (Pizza pizza : pizzas) {
|
||||||
|
data[id] = new Object[] { pizza.getName(), pizza.getPrice(), pizza.getSize(),
|
||||||
|
Arrays.toString(pizza.getToppings().toArray()) };
|
||||||
|
id += 1;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Pizza> getAll(String fileName) {
|
||||||
|
return PizzaIOHandler.read(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveAll(List<Pizza> pizzas, String fileName) {
|
||||||
|
PizzaIOHandler.write(pizzas, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveAllFromInternData() {
|
||||||
|
saveAll(pizzas, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package services.io;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import model.Kunde;
|
||||||
|
|
||||||
|
public class KundenIOHandler {
|
||||||
|
public static List<Kunde> read(String fileName) {
|
||||||
|
if (fileName == null)
|
||||||
|
fileName = "kunden.txt";
|
||||||
|
List<Kunde> kunden = new ArrayList<Kunde>();
|
||||||
|
try {
|
||||||
|
BufferedReader reader = new BufferedReader(new FileReader(fileName));
|
||||||
|
String line = null;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
String[] val = line.split("#");
|
||||||
|
kunden.add(new Kunde(Integer.parseInt(val[0]), val[1], val[2]));
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
System.out.println(kunden);
|
||||||
|
return kunden;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
System.out.println("###ERROR### (IOException)");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void write(List<Kunde> kunden, String fileName) {
|
||||||
|
if (fileName == null)
|
||||||
|
fileName = "kunden.txt";
|
||||||
|
try (PrintWriter writer = new PrintWriter(new FileWriter(fileName))) {
|
||||||
|
for (Kunde kunde : kunden) {
|
||||||
|
String line = Integer.toString(kunde.getId());
|
||||||
|
line += "#" + kunde.getLastName() + "#" + kunde.getName();
|
||||||
|
writer.println(line);
|
||||||
|
}
|
||||||
|
} catch (IOException ex) {
|
||||||
|
System.out.println("###ERROR### (IOException)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.io;
|
package services.io;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
|
@ -6,17 +6,16 @@ import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.Pizza;
|
import model.Pizza;
|
||||||
import app.PizzaSize;
|
import model.PizzaSize;
|
||||||
import app.Topping;
|
import model.Topping;
|
||||||
|
|
||||||
public class PizzaIOHandler {
|
public class PizzaIOHandler {
|
||||||
public static List<Pizza> read(String fileName) {
|
public static List<Pizza> read(String fileName) {
|
||||||
if (fileName == null)
|
if (fileName == null)
|
||||||
fileName = "pizza.txt";
|
fileName = "pizzas.txt";
|
||||||
List<Pizza> pizzas = new ArrayList<Pizza>();
|
List<Pizza> pizzas = new ArrayList<Pizza>();
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(fileName));
|
BufferedReader reader = new BufferedReader(new FileReader(fileName));
|
||||||
|
@ -40,7 +39,7 @@ public class PizzaIOHandler {
|
||||||
|
|
||||||
public static void write(List<Pizza> pizzas, String fileName) {
|
public static void write(List<Pizza> pizzas, String fileName) {
|
||||||
if (fileName == null)
|
if (fileName == null)
|
||||||
fileName = "pizza.txt";
|
fileName = "pizzas.txt";
|
||||||
try (PrintWriter writer = new PrintWriter(new FileWriter(fileName))) {
|
try (PrintWriter writer = new PrintWriter(new FileWriter(fileName))) {
|
||||||
for (Pizza pizza : pizzas) {
|
for (Pizza pizza : pizzas) {
|
||||||
String line = pizza.getName();
|
String line = pizza.getName();
|
530
de.hhn.ai.prog2.blatt3.pizzashop/src/view/MyPizzaShop.java
Normal file
530
de.hhn.ai.prog2.blatt3.pizzashop/src/view/MyPizzaShop.java
Normal file
|
@ -0,0 +1,530 @@
|
||||||
|
package view;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.CardLayout;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Container;
|
||||||
|
import java.awt.GridLayout;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
|
import javax.swing.Action;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JFileChooser;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JList;
|
||||||
|
import javax.swing.JMenu;
|
||||||
|
import javax.swing.JMenuBar;
|
||||||
|
import javax.swing.JMenuItem;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.ListSelectionModel;
|
||||||
|
import javax.swing.WindowConstants;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
|
||||||
|
import model.Kunde;
|
||||||
|
import model.Pizza;
|
||||||
|
import model.PizzaSize;
|
||||||
|
import model.Topping;
|
||||||
|
import services.KundenService;
|
||||||
|
import services.PizzaService;
|
||||||
|
import view.util.ButtonColumn;
|
||||||
|
|
||||||
|
public class MyPizzaShop extends JFrame {
|
||||||
|
private static final long serialVersionUID = -5421020006317002203L;
|
||||||
|
|
||||||
|
final static String DEFAULT = "Default";
|
||||||
|
final static String TODO = "Todo";
|
||||||
|
final static String CONFIGURATOR = "Configurator";
|
||||||
|
final static String PIZZALIST = "PizzaList";
|
||||||
|
final static String CUSTOMERLIST = "CustomerList";
|
||||||
|
final static String CUSTOMERDETAILS = "CustomerDetails";
|
||||||
|
|
||||||
|
private Container container;
|
||||||
|
private JPanel cards;
|
||||||
|
PizzaListPanel pizzaListPanel;
|
||||||
|
CustomerDetailsPanel customerDetailsPanel;
|
||||||
|
CustomerListPanel customerListPanel;
|
||||||
|
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
public MyPizzaShop() {
|
||||||
|
super("My Pizza Shop");
|
||||||
|
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||||
|
this.setSize(800, 600);
|
||||||
|
KundenService kundenService = new KundenService();
|
||||||
|
PizzaService pizzaService = new PizzaService();
|
||||||
|
container = this.getContentPane();
|
||||||
|
container.setLayout(new BorderLayout());
|
||||||
|
StatusPanel statusPanel = new StatusPanel();
|
||||||
|
container.add(statusPanel, BorderLayout.SOUTH);
|
||||||
|
JPanel defaultPanel = new DefaultPanel();
|
||||||
|
JPanel toDoPanel = new ToDoPanel();
|
||||||
|
JPanel configuratorPanel = new ConfiguratorPanel(pizzaService);
|
||||||
|
pizzaListPanel = new PizzaListPanel(pizzaService);
|
||||||
|
customerListPanel = new CustomerListPanel(kundenService);
|
||||||
|
customerDetailsPanel = new CustomerDetailsPanel(kundenService);
|
||||||
|
|
||||||
|
cards = new JPanel(new CardLayout());
|
||||||
|
cards.add(defaultPanel, DEFAULT);
|
||||||
|
cards.add(toDoPanel, TODO);
|
||||||
|
cards.add(configuratorPanel, CONFIGURATOR);
|
||||||
|
cards.add(pizzaListPanel, PIZZALIST);
|
||||||
|
cards.add(customerListPanel, CUSTOMERLIST);
|
||||||
|
cards.add(customerDetailsPanel, CUSTOMERDETAILS);
|
||||||
|
|
||||||
|
container.add(cards);
|
||||||
|
|
||||||
|
((CardLayout) (cards.getLayout())).show(cards, DEFAULT);
|
||||||
|
|
||||||
|
this.setJMenuBar(new MenuBar(kundenService, pizzaService));
|
||||||
|
this.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||||
|
@Override
|
||||||
|
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
|
||||||
|
if (JOptionPane.showConfirmDialog(null,
|
||||||
|
"Wollen Sie das Fenster wirklich schließen?\nAlle ungespeicherten Änderungen gehen verloren!",
|
||||||
|
"Fenster schließen?", JOptionPane.YES_NO_OPTION,
|
||||||
|
JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private class StatusPanel extends JPanel {
|
||||||
|
private static final long serialVersionUID = -5777179157927719004L;
|
||||||
|
|
||||||
|
private StatusPanel() {
|
||||||
|
this.setBorder(BorderFactory.createLineBorder(Color.black));
|
||||||
|
JLabel label = new JLabel("Wilkommen");
|
||||||
|
this.add(label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class MenuBar extends JMenuBar {
|
||||||
|
private static final long serialVersionUID = 7457449847994117214L;
|
||||||
|
KundenService kundenService;
|
||||||
|
PizzaService pizzaService;
|
||||||
|
|
||||||
|
private MenuBar(KundenService kundenService, PizzaService pizzaService) {
|
||||||
|
this.kundenService = kundenService;
|
||||||
|
this.pizzaService = pizzaService;
|
||||||
|
JMenu menu = new JMenu("Datei");
|
||||||
|
JMenuItem open = new JMenuItem("Öffnen");
|
||||||
|
JMenuItem quit = new JMenuItem("Beenden");
|
||||||
|
open.addActionListener(e -> {
|
||||||
|
new OpenDialog();
|
||||||
|
});
|
||||||
|
quit.addActionListener(e -> System.exit(0));
|
||||||
|
JPanel panel = new JPanel();
|
||||||
|
panel.add(new JLabel("Hallo, das ist ein Begrüßungstext"));
|
||||||
|
menu.add(panel);
|
||||||
|
menu.add(open);
|
||||||
|
menu.add(quit);
|
||||||
|
this.add(menu);
|
||||||
|
|
||||||
|
JMenu configurator = new JMenu("Konfigurator");
|
||||||
|
JMenuItem listPizzas = new JMenuItem("Zeige definierte Pizzen");
|
||||||
|
CardLayout cl = (CardLayout) (cards.getLayout());
|
||||||
|
listPizzas.addActionListener(e -> cl.show(cards, TODO));
|
||||||
|
JMenuItem createPizza = new JMenuItem("Konfiguriere Pizza");
|
||||||
|
createPizza.addActionListener(e -> cl.show(cards, CONFIGURATOR));
|
||||||
|
JMenuItem savePizzaList = new JMenuItem("Liste Speichern");
|
||||||
|
savePizzaList.addActionListener(e -> this.pizzaService.saveAllFromInternData());
|
||||||
|
configurator.add(listPizzas);
|
||||||
|
configurator.add(createPizza);
|
||||||
|
configurator.add(savePizzaList);
|
||||||
|
this.add(configurator);
|
||||||
|
|
||||||
|
JMenu management = new JMenu("Verwaltung");
|
||||||
|
JMenuItem listStaff = new JMenuItem("Liste der Mitarbeiter");
|
||||||
|
listStaff.addActionListener(e -> cl.show(cards, TODO));
|
||||||
|
management.add(listStaff);
|
||||||
|
this.add(management);
|
||||||
|
|
||||||
|
JMenu customer = new JMenu("Kunden");
|
||||||
|
JMenuItem listCustomer = new JMenuItem("Liste der Kunden");
|
||||||
|
listCustomer.addActionListener(e -> {
|
||||||
|
customerListPanel.refresh();
|
||||||
|
cl.show(cards, CUSTOMERLIST);
|
||||||
|
});
|
||||||
|
JMenuItem manageCustomer = new JMenuItem("Kunde hinzufügen");
|
||||||
|
manageCustomer.addActionListener(e -> {
|
||||||
|
customerDetailsPanel.clear();
|
||||||
|
customerDetailsPanel.generateNewId();
|
||||||
|
cl.show(cards, CUSTOMERDETAILS);
|
||||||
|
});
|
||||||
|
JMenuItem saveCustomerList = new JMenuItem("Liste Speichern");
|
||||||
|
saveCustomerList.addActionListener(e -> {
|
||||||
|
this.kundenService.saveAllFromInternData();
|
||||||
|
});
|
||||||
|
customer.add(listCustomer);
|
||||||
|
customer.add(manageCustomer);
|
||||||
|
customer.add(saveCustomerList);
|
||||||
|
this.add(customer);
|
||||||
|
|
||||||
|
JMenu order = new JMenu("Bestellung");
|
||||||
|
JMenuItem listOders = new JMenuItem("Liste der Bestellungen");
|
||||||
|
listOders.addActionListener(e -> cl.show(cards, TODO));
|
||||||
|
order.add(listOders);
|
||||||
|
this.add(order);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class OpenDialog extends JFileChooser {
|
||||||
|
private static final long serialVersionUID = 6958059890118659301L;
|
||||||
|
|
||||||
|
private OpenDialog() {
|
||||||
|
this.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||||
|
int returnVal = this.showOpenDialog(null);
|
||||||
|
|
||||||
|
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
|
File file = this.getSelectedFile();
|
||||||
|
path = file.getAbsolutePath();
|
||||||
|
System.out.println("Path selected: " + file.getAbsolutePath());
|
||||||
|
} else {
|
||||||
|
System.out.println("Open command cancelled by user.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DefaultPanel extends JPanel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7042604402647213661L;
|
||||||
|
|
||||||
|
private DefaultPanel() {
|
||||||
|
this.add(new JLabel("Herzlich Wilkommen bei 'MyPizzaShop'."));
|
||||||
|
this.add(new JLabel("Bitte wählen Sie eine Kategorie um fortzufahren."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ToDoPanel extends JPanel {
|
||||||
|
private static final long serialVersionUID = 6822836519469016140L;
|
||||||
|
|
||||||
|
private ToDoPanel() {
|
||||||
|
this.add(new JLabel("To Do"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CustomerListPanel extends JPanel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 9065029635304808892L;
|
||||||
|
KundenService kundenService;
|
||||||
|
String[] columnNames = { "ID", "Name", "Vorname", "Ort", "", "", "" };
|
||||||
|
JTable table;
|
||||||
|
|
||||||
|
private CustomerListPanel(KundenService kundenService) {
|
||||||
|
this.kundenService = kundenService;
|
||||||
|
Object[][] data = this.kundenService.getTableData();
|
||||||
|
|
||||||
|
// Add Button Text to table data
|
||||||
|
for (int i = 0; i < data.length; i++) {
|
||||||
|
data[i] = new Object[] { data[i][0], data[i][1], data[i][2], data[i][3], "Anzeigen", "Ändern",
|
||||||
|
"Löschen" };
|
||||||
|
}
|
||||||
|
DefaultTableModel model = new DefaultTableModel(data, columnNames);
|
||||||
|
table = new JTable(model);
|
||||||
|
|
||||||
|
JScrollPane scrollPane = new JScrollPane(table);
|
||||||
|
table.setFillsViewportHeight(true);
|
||||||
|
|
||||||
|
this.setLayout(new BorderLayout());
|
||||||
|
JPanel bottomBar = new JPanel();
|
||||||
|
JButton addCustomerBtn = new JButton("Füge Kunde hinzu");
|
||||||
|
addCustomerBtn.addActionListener(e -> {
|
||||||
|
customerDetailsPanel.clear();
|
||||||
|
customerDetailsPanel.generateNewId();
|
||||||
|
((CardLayout) (cards.getLayout())).show(cards, CUSTOMERDETAILS);
|
||||||
|
});
|
||||||
|
bottomBar.add(wrap(addCustomerBtn));
|
||||||
|
JButton printBtn = new JButton("Drucken");
|
||||||
|
printBtn.addActionListener(e -> {
|
||||||
|
System.out.println(Arrays.deepToString(kundenService.getTableData()));
|
||||||
|
});
|
||||||
|
bottomBar.add(wrap(printBtn));
|
||||||
|
this.add(table.getTableHeader(), BorderLayout.PAGE_START);
|
||||||
|
this.add(bottomBar, BorderLayout.AFTER_LAST_LINE);
|
||||||
|
this.add(scrollPane, BorderLayout.CENTER);
|
||||||
|
addTableButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addTableButtons() {
|
||||||
|
AbstractAction show = new AbstractAction() {
|
||||||
|
private static final long serialVersionUID = 302149670181733310L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
JTable table = (JTable) e.getSource();
|
||||||
|
int modelRow = Integer.valueOf(e.getActionCommand());
|
||||||
|
DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
|
||||||
|
customerDetailsPanel.preloadData(tableModel.getValueAt(modelRow, 0).toString(),
|
||||||
|
tableModel.getValueAt(modelRow, 1).toString(),
|
||||||
|
tableModel.getValueAt(modelRow, 2).toString());
|
||||||
|
customerDetailsPanel.setReadOnly(true);
|
||||||
|
((CardLayout) (cards.getLayout())).show(cards, CUSTOMERDETAILS);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
new ButtonColumn(table, show, 4);
|
||||||
|
|
||||||
|
AbstractAction edit = new AbstractAction() {
|
||||||
|
private static final long serialVersionUID = 302149670181733310L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
JTable table = (JTable) e.getSource();
|
||||||
|
int modelRow = Integer.valueOf(e.getActionCommand());
|
||||||
|
DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
|
||||||
|
customerDetailsPanel.preloadData(tableModel.getValueAt(modelRow, 0).toString(),
|
||||||
|
tableModel.getValueAt(modelRow, 1).toString(),
|
||||||
|
tableModel.getValueAt(modelRow, 2).toString());
|
||||||
|
customerDetailsPanel.setReadOnly(false);
|
||||||
|
customerDetailsPanel.enableEditMode();
|
||||||
|
((CardLayout) (cards.getLayout())).show(cards, CUSTOMERDETAILS);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
new ButtonColumn(table, edit, 5);
|
||||||
|
|
||||||
|
AbstractAction delete = new AbstractAction() {
|
||||||
|
private static final long serialVersionUID = 302149670181733310L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
JTable table = (JTable) e.getSource();
|
||||||
|
int modelRow = Integer.valueOf(e.getActionCommand());
|
||||||
|
DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
|
||||||
|
int answer = JOptionPane.showConfirmDialog(null,
|
||||||
|
"Den Nutzer '" + tableModel.getValueAt(modelRow, 1).toString() + " "
|
||||||
|
+ tableModel.getValueAt(modelRow, 2).toString() + "' (ID: "
|
||||||
|
+ tableModel.getValueAt(modelRow, 0).toString() + ") wirklich löschen?",
|
||||||
|
"Löschen", JOptionPane.YES_NO_OPTION);
|
||||||
|
if (answer == 0) {
|
||||||
|
kundenService.delete(Integer.parseInt(tableModel.getValueAt(modelRow, 0).toString()));
|
||||||
|
tableModel.removeRow(modelRow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
new ButtonColumn(table, delete, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refresh() {
|
||||||
|
Object[][] data = this.kundenService.getTableData();
|
||||||
|
|
||||||
|
// Add Button Text to table data
|
||||||
|
for (int i = 0; i < data.length; i++) {
|
||||||
|
data[i] = new Object[] { data[i][0], data[i][1], data[i][2], data[i][3], "Anzeigen", "Ändern",
|
||||||
|
"Löschen" };
|
||||||
|
}
|
||||||
|
DefaultTableModel model = new DefaultTableModel(data, columnNames);
|
||||||
|
table.setModel(model);
|
||||||
|
addTableButtons();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CustomerDetailsPanel extends JPanel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5183867990205291443L;
|
||||||
|
KundenService kundenService;
|
||||||
|
JTextField id = new JTextField(20);
|
||||||
|
JTextField name = new JTextField(20);
|
||||||
|
JTextField lastName = new JTextField(20);
|
||||||
|
JButton saveBtn = new JButton("Speichern");
|
||||||
|
ActionListener saveAction = new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
kundenService.create(new Kunde(Integer.parseInt(id.getText()), lastName.getText(), name.getText()));
|
||||||
|
customerListPanel.refresh();
|
||||||
|
((CardLayout) (cards.getLayout())).show(cards, CUSTOMERLIST);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ActionListener backAction = new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
customerListPanel.refresh();
|
||||||
|
((CardLayout) (cards.getLayout())).show(cards, CUSTOMERLIST);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ActionListener editAction = new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
kundenService.update(Integer.parseInt(id.getText()), name.getText(), lastName.getText());
|
||||||
|
customerListPanel.refresh();
|
||||||
|
((CardLayout) (cards.getLayout())).show(cards, CUSTOMERLIST);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private CustomerDetailsPanel(KundenService kundenService) {
|
||||||
|
this.kundenService = kundenService;
|
||||||
|
this.setLayout(new GridLayout(4, 2));
|
||||||
|
this.add(wrap(new JLabel("ID:")));
|
||||||
|
id.setEditable(false);
|
||||||
|
this.add(wrap(id));
|
||||||
|
this.add(wrap(new JLabel("Name:")));
|
||||||
|
this.add(wrap(name));
|
||||||
|
this.add(wrap(new JLabel("Nachname:")));
|
||||||
|
this.add(wrap(lastName));
|
||||||
|
saveBtn.addActionListener(saveAction);
|
||||||
|
this.add(wrap(saveBtn));
|
||||||
|
JButton printBtn = new JButton("Ausdrucken");
|
||||||
|
printBtn.addActionListener(e -> {
|
||||||
|
System.out.println(
|
||||||
|
"ID: " + id.getText() + " Name: " + name.getText() + " Nachname: " + lastName.getText());
|
||||||
|
});
|
||||||
|
this.add(wrap(printBtn));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void preloadData(String id, String name, String lastName) {
|
||||||
|
this.id.setText(id);
|
||||||
|
this.name.setText(name);
|
||||||
|
this.lastName.setText(lastName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clear() {
|
||||||
|
this.id.setText("");
|
||||||
|
this.name.setText("");
|
||||||
|
this.lastName.setText("");
|
||||||
|
this.setReadOnly(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setReadOnly(boolean readonly) {
|
||||||
|
this.name.setEditable(!readonly);
|
||||||
|
this.lastName.setEditable(!readonly);
|
||||||
|
this.saveBtn.setText(readonly ? "Zurück" : "Speichern");
|
||||||
|
this.saveBtn.removeActionListener(this.saveBtn.getActionListeners()[0]);
|
||||||
|
this.saveBtn.addActionListener(readonly ? this.backAction : this.saveAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generateNewId() {
|
||||||
|
this.id.setText(Integer.toString(kundenService.getUnusedId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enableEditMode() {
|
||||||
|
this.saveBtn.removeActionListener(this.saveBtn.getActionListeners()[0]);
|
||||||
|
this.saveBtn.addActionListener(this.editAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ConfiguratorPanel extends JPanel {
|
||||||
|
private static final long serialVersionUID = 3527260169526726295L;
|
||||||
|
private JLabel priceLabel = new JLabel();
|
||||||
|
private int price = 200;
|
||||||
|
PizzaService pizzaService;
|
||||||
|
|
||||||
|
private ConfiguratorPanel(PizzaService pizzaService) {
|
||||||
|
this.pizzaService = pizzaService;
|
||||||
|
this.setLayout(new GridLayout(5, 2));
|
||||||
|
this.add(wrap(new JLabel("Name:")));
|
||||||
|
JTextField name = new JTextField(20);
|
||||||
|
this.add(wrap(name));
|
||||||
|
this.add(wrap(new JLabel("Größe:")));
|
||||||
|
String[] availPizzaSizes = new String[EnumSet.allOf(PizzaSize.class).size()];
|
||||||
|
int i = 0;
|
||||||
|
for (PizzaSize size : EnumSet.allOf(PizzaSize.class)) {
|
||||||
|
availPizzaSizes[i++] = size.getName();
|
||||||
|
}
|
||||||
|
JList<String> pizzaSize = new JList<String>(availPizzaSizes);
|
||||||
|
this.add(wrap(pizzaSize));
|
||||||
|
this.add(wrap(new JLabel("Belag:")));
|
||||||
|
String[] availToppings = new String[EnumSet.allOf(Topping.class).size()];
|
||||||
|
i = 0;
|
||||||
|
for (Topping topping : EnumSet.allOf(Topping.class)) {
|
||||||
|
availToppings[i++] = topping.getName();
|
||||||
|
}
|
||||||
|
JList<String> toppings = new JList<String>(availToppings);
|
||||||
|
toppings.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||||
|
this.add(wrap(toppings));
|
||||||
|
this.add(wrap(new JPanel()));
|
||||||
|
this.add(wrap(priceLabel));
|
||||||
|
JButton sendBtn = new JButton("Abschicken");
|
||||||
|
sendBtn.addActionListener(e -> {
|
||||||
|
if (name.getText() == "" || pizzaSize.getSelectedIndex() == -1
|
||||||
|
|| toppings.getSelectedIndices().length == 0)
|
||||||
|
return;
|
||||||
|
// List<Pizza> pizzas = PizzaIOHandler.read(null);
|
||||||
|
List<Topping> toppingList = new ArrayList<Topping>();
|
||||||
|
for (int t : toppings.getSelectedIndices()) {
|
||||||
|
toppingList.add(Topping.values()[t]);
|
||||||
|
}
|
||||||
|
this.pizzaService.create(
|
||||||
|
new Pizza(name.getText(), PizzaSize.values()[pizzaSize.getSelectedIndex()], toppingList));
|
||||||
|
// PizzaIOHandler.write(pizzas, null);
|
||||||
|
pizzaListPanel.refresh();
|
||||||
|
((CardLayout) (cards.getLayout())).show(cards, PIZZALIST);
|
||||||
|
});
|
||||||
|
JButton printBtn = new JButton("Ausdrucken");
|
||||||
|
printBtn.addActionListener(e -> {
|
||||||
|
System.out.println(Arrays.toString(pizzaService.getTableData()));
|
||||||
|
});
|
||||||
|
this.add(wrap(sendBtn));
|
||||||
|
this.add(wrap(printBtn));
|
||||||
|
setPrice(price);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(int price) {
|
||||||
|
this.price = price;
|
||||||
|
priceLabel.setText("Preis: " + price + " Cent");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PizzaListPanel extends JPanel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 9065029635304808892L;
|
||||||
|
PizzaService pizzaService;
|
||||||
|
String[] columnNames = { "Name", "Preis", "Größe", "Toppings" };
|
||||||
|
JTable table;
|
||||||
|
|
||||||
|
private PizzaListPanel(PizzaService pizzaService) {
|
||||||
|
this.pizzaService = pizzaService;
|
||||||
|
Object[][] data = this.pizzaService.getTableData();
|
||||||
|
DefaultTableModel model = new DefaultTableModel(data, columnNames);
|
||||||
|
table = new JTable(model);
|
||||||
|
|
||||||
|
JScrollPane scrollPane = new JScrollPane(table);
|
||||||
|
table.setFillsViewportHeight(true);
|
||||||
|
|
||||||
|
this.setLayout(new BorderLayout());
|
||||||
|
JPanel bottomBar = new JPanel();
|
||||||
|
JButton addPizzaBtn = new JButton("Füge Pizza hinzu");
|
||||||
|
addPizzaBtn.addActionListener(e -> {
|
||||||
|
((CardLayout) (cards.getLayout())).show(cards, CONFIGURATOR);
|
||||||
|
});
|
||||||
|
bottomBar.add(wrap(addPizzaBtn));
|
||||||
|
JButton printBtn = new JButton("Drucken");
|
||||||
|
printBtn.addActionListener(e -> {
|
||||||
|
System.out.println(Arrays.deepToString(pizzaService.getTableData()));
|
||||||
|
});
|
||||||
|
bottomBar.add(wrap(printBtn));
|
||||||
|
this.add(table.getTableHeader(), BorderLayout.PAGE_START);
|
||||||
|
this.add(bottomBar, BorderLayout.AFTER_LAST_LINE);
|
||||||
|
this.add(scrollPane, BorderLayout.CENTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refresh() {
|
||||||
|
Object[][] data = this.pizzaService.getTableData();
|
||||||
|
DefaultTableModel model = new DefaultTableModel(data, columnNames);
|
||||||
|
table.setModel(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private JPanel wrap(Component comp) {
|
||||||
|
JPanel panel = new JPanel();
|
||||||
|
panel.add(comp);
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
}
|
196
de.hhn.ai.prog2.blatt3.pizzashop/src/view/util/ButtonColumn.java
Normal file
196
de.hhn.ai.prog2.blatt3.pizzashop/src/view/util/ButtonColumn.java
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
package view.util;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.border.*;
|
||||||
|
import javax.swing.table.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ButtonColumn class provides a renderer and an editor that looks like a
|
||||||
|
* JButton. The renderer and editor will then be used for a specified column in
|
||||||
|
* the table. The TableModel will contain the String to be displayed on the
|
||||||
|
* button.
|
||||||
|
*
|
||||||
|
* The button can be invoked by a mouse click or by pressing the space bar when
|
||||||
|
* the cell has focus. Optionally a mnemonic can be set to invoke the button.
|
||||||
|
* When the button is invoked the provided Action is invoked. The source of the
|
||||||
|
* Action will be the table. The action command will contain the model row
|
||||||
|
* number of the button that was clicked.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ButtonColumn extends AbstractCellEditor
|
||||||
|
implements TableCellRenderer, TableCellEditor, ActionListener, MouseListener {
|
||||||
|
private static final long serialVersionUID = 5829992577972549859L;
|
||||||
|
private JTable table;
|
||||||
|
private Action action;
|
||||||
|
private int mnemonic;
|
||||||
|
private Border originalBorder;
|
||||||
|
private Border focusBorder;
|
||||||
|
|
||||||
|
private JButton renderButton;
|
||||||
|
private JButton editButton;
|
||||||
|
private Object editorValue;
|
||||||
|
private boolean isButtonColumnEditor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the ButtonColumn to be used as a renderer and editor. The renderer and
|
||||||
|
* editor will automatically be installed on the TableColumn of the specified
|
||||||
|
* column.
|
||||||
|
*
|
||||||
|
* @param table the table containing the button renderer/editor
|
||||||
|
* @param action the Action to be invoked when the button is invoked
|
||||||
|
* @param column the column to which the button renderer/editor is added
|
||||||
|
*/
|
||||||
|
public ButtonColumn(JTable table, Action action, int column) {
|
||||||
|
this.table = table;
|
||||||
|
this.action = action;
|
||||||
|
|
||||||
|
renderButton = new JButton();
|
||||||
|
editButton = new JButton();
|
||||||
|
editButton.setFocusPainted(false);
|
||||||
|
editButton.addActionListener(this);
|
||||||
|
originalBorder = editButton.getBorder();
|
||||||
|
setFocusBorder(new LineBorder(Color.BLUE));
|
||||||
|
|
||||||
|
TableColumnModel columnModel = table.getColumnModel();
|
||||||
|
columnModel.getColumn(column).setCellRenderer(this);
|
||||||
|
columnModel.getColumn(column).setCellEditor(this);
|
||||||
|
table.addMouseListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get foreground color of the button when the cell has focus
|
||||||
|
*
|
||||||
|
* @return the foreground color
|
||||||
|
*/
|
||||||
|
public Border getFocusBorder() {
|
||||||
|
return focusBorder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The foreground color of the button when the cell has focus
|
||||||
|
*
|
||||||
|
* @param focusBorder the foreground color
|
||||||
|
*/
|
||||||
|
public void setFocusBorder(Border focusBorder) {
|
||||||
|
this.focusBorder = focusBorder;
|
||||||
|
editButton.setBorder(focusBorder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMnemonic() {
|
||||||
|
return mnemonic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The mnemonic to activate the button when the cell has focus
|
||||||
|
*
|
||||||
|
* @param mnemonic the mnemonic
|
||||||
|
*/
|
||||||
|
public void setMnemonic(int mnemonic) {
|
||||||
|
this.mnemonic = mnemonic;
|
||||||
|
renderButton.setMnemonic(mnemonic);
|
||||||
|
editButton.setMnemonic(mnemonic);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
|
||||||
|
if (value == null) {
|
||||||
|
editButton.setText("");
|
||||||
|
editButton.setIcon(null);
|
||||||
|
} else if (value instanceof Icon) {
|
||||||
|
editButton.setText("");
|
||||||
|
editButton.setIcon((Icon) value);
|
||||||
|
} else {
|
||||||
|
editButton.setText(value.toString());
|
||||||
|
editButton.setIcon(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.editorValue = value;
|
||||||
|
return editButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getCellEditorValue() {
|
||||||
|
return editorValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Implement TableCellRenderer interface
|
||||||
|
//
|
||||||
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
|
||||||
|
int row, int column) {
|
||||||
|
if (isSelected) {
|
||||||
|
renderButton.setForeground(table.getSelectionForeground());
|
||||||
|
renderButton.setBackground(table.getSelectionBackground());
|
||||||
|
} else {
|
||||||
|
renderButton.setForeground(table.getForeground());
|
||||||
|
renderButton.setBackground(UIManager.getColor("Button.background"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasFocus) {
|
||||||
|
renderButton.setBorder(focusBorder);
|
||||||
|
} else {
|
||||||
|
renderButton.setBorder(originalBorder);
|
||||||
|
}
|
||||||
|
|
||||||
|
// renderButton.setText( (value == null) ? "" : value.toString() );
|
||||||
|
if (value == null) {
|
||||||
|
renderButton.setText("");
|
||||||
|
renderButton.setIcon(null);
|
||||||
|
} else if (value instanceof Icon) {
|
||||||
|
renderButton.setText("");
|
||||||
|
renderButton.setIcon((Icon) value);
|
||||||
|
} else {
|
||||||
|
renderButton.setText(value.toString());
|
||||||
|
renderButton.setIcon(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return renderButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Implement ActionListener interface
|
||||||
|
//
|
||||||
|
/*
|
||||||
|
* The button has been pressed. Stop editing and invoke the custom Action
|
||||||
|
*/
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
int row = table.convertRowIndexToModel(table.getEditingRow());
|
||||||
|
fireEditingStopped();
|
||||||
|
|
||||||
|
// Invoke the Action
|
||||||
|
|
||||||
|
ActionEvent event = new ActionEvent(table, ActionEvent.ACTION_PERFORMED, "" + row);
|
||||||
|
action.actionPerformed(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Implement MouseListener interface
|
||||||
|
//
|
||||||
|
/*
|
||||||
|
* When the mouse is pressed the editor is invoked. If you then then drag the
|
||||||
|
* mouse to another cell before releasing it, the editor is still active. Make
|
||||||
|
* sure editing is stopped when the mouse is released.
|
||||||
|
*/
|
||||||
|
public void mousePressed(MouseEvent e) {
|
||||||
|
if (table.isEditing() && table.getCellEditor() == this)
|
||||||
|
isButtonColumnEditor = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseReleased(MouseEvent e) {
|
||||||
|
if (isButtonColumnEditor && table.isEditing())
|
||||||
|
table.getCellEditor().stopCellEditing();
|
||||||
|
|
||||||
|
isButtonColumnEditor = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseEntered(MouseEvent e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseExited(MouseEvent e) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,17 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="afe8ba73-7d05-48a7-bd82-e56b42c13591" name="Default Changelist" comment="">
|
<list default="true" id="afe8ba73-7d05-48a7-bd82-e56b42c13591" name="Default Changelist" comment="" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/customers.txt" beforeDir="false" afterPath="$PROJECT_DIR$/customers.txt" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/de.hhn.ai.prog2.blatt8.internationalisierung.iml" beforeDir="false" afterPath="$PROJECT_DIR$/de.hhn.ai.prog2.blatt8.internationalisierung.iml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/app/App.java" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/app/Datenhaltung.java" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/app/DatenhaltungTest.java" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/app/GUI.java" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/app/Kunde.java" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/../de.hhn.ai.prog2.blatt9.properties/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../de.hhn.ai.prog2.blatt9.properties/.idea/workspace.xml" afterDir="false" />
|
|
||||||
</list>
|
|
||||||
<ignored path="$PROJECT_DIR$/classes/" />
|
<ignored path="$PROJECT_DIR$/classes/" />
|
||||||
<ignored path="$PROJECT_DIR$/bin/" />
|
<ignored path="$PROJECT_DIR$/bin/" />
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
|
@ -85,8 +75,8 @@
|
||||||
<file pinned="false" current-in-tab="true">
|
<file pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/tests/services/DatenhaltungTest.java">
|
<entry file="file://$PROJECT_DIR$/tests/services/DatenhaltungTest.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="540">
|
<state relative-caret-position="480">
|
||||||
<caret line="36" column="69" selection-start-line="36" selection-start-column="69" selection-end-line="36" selection-end-column="69" />
|
<caret line="32" column="60" lean-forward="true" selection-start-line="32" selection-start-column="60" selection-end-line="32" selection-end-column="60" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -193,7 +183,7 @@
|
||||||
<property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrarySuperClass.Groovy JUnit" value="groovy.util.GroovyTestCase" />
|
<property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrarySuperClass.Groovy JUnit" value="groovy.util.GroovyTestCase" />
|
||||||
<property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrarySuperClass.JUnit5" value="" />
|
<property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrarySuperClass.JUnit5" value="" />
|
||||||
<property name="create.test.in.the.same.root" value="true" />
|
<property name="create.test.in.the.same.root" value="true" />
|
||||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../de.hhn.ai.prog2.blatt9.properties" />
|
<property name="last_opened_file_path" value="$PROJECT_DIR$/../de.hhn.ai.prog2.blatt3.pizzashop" />
|
||||||
<property name="project.structure.last.edited" value="Modules" />
|
<property name="project.structure.last.edited" value="Modules" />
|
||||||
<property name="project.structure.proportion" value="0.15" />
|
<property name="project.structure.proportion" value="0.15" />
|
||||||
<property name="project.structure.side.proportion" value="0.37222868" />
|
<property name="project.structure.side.proportion" value="0.37222868" />
|
||||||
|
@ -302,10 +292,12 @@
|
||||||
<history-entry file="DatenhaltungTest - 2019.07.04 at 12h 18m 29s.xml">
|
<history-entry file="DatenhaltungTest - 2019.07.04 at 12h 18m 29s.xml">
|
||||||
<configuration name="DatenhaltungTest" configurationId="JUnit" />
|
<configuration name="DatenhaltungTest" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
|
<history-entry file="DatenhaltungTest - 2019.07.04 at 12h 32m 31s.xml">
|
||||||
|
<configuration name="DatenhaltungTest" configurationId="JUnit" />
|
||||||
|
</history-entry>
|
||||||
</component>
|
</component>
|
||||||
<component name="ToolWindowManager">
|
<component name="ToolWindowManager">
|
||||||
<frame x="1280" y="0" width="2560" height="1410" extended-state="6" />
|
<frame x="1280" y="0" width="2560" height="1410" extended-state="6" />
|
||||||
<editor active="true" />
|
|
||||||
<layout>
|
<layout>
|
||||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25178713" />
|
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25178713" />
|
||||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||||
|
@ -316,7 +308,7 @@
|
||||||
<window_info id="Favorites" order="6" side_tool="true" />
|
<window_info id="Favorites" order="6" side_tool="true" />
|
||||||
<window_info anchor="bottom" id="Message" order="0" />
|
<window_info anchor="bottom" id="Message" order="0" />
|
||||||
<window_info anchor="bottom" id="Find" order="1" />
|
<window_info anchor="bottom" id="Find" order="1" />
|
||||||
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32945737" />
|
<window_info anchor="bottom" id="Run" order="2" weight="0.32945737" />
|
||||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||||
|
@ -432,8 +424,8 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/tests/services/DatenhaltungTest.java">
|
<entry file="file://$PROJECT_DIR$/tests/services/DatenhaltungTest.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="540">
|
<state relative-caret-position="480">
|
||||||
<caret line="36" column="69" selection-start-line="36" selection-start-column="69" selection-end-line="36" selection-end-column="69" />
|
<caret line="32" column="60" lean-forward="true" selection-start-line="32" selection-start-column="60" selection-end-line="32" selection-end-column="60" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
|
Loading…
Reference in a new issue