Skip to content
Snippets Groups Projects
Commit cbaf0c0e authored by srosse's avatar srosse
Browse files

OO-1068: use btn-group justified as segmented view

parent 7645d8ea
No related branches found
No related tags found
No related merge requests found
......@@ -144,7 +144,7 @@ public class LayoutMain3ColsController extends MainLayoutBasicController impleme
* column width settings
* @param defaultConfiguration The layout width configuration to be used
*/
public LayoutMain3ColsController(UserRequest ureq, WindowControl wControl, Component col1, Component col2, Component col3,
private LayoutMain3ColsController(UserRequest ureq, WindowControl wControl, Component col1, Component col2, Component col3,
String layoutConfigKey, LayoutMain3ColsConfig defaultConfiguration) {
super(ureq, wControl);
layoutMainVC = createVelocityContainer("main_3cols");
......
......@@ -83,7 +83,12 @@ public class SegmentViewComponent extends AbstractComponent {
setDirty(true);
}
public void addSegment(Component link, boolean selected) {
public void addSegment(Link link, boolean selected) {
if(selected) {
link.setCustomEnabledLinkCSS("btn btn-primary");
} else {
link.setCustomEnabledLinkCSS("btn btn-default");
}
segments.add(link);
if(selected) {
selectedSegments.add(link);
......@@ -121,8 +126,8 @@ public class SegmentViewComponent extends AbstractComponent {
public void select(Component component) {
if(segments.contains(component)) {
selectedSegments.clear();
selectedSegments.add(component);
deselectAllSegments();
select(component);
setDirty(true);
}
}
......@@ -142,10 +147,10 @@ public class SegmentViewComponent extends AbstractComponent {
}
} else {
if(!isAllowMultipleSelection()) {
selectedSegments.clear();
deselectAllSegments();
}
e = new SegmentViewEvent(SegmentViewEvent.SELECTION_EVENT, segment.getComponentName(), count);
selectedSegments.add(segment);
selectSegment(segment);
}
break;
}
......@@ -157,6 +162,22 @@ public class SegmentViewComponent extends AbstractComponent {
fireEvent(ureq, e);
}
}
private void selectSegment(Component segment) {
if(segment instanceof Link) {
((Link)segment).setCustomEnabledLinkCSS("btn btn-primary");
}
selectedSegments.add(segment);
}
private void deselectAllSegments() {
for(Component segment:selectedSegments) {
if(segment instanceof Link) {
((Link)segment).setCustomEnabledLinkCSS("btn btn-default");
}
}
selectedSegments.clear();
}
@Override
public ComponentRenderer getHTMLRendererSingleton() {
......
......@@ -35,19 +35,19 @@ public class SegmentViewRenderer extends DefaultComponentRenderer {
SegmentViewComponent component = (SegmentViewComponent)source;
if(component.isEmpty()) return;
sb.append("<ul class='o_segments nav nav-tabs'>");
sb.append("<div class='o_segments btn-group btn-group-justified'>");
for(Component segment:component.getSegments()) {
sb.append("<li");
/*sb.append("<li");
if(component.isSelected(segment)) {
sb.append(" class='active'");
}
sb.append(">");
sb.append(">");*/
ComponentRenderer subRenderer = segment.getHTMLRendererSingleton();
Translator subTranslator = segment.getTranslator();
subRenderer.render(renderer, sb, segment, ubu, subTranslator, renderResult, args);
sb.append("</li>");
//sb.append("</li>");
}
sb.append("</ul>");
sb.append("</div>");
}
}
\ No newline at end of file
.o_breadcumb {
position:relative;
.o_breadcumb_close {
position: absolute;
top: 8px;
right: 15px;
right: 16px;
}
}
\ No newline at end of file
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment