Skip to content

Commit

Permalink
more improvements to scene panels
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Mar 22, 2016
1 parent 5a730ff commit a158d53
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 38 deletions.
Expand Up @@ -19,9 +19,15 @@
<body>
<wicket:extend>
<form wicket:id="mainForm" class="form-horizontal">
<div wicket:id="primaryDeltas"/>
<div wicket:id="secondaryDeltas"/>
<p/>
<div class="row">
<div class="col-md-6">
<div wicket:id="primaryDeltas"/>
</div>
<div class="col-md-6">
<div wicket:id="secondaryDeltas"/>
</div>
</div>

<div class="main-button-bar">
<a class="btn btn-default" wicket:id="back" />
</div>
Expand Down
Expand Up @@ -17,36 +17,33 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="form-horizontal">
<div class="box" style="width: auto; display: table;">
<div class="box-header with-border" wicket:id="headerPanel">
<h3 class="box-title" style="margin-right: 35px;">
<span wicket:id="changeType"/>
<span wicket:id="objectType"/>
<small>
<span wicket:id="nameLabel"/><span wicket:id="nameLink"/> <span wicket:id="description"/>
<span wicket:id="wrapperDisplayName"/>
</small>
</h3>
<div class="box-tools pull-right" wicket:id="optionButtons" />
</div>
<div class="box" wicket:id="box" style="margin-bottom: 0px;">
<div class="box-header with-border" wicket:id="headerPanel">
<h3 class="box-title" style="margin-right: 35px;">
<span wicket:id="changeType"/>
<span wicket:id="objectType"/>
<small>
<span wicket:id="nameLabel"/><span wicket:id="nameLink"/> <span wicket:id="description"/>
<span wicket:id="wrapperDisplayName"/>
</small>
</h3>
<div class="box-tools pull-right" wicket:id="optionButtons" />
</div>

<div wicket:id="body" class="box-body no-padding">
<table class="table table-striped table-hover table-bordered" wicket:id="itemsTable"
style="margin-bottom: 10px;">
<tr>
<th><wicket:message key="ScenePanel.item"/></th>
<th wicket:id="oldValueLabel"><wicket:message key="ScenePanel.oldValue"/></th>
<th wicket:id="newValueLabel"><wicket:message key="ScenePanel.newValue"/></th>
<th wicket:id="valueLabel"><wicket:message key="ScenePanel.value"/></th>
</tr>
<div wicket:id="items">
<div wicket:id="item"/>
</div>
</table>
<div wicket:id="partialScenes">
<div wicket:id="partialScene"/>
<div wicket:id="body" class="box-body no-padding">
<table class="table table-striped table-hover table-bordered" wicket:id="itemsTable">
<tr>
<th><wicket:message key="ScenePanel.item"/></th>
<th wicket:id="oldValueLabel"><wicket:message key="ScenePanel.oldValue"/></th>
<th wicket:id="newValueLabel"><wicket:message key="ScenePanel.newValue"/></th>
<th wicket:id="valueLabel"><wicket:message key="ScenePanel.value"/></th>
</tr>
<div wicket:id="items">
<div wicket:id="item"/>
</div>
</table>
<div wicket:id="partialScenes" style="padding: 10px;">
<div wicket:id="partialScene"/>
</div>
</div>
</div>
Expand Down
Expand Up @@ -31,24 +31,24 @@
import com.evolveum.midpoint.web.component.data.column.LinkPanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.model.*;

import java.io.Serializable;
import java.util.List;

/**
* @author mederly
*/
public class ScenePanel extends BasePanel<SceneDto> {

private static final String ID_BOX = "box";
private static final String STRIPED_CLASS = "striped";
private static final String ID_ITEMS_TABLE = "itemsTable";
private static final String ID_ITEMS = "items";
Expand Down Expand Up @@ -91,8 +91,32 @@ protected void onEvent(AjaxRequestTarget target) {
private void initLayout() {
final IModel<SceneDto> model = getModel();

WebMarkupContainer box = new WebMarkupContainer(ID_BOX);
box.add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() {

@Override
public String getObject() {
SceneDto dto = model.getObject();
if (dto.getChangeType() == null) {
return null;
}

switch (dto.getChangeType()) {
case ADD:
return "box-success";
case DELETE:
return "box-danger";
case MODIFY:
return "box-info";
default:
return null;
}
}
}));
add(box);

WebMarkupContainer headerPanel = new WebMarkupContainer(ID_HEADER_PANEL);
add(headerPanel);
box.add(headerPanel);

headerPanel.add(new SceneButtonPanel(ID_OPTION_BUTTONS, model) {
@Override
Expand Down Expand Up @@ -190,7 +214,7 @@ public boolean isVisible() {
return !wrapper.isMinimized();
}
});
add(body);
box.add(body);

WebMarkupContainer itemsTable = new WebMarkupContainer(ID_ITEMS_TABLE);
itemsTable.add(new VisibleEnableBehaviour() {
Expand Down Expand Up @@ -235,7 +259,9 @@ protected void populateItem(ListItem<SceneItemDto> item) {
itemsTable.add(items);
body.add(itemsTable);

ListView<SceneDto> partialScenes = new ListView<SceneDto>(ID_PARTIAL_SCENES, new PropertyModel<List<SceneDto>>(model, SceneDto.F_PARTIAL_SCENES)) {
ListView<SceneDto> partialScenes = new ListView<SceneDto>(ID_PARTIAL_SCENES,
new PropertyModel<List<SceneDto>>(model, SceneDto.F_PARTIAL_SCENES)) {

@Override
protected void populateItem(ListItem<SceneDto> item) {
ScenePanel panel = new ScenePanel(ID_PARTIAL_SCENE, item.getModel());
Expand Down

0 comments on commit a158d53

Please sign in to comment.