aboutsummaryrefslogtreecommitdiff
path: root/src/uk/org/ury/show/item
diff options
context:
space:
mode:
authorMatt Windsor <matt@deling.(none)>2011-03-18 08:28:09 +0000
committerMatt Windsor <matt@deling.(none)>2011-03-18 08:28:09 +0000
commitd547f87da5f68c12dede7c9d45618cae11ff5699 (patch)
tree613aa95d94b363c72ba9a7be639c74f76edf81f8 /src/uk/org/ury/show/item
parentc8bb324e757587e742df0824304144e1eb881cee (diff)
Mega-commit to the rescue! Added Javadoc snapshot (admittedly old); show UI now fixed-layout; UI uses system selection colours for accents; now uses bapsserver password and can thus talk to show database relations; removed member relation dependencies until further notice; attempted to get application and applet launchers working but having issues with the latter; started working on a server communicating via a minimal implementation of HTTP 1.1 (standardisation required eventually).
Diffstat (limited to 'src/uk/org/ury/show/item')
-rw-r--r--src/uk/org/ury/show/item/ShowItem.java68
-rw-r--r--src/uk/org/ury/show/item/ShowItemProperty.java26
2 files changed, 94 insertions, 0 deletions
diff --git a/src/uk/org/ury/show/item/ShowItem.java b/src/uk/org/ury/show/item/ShowItem.java
new file mode 100644
index 0000000..0a9154f
--- /dev/null
+++ b/src/uk/org/ury/show/item/ShowItem.java
@@ -0,0 +1,68 @@
+/**
+ *
+ */
+package uk.org.ury.show.item;
+
+
+import java.util.Map;
+
+import uk.org.ury.database.DatabaseItem;
+import uk.org.ury.database.exceptions.MissingPropertyException;
+
+
+/**
+ * An item in the show database.
+ *
+ * @author Matt Windsor
+ */
+
+public class ShowItem extends DatabaseItem<ShowItemProperty, String>
+{
+ /**
+ * Construct a new ShowItem.
+ *
+ * @param properties The map of properties to store in the show item.
+ */
+
+ public
+ ShowItem (Map<ShowItemProperty, String> properties)
+ {
+ super (properties);
+ }
+
+
+ /**
+ * @return a string representation of the ShowItem.
+ */
+
+ @Override
+ public String
+ toString ()
+ {
+ String name1;
+ String name2;
+
+ try
+ {
+ name1 = get (ShowItemProperty.NAME1);
+ }
+ catch (MissingPropertyException e1)
+ {
+ name1 = "Unknown";
+ }
+
+ try
+ {
+ name2 = get (ShowItemProperty.NAME2);
+ }
+ catch (MissingPropertyException e2)
+ {
+ name2 = null;
+ }
+
+ if (name2 != null)
+ return name1 + " - " + name2;
+ else
+ return name1;
+ }
+}
diff --git a/src/uk/org/ury/show/item/ShowItemProperty.java b/src/uk/org/ury/show/item/ShowItemProperty.java
new file mode 100644
index 0000000..a4239b5
--- /dev/null
+++ b/src/uk/org/ury/show/item/ShowItemProperty.java
@@ -0,0 +1,26 @@
+package uk.org.ury.show.item;
+
+
+/**
+ * Enumeration of the parameters that are stored in a ShowItem.
+ *
+ * @author Matt Windsor
+ */
+
+public enum ShowItemProperty
+ {
+ // Constant SQL identifier
+ NAME1 ("name1"),
+ NAME2 ("name2"),
+ POSITION ("positionid");
+
+
+ public final String sql;
+
+
+ private
+ ShowItemProperty (String sql)
+ {
+ this.sql = sql;
+ }
+ }; \ No newline at end of file