adding color properties to label

This commit is contained in:
Ezequiel Bergamaschi 2014-01-28 00:13:29 -03:00 committed by Ezequiel Bergamaschi
parent deb6c4be4d
commit 154db9d9e8
7 changed files with 39 additions and 6 deletions

View File

@ -34,9 +34,10 @@ CREATE TABLE MINDMAP (
CREATE TABLE LABEL ( CREATE TABLE LABEL (
id INTEGER NOT NULL PRIMARY KEY IDENTITY, id INTEGER NOT NULL PRIMARY KEY IDENTITY,
title VARCHAR(255), title VARCHAR(30),
creator_id INTEGER NOT NULL, 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) --FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
); );

View File

@ -54,10 +54,11 @@ CREATE TABLE MINDMAP (
CREATE TABLE LABEL ( CREATE TABLE LABEL (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255) title VARCHAR(30)
CHARACTER SET utf8 NOT NULL, CHARACTER SET utf8 NOT NULL,
creator_id INTEGER NOT NULL, 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), FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id),
FOREIGN KEY (parent_label_id) REFERENCES LABEL (id) FOREIGN KEY (parent_label_id) REFERENCES LABEL (id)
ON DELETE CASCADE ON DELETE CASCADE

View File

@ -23,7 +23,8 @@ CREATE TABLE LABEL (
id INTEGER NOT NULL PRIMARY KEY, id INTEGER NOT NULL PRIMARY KEY,
title VARCHAR(255), title VARCHAR(255),
creator_id INTEGER NOT NULL, 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) --FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
); );

View File

@ -11,6 +11,7 @@ public class Label {
@NotNull private String title; @NotNull private String title;
@NotNull private User creator; @NotNull private User creator;
@Nullable private Label parent; @Nullable private Label parent;
@NotNull private String color;
public void setParent(@Nullable Label parent) { public void setParent(@Nullable Label parent) {
this.parent = parent; this.parent = parent;
@ -46,4 +47,13 @@ public class Label {
public void setId(int id) { public void setId(int id) {
this.id = id; this.id = id;
} }
@NotNull
public String getColor() {
return color;
}
public void setColor(@NotNull String color) {
this.color = color;
}
} }

View File

@ -65,6 +65,14 @@ public class RestLabel {
label.setTitle(title); label.setTitle(title);
} }
public void setColor(@NotNull final String color) {
label.setColor(color);
}
@NotNull public String getColor() {
return label.getColor();
}
@JsonIgnore @JsonIgnore
public Label getDelegated() { public Label getDelegated() {
return label; return label;

View File

@ -10,6 +10,7 @@
<generator class="increment"/> <generator class="increment"/>
</id> </id>
<property name="title"/> <property name="title"/>
<property name="color"/>
<many-to-one name="parent" column="parent_label_id" not-null="false"/> <many-to-one name="parent" column="parent_label_id" not-null="false"/>
<many-to-one name="creator" column="creator_id" unique="true" not-null="false" lazy="proxy"/> <many-to-one name="creator" column="creator_id" unique="true" not-null="false" lazy="proxy"/>
</class> </class>

View File

@ -18,6 +18,8 @@
<script type="text/javascript" language="javascript" src="js/jquery-1.7.2.min.js"></script> <script type="text/javascript" language="javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap.js"></script> <script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap-colorpicker.js"></script>
<script src="js/less.js" type="text/javascript"></script> <script src="js/less.js" type="text/javascript"></script>
<!--jQuery DataTables--> <!--jQuery DataTables-->
@ -90,6 +92,8 @@
bStateSave:true bStateSave:true
}); });
$('#colorGroup').colorpicker();
// Customize search action ... // Customize search action ...
$('#mindmapListTable_filter').appendTo("#tableActions"); $('#mindmapListTable_filter').appendTo("#tableActions");
$('#mindmapListTable_filter input').addClass('input-medium search-query'); $('#mindmapListTable_filter input').addClass('input-medium search-query');
@ -313,10 +317,17 @@
<div class="modal-body"> <div class="modal-body">
<div class="errorMessage"></div> <div class="errorMessage"></div>
<form class="form-horizontal"> <form class="form-horizontal">
<fieldset>
<div class="control-group"> <div class="control-group">
<label class="control-label" for="newLabelTitle"><spring:message code="NAME"/>:</label> <label class="control-label" for="newLabelTitle"><spring:message code="NAME"/>:</label>
<input class="control" name="title" id="newLabelTitle" type="text" required="required" <input class="control" name="title" id="newLabelTitle" type="text" required="required"
placeholder="<spring:message code="LABEL_NAME_HINT"/>" autofocus="autofocus" maxlength="255"/> placeholder="<spring:message code="LABEL_NAME_HINT"/>" autofocus="autofocus" maxlength="30"/>
</div>
<div id="colorGroup" class="input-group">
<label class="control-label" for="colorChooser"><spring:message code="CHOOSE_COLOR"/>:</label>
<input class="form-control" name="color" id="colorChooser" type="text" style="width: 70px" required="required"/>
<!--hack, maybe there is a compatibility problem with bootstrap-->
<span class="input-group-addon" style="display: inline-block; position: relative; top: 5px"><i></i></span>
</div> </div>
<!--div class="control-label"> <!--div class="control-label">
<input id="parentLblCheckbox" type="checkbox"> <input id="parentLblCheckbox" type="checkbox">
@ -329,7 +340,7 @@
<option value="3">-> Child2</option> <option value="3">-> Child2</option>
<option value="4">Dummy</option> <option value="4">Dummy</option>
</select--> </select-->
</fieldset>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">