public static String getMediatorHTML(Mediator mediator, boolean last, String position,
ServletConfig config, Mediator before, Mediator after,
Locale locale) {
ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE, locale);
MediatorService mediatorInfo
= MediatorStore.getInstance().getMediatorService(mediator.getTagLocalName());
String mediatorName = mediatorInfo != null ?
mediatorInfo.getDisplayName() : mediator.getTagLocalName();
String url = "../" + mediatorInfo.getUIFolderName() + "-mediator/images/mediator-icon.gif";
String mediatorIconURL = mediatorInfo != null && isIconAvailable(mediatorInfo, config) ?
url : "./images/node-normal.gif";
String html = "<div class=\"minus-icon\" onclick=\"treeColapse(this)\"></div>";
if (!(mediator instanceof AbstractListMediator) ||
((AbstractListMediator) mediator).getList().isEmpty()) {
html = "<div class=\"dot-icon\"></div>";
}
html += "<div class=\"mediators\" style=\"background-image: url(" + mediatorIconURL
+ ") !important\" id=\"mediator-" + position + "\">" +
"<a class=\"mediatorLink\" id=\"mediator-" + position + "\">"
+ mediatorName + "</a><div class=\"sequenceToolbar\" style=\"display:none\" >";
if (mediator instanceof AbstractListMediator) {
if (mediatorInfo == null || mediatorInfo.isAddChildEnabled()) {
html += "<div><a class=\"addChildStyle\">"
+ bundle.getString("sequence.add.child.action") + "</a></div>"
+ "<div class=\"sequenceSep\"> </div>";
}
if (mediatorInfo == null || mediatorInfo.isAddSiblingEnabled()) {
html += "<div><a class=\"addSiblingStyle\">"
+ bundle.getString("sequence.add.sibling.action") + "</a></div>"
+ "<div class=\"sequenceSep\"> </div>";
}
html += "<div><a class=\"deleteStyle\">"
+ bundle.getString("sequence.delete.action") + "</a></div>";
if (before != null && MediatorStore.getInstance().getMediatorService(
before.getTagLocalName()).isMovingAllowed() && mediatorInfo.isMovingAllowed()) {
html += "<div class=\"sequenceSep\"> </div>"
+ "<div><a class=\"moveUpStyle\" title=\""
+ bundle.getString("mediator.move.up") + "\"></a></div>";
}
if (after != null && MediatorStore.getInstance().getMediatorService(
after.getTagLocalName()).isMovingAllowed() && mediatorInfo.isMovingAllowed()) {
html += "<div class=\"sequenceSep\"> </div>"
+ "<div><a class=\"moveDownStyle\" title=\""
+ bundle.getString("mediator.move.down") + "\"></a></div>";
}
html += "</div></div>";
AbstractListMediator listMediator = (AbstractListMediator) mediator;
if (!listMediator.getList().isEmpty()) {
if (last) {
html = "<li>" + html;
} else {
html = "<li class=\"vertical-line\">" + html;
}
html += "<div class=\"branch-node\"></div>";
html += "<ul class=\"child-list\">";
int count = listMediator.getList().size();
int mediatorPosition = 0;
for (Mediator med : listMediator.getList()) {
count--;
Mediator beforeMed = mediatorPosition > 0 ?
listMediator.getList().get(mediatorPosition - 1) : null;
Mediator afterMed = mediatorPosition + 1 < listMediator.getList().size() ?
listMediator.getList().get(mediatorPosition + 1) : null;
html += getMediatorHTML(med, count==0, position + "."
+ mediatorPosition, config, beforeMed, afterMed, locale);
mediatorPosition++;
}
html += "</ul>";
} else {
if (!last) {
html = "<li>" + html + "<div class=\"vertical-line-alone\"/>";
} else {
html = "<li>" + html;
}
}
} else {
if (mediatorInfo == null || mediatorInfo.isAddSiblingEnabled()) {
html += "<div><a class=\"addSiblingStyle\">"
+ bundle.getString("sequence.add.sibling.action") + "</a></div>"
+ "<div class=\"sequenceSep\"> </div>";
}
html += "<div><a class=\"deleteStyle\">"
+ bundle.getString("sequence.delete.action") + "</a></div>";
if (before != null && MediatorStore.getInstance().getMediatorService(
before.getTagLocalName()).isMovingAllowed() && mediatorInfo.isMovingAllowed()) {
html += "<div class=\"sequenceSep\"> </div>"
+ "<div><a class=\"moveUpStyle\" title=\""
+ bundle.getString("mediator.move.up") + "\"></a></div>";
}
if (after != null && MediatorStore.getInstance().getMediatorService(
after.getTagLocalName()).isMovingAllowed() && mediatorInfo.isMovingAllowed()) {
html += "<div class=\"sequenceSep\"> </div>"
+ "<div><a class=\"moveDownStyle\" title=\""
+ bundle.getString("mediator.move.down") + "\"></a></div>";
}