Merged feature/WISE-211-iconSupportOnLabels into develop

This commit is contained in:
Paulo Gustavo Veiga 2014-04-26 15:44:36 -03:00
commit d1a5bd56f9
15 changed files with 405 additions and 22 deletions

View File

@ -30,7 +30,7 @@ INSERT INTO COLLABORATION (id, colaborator_id, properties_id, mindmap_id, role_i
INSERT INTO COLLABORATION_PROPERTIES (id, starred, mindmap_properties) VALUES (2, 1, '{zoom:0.8}');
INSERT INTO COLLABORATION (id, colaborator_id, properties_id, mindmap_id, role_id) VALUES (2, 2, 2, 1, 1);
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color) VALUES (1, 'test label', 1, NULL, '#ff0000');
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color, iconName) VALUES (1, 'test label', 1, NULL, '#ff0000', 'glyphicon glyphicon-tag');
INSERT INTO R_LABEL_MINDMAP (label_id, mindmap_id) VALUES (1,1);
INSERT INTO MINDMAP (id, title, xml, description, public, creation_date, edition_date, creator_id, tags, last_editor_id)
@ -38,9 +38,9 @@ INSERT INTO MINDMAP (id, title, xml, description, public, creation_date, edition
INSERT INTO COLLABORATION_PROPERTIES (id, starred, mindmap_properties) VALUES (3, 1, '{zoom:0.8}');
INSERT INTO COLLABORATION (id, colaborator_id, properties_id, mindmap_id, role_id) VALUES (3, 2, 3, 2, 0);
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color) VALUES (2, 'admin label', 2, NULL, '#0000ff');
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color, iconName) VALUES (2, 'admin label', 2, NULL, '#0000ff', 'glyphicon glyphicon-star');
INSERT INTO R_LABEL_MINDMAP (label_id, mindmap_id) VALUES (2,2);
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color) VALUES (3, 'mindmap shared', 2, NULL, '#00ff00');
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color, iconName) VALUES (3, 'mindmap shared', 2, NULL, '#00ff00', 'glyphicon glyphicon-share');
INSERT INTO R_LABEL_MINDMAP (label_id, mindmap_id) VALUES (3,1);
COMMIT;

View File

@ -37,7 +37,8 @@ CREATE TABLE LABEL (
title VARCHAR(30),
creator_id INTEGER NOT NULL,
parent_label_id INTEGER,
color VARCHAR(7) NOT NULL
color VARCHAR(7) NOT NULL,
iconName VARCHAR(50) NOT NULL
--FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
);

View File

@ -34,7 +34,7 @@ INSERT INTO COLLABORATION (id, colaborator_id, properties_id, mindmap_id, role_i
INSERT INTO COLLABORATION_PROPERTIES (id, starred, mindmap_properties) VALUES (2, 1, '{zoom:0.8}');
INSERT INTO COLLABORATION (id, colaborator_id, properties_id, mindmap_id, role_id) VALUES (2, 2, 2, 1, 1);
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color) VALUES (1, 'test label', 1, NULL, '#ff0000');
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color, iconName) VALUES (1, 'test label', 1, NULL, '#ff0000', 'glyphicon glyphicon-tag');
INSERT INTO R_LABEL_MINDMAP (label_id, mindmap_id) VALUES (1,1);
INSERT INTO MINDMAP (id, title, xml, description, public, creation_date, edition_date, creator_id, tags, last_editor_id)
@ -42,9 +42,9 @@ INSERT INTO MINDMAP (id, title, xml, description, public, creation_date, edition
INSERT INTO COLLABORATION_PROPERTIES (id, starred, mindmap_properties) VALUES (3, 1, '{zoom:0.8}');
INSERT INTO COLLABORATION (id, colaborator_id, properties_id, mindmap_id, role_id) VALUES (3, 2, 3, 2, 0);
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color) VALUES (2, 'admin label', 2, NULL, '#0000ff');
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color, iconName) VALUES (2, 'admin label', 2, NULL, '#0000ff', 'glyphicon glyphicon-star');
INSERT INTO R_LABEL_MINDMAP (label_id, mindmap_id) VALUES (2,2);
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color) VALUES (3, 'mindmap shared', 2, NULL, '#00ff00');
INSERT INTO LABEL (id, title, creator_id, parent_label_id, color, iconName) VALUES (3, 'mindmap shared', 2, NULL, '#00ff00', 'glyphicon glyphicon-share');
INSERT INTO R_LABEL_MINDMAP (label_id, mindmap_id) VALUES (3,1);
COMMIT;

View File

@ -58,6 +58,7 @@ CREATE TABLE LABEL (
creator_id INTEGER NOT NULL,
parent_label_id INTEGER,
color VARCHAR(7) NOT NULL,
iconName VARCHAR(50) NOT NULL,
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id),
FOREIGN KEY (parent_label_id) REFERENCES LABEL (id)
ON DELETE CASCADE

View File

@ -12,6 +12,7 @@ public class Label {
@NotNull private User creator;
@Nullable private Label parent;
@NotNull private String color;
@NotNull private String iconName;
public void setParent(@Nullable Label parent) {
this.parent = parent;
@ -57,6 +58,15 @@ public class Label {
this.color = color;
}
@NotNull
public String getIconName() {
return iconName;
}
public void setIconName(@NotNull String iconName) {
this.iconName = iconName;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
@ -76,4 +86,5 @@ public class Label {
result = 31 * result + (parent != null ? parent.hashCode() : 0);
return result;
}
}

View File

@ -65,10 +65,18 @@ public class RestLabel {
label.setColor(color);
}
public void setIconName(@NotNull final String iconName) {
label.setIconName(iconName);
}
@Nullable public String getColor() {
return label.getColor();
}
@Nullable public String getIconName() {
return label.getIconName();
}
@JsonIgnore
public Label getDelegated() {
return label;

View File

@ -37,6 +37,7 @@ public class LabelValidator implements Validator {
private void validateLabel(@NotNull final Label label, @NotNull final Errors errors) {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", Messages.FIELD_REQUIRED);
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "color", Messages.FIELD_REQUIRED);
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "iconName", Messages.FIELD_REQUIRED);
final String title = label.getTitle();
ValidatorUtils.rejectIfExceeded(
errors,

View File

@ -11,6 +11,7 @@
</id>
<property name="title"/>
<property name="color"/>
<property name="iconName"/>
<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"/>
</class>

View File

@ -145,6 +145,7 @@ NEW=New
MIND_FILE=File
PARENT_LABEL=Nest label under
COLOR=Color
ICON=Icon
CHOOSE_LABEL=Choose a label
SELECT_LABEL=Please select a label
NO_SEARCH_RESULT=No mindmap available for the selected filter criteria
@ -281,6 +282,132 @@ OPEN_OFFICE_EXPORT_FORMAT_DETAILS=Get your map as OpenOffice Write Document
MINDJET_EXPORT_FORMAT=(BETA) MindJet 8.x
MINDJET_EXPORT_FORMAT_DETAILS=Export your maps in MindJet 8.x format
MINDMAP_IS_LOCKED=Mindmap is locked for edition.
# icons..
ASTERISK=Asterisk
PLUS=Plus
EURO=Euro
MINUS=Minus
CLOUD=Cloud
ENVELOPE=Envelope
PENCIL=Pencil
CLASS=Glass
MUSIC=Music
HEART=Heart
STAR=Star
STAR-EMPTY=Empty Star
USER=User
FILM=Film
OK=Ok
REMOVE=Remove
SIGNAL=Signal
COG=Cog
TRASH=Trash
FILE=File
TIME=Time
DOWNLOAD-ALT=Download
DOWNLOAD=Download
UPLOAD=Upload
INBOX=Inbox
REPEAT=Repeat
REFRESH=Refresh
LIST-ALT=List
LOCK=Lock
FLAG=Flag
HEADPHONES=Headphones
GRCODE=GR Code
BARCODE=Barcode
TAG=Tag
TAGS=Tags
BOOK=Book
BOOKMARK=Bookmark
PRING=Print
CAMERA=Camera
LIST=List
FACETIME-VIDEO=Facetime Video
PICTURE=Picture
MAP-MARKER=Map Maker
ADJUST=Adjust
TINT=Tint
EDIT=Edit
CHECK=Check
CHEVRON-LEFT=Chevron Left
CHEVRON-RIGHT=Chevron Right
PLUS-SIGN=Plus Sign
MINUS-SIGN=Minus Sign
REMOVE-SIGN=Remove Sign
OK-SIGN=Ok Sign
QUESTION-SIGN=Question Sign
INFO-SIGN=Info Sign
SCREENSHOT=Screenshot
REMOVE-CIRCLE=Remove Circle
OK-CIRCLE=Ok Circle
BAN-CIRCLE=Ban Circle
ARROW-LEFT=Arrow Left
ARROW-RIGHT=Arrow Right
ARROW-UP=Arrow Up
ARROW-DOWN=Arrow Down
SHARE-ALT=Share
EXCLAMATION-SIGN=Exclamation
GIFT=Gift
LEAF=Leaf
FIRE=Fire
EYE-OPEN=Open eye
EYE-CLOSE=Closed eye
WARNING-SIGN=Warning
PLANE=Plane
CALENDAR=Calendar
RANDOM=Random
COMMENT=Comment
MAGNET=Magnet
CHEVRON-UP=Chevrop Up
CHEVRON-DOWN=Chevron Down
SHOPPING-CART=Shopping
FOLDER-CLOSE=Closed Folder
FOLDER-OPEN=Open Folder
HDD=HDD
BULLHORN=Bullhorn
BELL=Bell
CERTIFICATE=Certificate
THUMBS-UP=Thumbs up
THUMBS-DOWN=Thumbs down
HAND-RIGHT=Hand right
HAND-LEFT=Hand left
HAND-UP=Hang up
HAND-DOWN=Hang down
CIRCLE-ARROW-RIGHT=Circle right
CIRCLE-ARROW-LEFT=Circle left
CIRCLE-ARROW-UP=Circle up
CIRCLE-ARROW-DOWN=Circle down
GLOBE=Globe
WRENCH=Wrench
TASKS=Tasks
FILTER=Filter
BRIEFCASE=Briefcase
PAPERCLIP=Paperclip
HEART-EMPTY=Empty Heart
LINK=Link
PHONE=Phone
PUSHPIN=Pushpin
USD=USD
GBP=GBP
UNCHECKED=Unchecked
FLASH=Flash
RECORD=Record
SAVED=Saved
SEND=Send
FLOPPY-DISK=Floppy Disk
TRANSFER
CUTLERY=Cutlery
HEADER=Header
COMPRESSED=Compressed
EARPHONE=Earphone
PHONE-ALT=Phone
TOWER=Tower
STATS=Stats
COPYRIGTH-MARK=Copyright
REGISTRATION-MARK=Registration Mark
CLOUD-DOWNLOAD=Cloud Download
CLOUD-UPLOAD=Cloud Updload

View File

@ -352,8 +352,50 @@ abbr[title] {
padding:0px;
margin:0px;
}
#footerContainer > li.active {
padding:0px;
margin:0px;
}
#foldersContainer > ul > li > a {
padding: 8px 15px;
white-space: nowrap;
}
/* ----------------------------- Icons ----------------------------------- */
#defaultIcon {
background: #eee;
border: 1px solid #ccc !important;
}
#defaultIcon:hover {
background-color: #C8C8C8;
}
.colorInput:hover {
background-color: #C8C8C8;
}
.bs-glyphicons > ul {
padding-left: 10px;
overflow-x: hidden;
}
.bs-glyphicons > ul > li {
float: left;
width: 12%;
height: 20%;
padding: 10px;
font-size: 10px;
line-height: 1.4;
text-align: center;
border: 1px solid #fff;
background-color: #f9f9f9;
cursor: pointer;
}
.bs-glyphicons > ul > li:hover {
background-color: #C8C8C8;
}

View File

@ -66,7 +66,6 @@ jQuery.fn.dataTableExt.removeSelectedRows = function () {
updateStatusToolbar();
};
jQuery.fn.dialogForm = function (options) {
var containerId = this[0].id;
@ -78,7 +77,8 @@ jQuery.fn.dialogForm = function (options) {
// Clear form values ...
if (options.clearForm == undefined || options.clearForm) {
$("#" + containerId).find('input[name!="color"]').val('');
//FIXME: icon and color should be handled as exceptions..
$("#" + containerId).find('input[name!="color"]input[name!="iconName"]').val('');
}
// Clear button "Saving..." state ...
@ -177,7 +177,6 @@ jQuery.fn.dialogForm = function (options) {
};
// Update toolbar events ...
function updateStatusToolbar() {
@ -301,10 +300,15 @@ $(function () {
postUpdate: function(data, id) {
createLabelItem(data, id);
if (mapIds.length > 0) {
linkLabelToMindmap(mapIds, {id: id, title: data.title, color: data.color});
linkLabelToMindmap(mapIds, {id: id, title: data.title, color: data.color, icon: data.icon});
}
}
});
// Setting sizes to label icon list
var dropDownHeight = $(window).height()/3;
$("#labelIconItems ul").height(dropDownHeight);
var dropDownWidth = $(window).width()/3;
$("#labelIconItems ul").width(dropDownWidth);
}
);
@ -531,16 +535,37 @@ $(function () {
$("#foldersContainer ul").css('overflow-x', 'hidden');
$("#foldersContainer ul").height(maxHeight);
});
//init popovers...
var icons = $(".bs-glyphicons-list li");
icons.each(function() {
$(this).popover({
animation: true,
placement: "auto",
trigger: 'hover',
//FIXME: Which is the best way to use messages.properties here?
content: ($(this).attr('class').replace('glyphicon glyphicon-',''))
})
});
icons.on("click", function(){
var defaultIcon = $("#defaultIcon");
//remove current icon
defaultIcon.find("i").remove();
var myClass = $(this).attr("class");
defaultIcon.prepend("<i class='" + myClass +"'></i>");
defaultIcon.closest("#iconGroup").find('input').val(myClass);
});
});
/*--------------------------------------------- Label actions --------------------------------------------------**/
function createLabelItem(data, id) {
var labelId = data.id || id;
var labelItem = $("<li data-filter=\"" + data.title + "\">");
labelItem.append(
"<a href=\"#\"> " +
"<i class=\"glyphicon glyphicon-tag labelIcon\"></i>" +
"<i class=\"" + data.iconName + " labelIcon\"></i>" +
"<div class='labelColor' style='background: " + data.color + "'></div>" +
"<div class='labelName labelNameList'>" + data.title + "</div>" +
"<button id='deleteLabelBtn' class='close closeLabel' labelid=\""+ labelId +"\">x</button>" +
@ -611,9 +636,10 @@ function prepareLabelList(labels) {
//append items to dropdown
$.each(labels, function(index, value) {
labelList.append(
$('<li class="chooseLabel"></li>').attr('value', value.id).attr('color', value.color)
$('<li class="chooseLabel"></li>').attr('value', value.id).attr('color', value.color).attr('icon', value.icon)
.append(
'<a href="#" onclick="return false">' +
"<div class='labelIcon " + value.iconName + "'></div>" +
"<div class='labelColor' style='background: " + value.color + "'></div>" +
"<div class='labelName'>" + value.title + "</div>" +
'</a>')

View File

@ -0,0 +1,132 @@
<%@page pageEncoding="UTF-8" %>
<ul class="bs-glyphicons-list">
<li class="glyphicon glyphicon-asterisk"></li>
<li class="glyphicon glyphicon-plus"></li>
<li class="glyphicon glyphicon-euro"></li>
<li class="glyphicon glyphicon-minus"></li>
<li class="glyphicon glyphicon-cloud"></li>
<li class="glyphicon glyphicon-envelope"></li>
<li class="glyphicon glyphicon-pencil"></li>
<li class="glyphicon glyphicon-glass"></li>
<li class="glyphicon glyphicon-music"></li>
<li class="glyphicon glyphicon-search"></li>
<li class="glyphicon glyphicon-heart"></li>
<li class="glyphicon glyphicon-star"></li>
<li class="glyphicon glyphicon-star-empty"></li>
<li class="glyphicon glyphicon-user"></li>
<li class="glyphicon glyphicon-film"></li>
<li class="glyphicon glyphicon-ok"></li>
<li class="glyphicon glyphicon-remove"></li>
<li class="glyphicon glyphicon-signal"></li>
<li class="glyphicon glyphicon-cog"></li>
<li class="glyphicon glyphicon-trash"></li>
<li class="glyphicon glyphicon-home"></li>
<li class="glyphicon glyphicon-file"></li>
<li class="glyphicon glyphicon-time"></li>
<li class="glyphicon glyphicon-download-alt"></li>
<li class="glyphicon glyphicon-download"></li>
<li class="glyphicon glyphicon-upload"></li>
<li class="glyphicon glyphicon-inbox"></li>
<li class="glyphicon glyphicon-repeat"></li>
<li class="glyphicon glyphicon-refresh"></li>
<li class="glyphicon glyphicon-list-alt"></li>
<li class="glyphicon glyphicon-lock"></li>
<li class="glyphicon glyphicon-flag"></li>
<li class="glyphicon glyphicon-headphones"></li>
<li class="glyphicon glyphicon-qrcode"></li>
<li class="glyphicon glyphicon-barcode"></li>
<li class="glyphicon glyphicon-tag"></li>
<li class="glyphicon glyphicon-tags"></li>
<li class="glyphicon glyphicon-book"></li>
<li class="glyphicon glyphicon-bookmark"></li>
<li class="glyphicon glyphicon-print"></li>
<li class="glyphicon glyphicon-camera"></li>
<li class="glyphicon glyphicon-list"></li>
<li class="glyphicon glyphicon-facetime-video"></li>
<li class="glyphicon glyphicon-picture"></li>
<li class="glyphicon glyphicon-map-marker"></li>
<li class="glyphicon glyphicon-adjust"></li>
<li class="glyphicon glyphicon-tint"></li>
<li class="glyphicon glyphicon-edit"></li>
<li class="glyphicon glyphicon-share"></li>
<li class="glyphicon glyphicon-check"></li>
<li class="glyphicon glyphicon-chevron-left"></li>
<li class="glyphicon glyphicon-chevron-right"></li>
<li class="glyphicon glyphicon-plus-sign"></li>
<li class="glyphicon glyphicon-minus-sign"></li>
<li class="glyphicon glyphicon-remove-sign"></li>
<li class="glyphicon glyphicon-ok-sign"></li>
<li class="glyphicon glyphicon-question-sign"></li>
<li class="glyphicon glyphicon-info-sign"></li>
<li class="glyphicon glyphicon-screenshot"></li>
<li class="glyphicon glyphicon-remove-circle"></li>
<li class="glyphicon glyphicon-ok-circle"></li>
<li class="glyphicon glyphicon-ban-circle"></li>
<li class="glyphicon glyphicon-arrow-left"></li>
<li class="glyphicon glyphicon-arrow-right"></li>
<li class="glyphicon glyphicon-arrow-up"></li>
<li class="glyphicon glyphicon-arrow-down"></li>
<li class="glyphicon glyphicon-share-alt"></li>
<li class="glyphicon glyphicon-exclamation-sign"></li>
<li class="glyphicon glyphicon-gift"></li>
<li class="glyphicon glyphicon-leaf"></li>
<li class="glyphicon glyphicon-fire"></li>
<li class="glyphicon glyphicon-eye-open"></li>
<li class="glyphicon glyphicon-eye-close"></li>
<li class="glyphicon glyphicon-warning-sign"></li>
<li class="glyphicon glyphicon-plane"></li>
<li class="glyphicon glyphicon-calendar"></li>
<li class="glyphicon glyphicon-random"></li>
<li class="glyphicon glyphicon-comment"></li>
<li class="glyphicon glyphicon-magnet"></li>
<li class="glyphicon glyphicon-chevron-up"></li>
<li class="glyphicon glyphicon-chevron-down"></li>
<li class="glyphicon glyphicon-shopping-cart"></li>
<li class="glyphicon glyphicon-folder-close"></li>
<li class="glyphicon glyphicon-folder-open"></li>
<li class="glyphicon glyphicon-hdd"></li>
<li class="glyphicon glyphicon-bullhorn"></li>
<li class="glyphicon glyphicon-bell"></li>
<li class="glyphicon glyphicon-certificate"></li>
<li class="glyphicon glyphicon-thumbs-up"></li>
<li class="glyphicon glyphicon-thumbs-down"></li>
<li class="glyphicon glyphicon-hand-right"></li>
<li class="glyphicon glyphicon-hand-left"></li>
<li class="glyphicon glyphicon-hand-up"></li>
<li class="glyphicon glyphicon-hand-down"></li>
<li class="glyphicon glyphicon-circle-arrow-right"></li>
<li class="glyphicon glyphicon-circle-arrow-left"></li>
<li class="glyphicon glyphicon-circle-arrow-up"></li>
<li class="glyphicon glyphicon-circle-arrow-down"></li>
<li class="glyphicon glyphicon-globe"></li>
<li class="glyphicon glyphicon-wrench"></li>
<li class="glyphicon glyphicon-tasks"></li>
<li class="glyphicon glyphicon-filter"></li>
<li class="glyphicon glyphicon-briefcase"></li>
<li class="glyphicon glyphicon-paperclip"></li>
<li class="glyphicon glyphicon-heart-empty"></li>
<li class="glyphicon glyphicon-link"></li>
<li class="glyphicon glyphicon-phone"></li>
<li class="glyphicon glyphicon-pushpin"></li>
<li class="glyphicon glyphicon-usd"></li>
<li class="glyphicon glyphicon-gbp"></li>
<li class="glyphicon glyphicon-unchecked"></li>
<li class="glyphicon glyphicon-flash"></li>
<li class="glyphicon glyphicon-record"></li>
<li class="glyphicon glyphicon-saved"></li>
<li class="glyphicon glyphicon-send"></li>
<li class="glyphicon glyphicon-floppy-disk"></li>
<li class="glyphicon glyphicon-transfer"></li>
<li class="glyphicon glyphicon-cutlery"></li>
<li class="glyphicon glyphicon-header"></li>
<li class="glyphicon glyphicon-compressed"></li>
<li class="glyphicon glyphicon-earphone"></li>
<li class="glyphicon glyphicon-phone-alt"></li>
<li class="glyphicon glyphicon-tower"></li>
<li class="glyphicon glyphicon-stats"></li>
<li class="glyphicon glyphicon-copyright-mark"></li>
<li class="glyphicon glyphicon-registration-mark"></li>
<li class="glyphicon glyphicon-cloud-download"></li>
<li class="glyphicon glyphicon-cloud-upload"></li>
</ul>

View File

@ -122,6 +122,12 @@
});
});
</script>
<!--script type="text/javascript" language="javascript">
$(function(){
$("#labelIconList").load("jsp/labelIconList.jsp");
});
</script-->
</head>
<body>
<jsp:include page="header.jsp">
@ -338,10 +344,23 @@
<div id="colorGroup" class="form-group">
<label class="col-md-3 control-label" for="colorChooser"><spring:message code="COLOR"/>:</label>
<div class="col-md-1">
<input class="form-control" name="color" id="colorChooser" style="display: none" type="text" required="required" value="#000000"/>
<input class="form-control" name="color" id="colorChooser" style="display: none" required="required" value="#000000"/>
<span class="input-group-addon colorInput"><i></i></span>
</div>
</div>
<div id="iconGroup" class="form-group">
<label class="col-md-3 control-label" for="iconChooser"><spring:message code="ICON"/>:</label>
<input class="form-control" name="iconName" id="iconChooser" style="display: none" required="required" value="glyphicon glyphicon-tag"/>
<div class="col-md-1">
<div class="btn dropdown-toggle" id="defaultIcon" data-toggle="dropdown">
<i class="glyphicon glyphicon-tag"></i>
</div>
<div id="labelIconList" class="dropdown-menu bs-glyphicons"></div>
<div id="labelIconItems" class="dropdown-menu bs-glyphicons">
<jsp:include page="labelIconList.jsp"/>
</div>
</div>
</div>
</fieldset>
</form>
</div>

View File

@ -30,6 +30,7 @@ public class RestLabelITCase {
private String userEmail;
private static final String COLOR = "#000000";
private static final String ICON = "glyphicon glyphicon-tag";
@BeforeClass
void createUser() {
@ -45,11 +46,11 @@ public class RestLabelITCase {
// Create a new label
final String title1 = "Label 1 - " + mediaType.toString();
addNewLabel(requestHeaders, template, title1, COLOR);
addNewLabel(requestHeaders, template, title1, COLOR, ICON);
// Create a new label
final String title2 = "Label 2 - " + mediaType.toString();
addNewLabel(requestHeaders, template, title2, COLOR);
addNewLabel(requestHeaders, template, title2, COLOR, ICON);
// Check that the label has been created ...
final RestLabelList restLabelList = getLabels(requestHeaders, template);
@ -83,7 +84,7 @@ public class RestLabelITCase {
final RestTemplate template = RestHelper.createTemplate( userEmail + ":" + "admin");
try {
addNewLabel(requestHeaders, template, null, COLOR);
addNewLabel(requestHeaders, template, null, COLOR, ICON);
fail("Wrong response");
} catch (HttpClientErrorException e) {
final String responseBodyAsString = e.getResponseBodyAsString();
@ -91,12 +92,21 @@ public class RestLabelITCase {
}
try {
addNewLabel(requestHeaders, template, "title12345", null);
addNewLabel(requestHeaders, template, "title12345", null, ICON);
fail("Wrong response");
} catch (HttpClientErrorException e) {
final String responseBodyAsString = e.getResponseBodyAsString();
assert (responseBodyAsString.contains("Required field cannot be left blank"));
}
try {
addNewLabel(requestHeaders, template, "title12345", COLOR, null);
fail("Wrong response");
} catch (HttpClientErrorException e) {
final String responseBodyAsString = e.getResponseBodyAsString();
assert (responseBodyAsString.contains("Required field cannot be left blank"));
}
}
@Test(dataProviderClass = RestHelper.class, dataProvider="ContentType-Provider-Function")
@ -105,7 +115,7 @@ public class RestLabelITCase {
final RestTemplate template = RestHelper.createTemplate( userEmail + ":" + "admin");
final String title = "title to delete";
final URI resourceUri = addNewLabel(requestHeaders, template, title, COLOR);
final URI resourceUri = addNewLabel(requestHeaders, template, title, COLOR, ICON);
// Now remove it ...
template.delete(RestHelper.HOST_PORT + resourceUri.toString());
@ -119,7 +129,7 @@ public class RestLabelITCase {
}
static URI addNewLabel(@NotNull HttpHeaders requestHeaders, @NotNull RestTemplate template, @Nullable String title, @Nullable String color ) throws IOException, WiseMappingException {
static URI addNewLabel(@NotNull HttpHeaders requestHeaders, @NotNull RestTemplate template, @Nullable String title, @Nullable String color, @Nullable String icon) throws IOException, WiseMappingException {
final RestLabel restLabel = new RestLabel();
if (title != null) {
restLabel.setTitle(title);
@ -127,6 +137,9 @@ public class RestLabelITCase {
if (color != null) {
restLabel.setColor(color);
}
if (icon != null) {
restLabel.setIconName(icon);
}
// Create a new label ...
HttpEntity<RestLabel> createUserEntity = new HttpEntity<RestLabel>(restLabel, requestHeaders);

View File

@ -40,6 +40,7 @@ import static org.testng.Assert.fail;
public class RestMindmapITCase {
private String userEmail = "admin@wisemapping.com";
private static final String ICON = "glyphicon glyphicon-tag";
@BeforeClass
void createUser() {
@ -251,7 +252,7 @@ public class RestMindmapITCase {
// Create a new label
final String titleLabel = "Label 1 - " + mediaType.toString();
final URI labelUri = RestLabelITCase.addNewLabel(requestHeaders, template, titleLabel, COLOR);
final URI labelUri = RestLabelITCase.addNewLabel(requestHeaders, template, titleLabel, COLOR, ICON);
// Create a sample map ...
final String mapTitle = "Maps 1 - " + mediaType.toString();