From 154db9d9e843ebf2219147fdee4d82804c8466ac Mon Sep 17 00:00:00 2001 From: Ezequiel Bergamaschi Date: Tue, 28 Jan 2014 00:13:29 -0300 Subject: [PATCH] adding color properties to label --- config/database/hsql/create-schemas.sql | 5 +++-- config/database/mysql/create-schemas.sql | 3 ++- config/database/postgres/create-schemas.sql | 3 ++- .../main/java/com/wisemapping/model/Label.java | 10 ++++++++++ .../com/wisemapping/rest/model/RestLabel.java | 8 ++++++++ .../resources/com/wisemapping/model/Label.hbm.xml | 1 + wise-webapp/src/main/webapp/jsp/mindmapList.jsp | 15 +++++++++++++-- 7 files changed, 39 insertions(+), 6 deletions(-) diff --git a/config/database/hsql/create-schemas.sql b/config/database/hsql/create-schemas.sql index 8c59238b..d98d4694 100644 --- a/config/database/hsql/create-schemas.sql +++ b/config/database/hsql/create-schemas.sql @@ -34,9 +34,10 @@ CREATE TABLE MINDMAP ( CREATE TABLE LABEL ( id INTEGER NOT NULL PRIMARY KEY IDENTITY, - title VARCHAR(255), + title VARCHAR(30), creator_id INTEGER NOT NULL, - parent_label_id INTEGER + parent_label_id INTEGER, + color VARCHAR(7) NOT NULL --FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id) ); diff --git a/config/database/mysql/create-schemas.sql b/config/database/mysql/create-schemas.sql index 11ec6ca3..56b27217 100644 --- a/config/database/mysql/create-schemas.sql +++ b/config/database/mysql/create-schemas.sql @@ -54,10 +54,11 @@ CREATE TABLE MINDMAP ( CREATE TABLE LABEL ( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, - title VARCHAR(255) + title VARCHAR(30) CHARACTER SET utf8 NOT NULL, creator_id INTEGER NOT NULL, parent_label_id INTEGER, + color VARCHAR(7) NOT NULL, FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id), FOREIGN KEY (parent_label_id) REFERENCES LABEL (id) ON DELETE CASCADE diff --git a/config/database/postgres/create-schemas.sql b/config/database/postgres/create-schemas.sql index 52b30da3..1c52115c 100644 --- a/config/database/postgres/create-schemas.sql +++ b/config/database/postgres/create-schemas.sql @@ -23,7 +23,8 @@ CREATE TABLE LABEL ( id INTEGER NOT NULL PRIMARY KEY, title VARCHAR(255), creator_id INTEGER NOT NULL, - parent_label_id INTEGER + parent_label_id INTEGER, + color VARCHAR(7) NOT NULL --FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id) ); diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Label.java b/wise-webapp/src/main/java/com/wisemapping/model/Label.java index ccc04f90..22542da0 100644 --- a/wise-webapp/src/main/java/com/wisemapping/model/Label.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Label.java @@ -11,6 +11,7 @@ public class Label { @NotNull private String title; @NotNull private User creator; @Nullable private Label parent; + @NotNull private String color; public void setParent(@Nullable Label parent) { this.parent = parent; @@ -46,4 +47,13 @@ public class Label { public void setId(int id) { this.id = id; } + + @NotNull + public String getColor() { + return color; + } + + public void setColor(@NotNull String color) { + this.color = color; + } } diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/model/RestLabel.java b/wise-webapp/src/main/java/com/wisemapping/rest/model/RestLabel.java index 6b26f2de..8ec67d3a 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/model/RestLabel.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/model/RestLabel.java @@ -65,6 +65,14 @@ public class RestLabel { label.setTitle(title); } + public void setColor(@NotNull final String color) { + label.setColor(color); + } + + @NotNull public String getColor() { + return label.getColor(); + } + @JsonIgnore public Label getDelegated() { return label; diff --git a/wise-webapp/src/main/resources/com/wisemapping/model/Label.hbm.xml b/wise-webapp/src/main/resources/com/wisemapping/model/Label.hbm.xml index 71ff0bc9..11602ec6 100644 --- a/wise-webapp/src/main/resources/com/wisemapping/model/Label.hbm.xml +++ b/wise-webapp/src/main/resources/com/wisemapping/model/Label.hbm.xml @@ -10,6 +10,7 @@ + diff --git a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp index 82cc365c..c3834bd1 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp @@ -18,6 +18,8 @@ + + @@ -90,6 +92,8 @@ bStateSave:true }); + $('#colorGroup').colorpicker(); + // Customize search action ... $('#mindmapListTable_filter').appendTo("#tableActions"); $('#mindmapListTable_filter input').addClass('input-medium search-query'); @@ -313,10 +317,17 @@