use of org.olat.core.gui.components.form.flexible.impl.NameValuePair in project OpenOLAT by OpenOLAT.
the class AbstractFlexiTableRenderer method renderPageBackLink.
private void renderPageBackLink(StringOutput sb, FlexiTableComponent ftC, int page) {
boolean disabled = (page <= 0);
FlexiTableElementImpl ftE = ftC.getFlexiTableElement();
Form theForm = ftE.getRootForm();
sb.append("<li").append(" class='disabled'", disabled).append("><a href=\"");
if (disabled) {
sb.append("#");
} else {
sb.append("javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, true, new NameValuePair("page", Integer.toString(page - 1))));
}
sb.append("\">").append("«").append("</a></li>");
}
use of org.olat.core.gui.components.form.flexible.impl.NameValuePair in project OpenOLAT by OpenOLAT.
the class AbstractFlexiTableRenderer method renderFilterDropdown.
protected String renderFilterDropdown(StringOutput sb, FlexiTableElementImpl ftE, List<FlexiTableFilter> filters) {
Form theForm = ftE.getRootForm();
String dispatchId = ftE.getFormDispatchId();
StringBuilder selected = new StringBuilder(256);
sb.append("<div class='btn-group'>").append("<button id='table-button-filters-").append(dispatchId).append("' type='button' class='btn btn-default dropdown-toggle' data-toggle='dropdown'>").append("<i class='o_icon o_icon_filter o_icon-lg'> </i> <b class='caret'></b></button>").append("<div id='table-filters-").append(dispatchId).append("' class='hide'><ul class='o_dropdown list-unstyled' role='menu'>");
for (FlexiTableFilter filter : filters) {
if (FlexiTableFilter.SPACER.equals(filter)) {
sb.append("<li class='divider'></li>");
} else {
sb.append("<li><a href=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true, true, new NameValuePair("filter", filter.getFilter()))).append("\">").append("<i class='o_icon o_icon_check o_icon-fw'> </i> ", filter.isSelected());
if (filter.getIconLeftCSS() != null) {
sb.append("<i class='o_icon ").append(filter.getIconLeftCSS()).append("'> </i> ");
}
if (filter.getIconRenderer() != null) {
filter.getIconRenderer().render(sb, filter, ftE.getComponent(), ftE.getTranslator());
}
sb.append(filter.getLabel()).append("</a></li>");
if (filter.isSelected() && !filter.isShowAll()) {
if (selected.length() > 0)
selected.append(", ");
selected.append(filter.getLabel());
}
}
}
sb.append("</ul></div></div> ").append("<script type='text/javascript'>\n").append("/* <![CDATA[ */\n").append("jQuery(function() { o_popover('table-button-filters-").append(dispatchId).append("','table-filters-").append(dispatchId).append("'); });\n").append("/* ]]> */\n").append("</script>");
return selected.toString();
}
use of org.olat.core.gui.components.form.flexible.impl.NameValuePair in project OpenOLAT by OpenOLAT.
the class AbstractFlexiTableRenderer method renderBreadcrumbs.
protected void renderBreadcrumbs(StringOutput sb, FlexiTableElementImpl ftE, FlexiTreeTableNode crumb, String index) {
Form theForm = ftE.getRootForm();
String dispatchId = ftE.getFormItemComponent().getDispatchID();
sb.append("<li><a href=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true, true, new NameValuePair("tt-crumb", index))).append("\">").append(crumb.getCrump()).append("</a></li>");
}
use of org.olat.core.gui.components.form.flexible.impl.NameValuePair in project OpenOLAT by OpenOLAT.
the class MenuTreeRenderer method renderInsertionPoint.
private void renderInsertionPoint(StringOutput sb, Position positionToRender, int level, TreeNode node, URLBuilder ubu, AJAXFlags flags, MenuTree tree) {
if (tree.getInsertionPoint() != null && tree.getInsertionPoint().getPosition() == positionToRender && tree.getInsertionPoint().getNodeId().equals(node.getIdent())) {
sb.append("<li><div class='o_tree_l").append(level).append("'>").append("<span class=\"o_tree_leaf o_tree_oc_l").append(level).append("\"> </span>").append("<span class='o_tree_link o_tree_l").append(level).append(" o_insertion_point'><a href=\"");
ubu.buildHrefAndOnclick(sb, null, flags.isIframePostEnabled(), false, false, new NameValuePair(COMMAND_ID, COMMAND_TREENODE_INSERT_REMOVE), new NameValuePair(NODE_IDENT, node.getIdent()));
Translator pointTranslator = Util.createPackageTranslator(MenuTreeRenderer.class, tree.getTranslator().getLocale());
String pointTranslation = pointTranslator.translate("insertion.point");
sb.append("><span>").append(pointTranslation).append(" <i class='o_icon o_icon_remove'> </i></span>").append("</a></span></div></li>");
}
}
use of org.olat.core.gui.components.form.flexible.impl.NameValuePair in project OpenOLAT by OpenOLAT.
the class MenuTreeRenderer method renderLink.
private void renderLink(Renderer renderer, TreeNode curRoot, int level, boolean selected, boolean renderChildren, INode curSel, StringOutput target, URLBuilder ubu, AJAXFlags flags, MenuTree tree) {
int chdCnt = curRoot.getChildCount();
boolean iframePostEnabled = flags.isIframePostEnabled();
if (tree.getMenuTreeItem() != null) {
tree.getMenuTreeItem().trackVisibleNode(curRoot);
}
target.append("<span class='o_tree_link o_tree_l").append(level);
// add icon css class
if (selected) {
// add css class to identify active element
target.append(" active");
} else if (curSel == curRoot) {
// add css class to identify parents of active element
target.append(" active_parent");
}
boolean insertionSource = (tree.getTreeModel() instanceof InsertionTreeModel && ((InsertionTreeModel) tree.getTreeModel()).isSource(curRoot));
if (insertionSource) {
target.append(" o_insertion_source");
}
// reapply the same rules to the second link
if (level != 0 && chdCnt > 0) {
if (renderChildren) {
target.append(" o_tree_level_label_close");
} else {
target.append(" o_tree_level_label_open");
}
} else if (level != 0 && chdCnt == 0) {
target.append(" o_tree_level_label_leaf");
}
target.append("'>");
if (tree.isMultiSelect() && tree.getMenuTreeItem() != null) {
renderCheckbox(target, curRoot, tree);
}
// Build menu item URI
target.append("<a ");
boolean dirtyCheck = tree.getMenuTreeItem() == null || !tree.getMenuTreeItem().isNoDirtyCheckOnClick();
ubu.buildHrefAndOnclick(target, null, iframePostEnabled, dirtyCheck, true, new NameValuePair(COMMAND_ID, COMMAND_TREENODE_CLICKED), new NameValuePair(NODE_IDENT, curRoot.getIdent()));
// Add menu item title as alt hoover text
String alt = curRoot.getAltText();
if (alt != null) {
target.append(" title=\"").append(StringEscapeUtils.escapeHtml(alt).toString()).append("\"");
}
target.append(">");
String iconCssClass = curRoot.getIconCssClass();
if (iconCssClass != null) {
target.append("<i class='o_icon o_icon-fw ").append(iconCssClass).append("'></i> ");
}
renderDisplayTitle(renderer, target, curRoot, tree);
// display title and close menu item
appendDecorators(curRoot, target);
target.append("</a></span>");
}
Aggregations