Changed listbox to compact combobox for selecting advances calculation mode

FEA: ItEr64S04AdvancesVisualization
This commit is contained in:
Lorenzo Tilve 2010-12-03 12:57:14 +01:00
parent 56e7f01474
commit b3be811ffe
3 changed files with 43 additions and 21 deletions

View file

@ -48,11 +48,6 @@ planner = self;
</listbox>
<!-- Progress type -->
<hbox id="hboxProgressType" visible="false">
<label>${i18n:_('Progress')}:</label>
<listbox id="lbProgressTypes"
mold="select" />
</hbox>
<button id="showCriticalPath" onClick="planner.showCriticalPath();"
image="/common/img/ico_criticalpath.png"
@ -71,10 +66,15 @@ planner = self;
image="/common/img/ico_flatten.png"
tooltiptext="${i18n:_('Flatten/Unflatten tree')}"
sclass="planner-command" />
<button id="showAdvances" onClick="planner.showAdvances();"
image="/common/img/ico_progress.png"
tooltiptext="${i18n:_('Show/Hide Advances')}"
sclass="planner-command"/>
sclass="planner-command" />
<combobox id="cbProgressTypes" width="1px" visible="false"
sclass="progress-types" />
<button id="showReportedHours" onClick="planner.showReportedHours();"
image="/common/img/ico_costs.png"
tooltiptext="${i18n:_('Show/Hide reported hours')}"

View file

@ -53,10 +53,10 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Composer;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Constraint;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.SimpleListModel;
import org.zkoss.zul.Vbox;
@ -98,7 +98,7 @@ public class CompanyPlanningController implements Composer {
.retrieve();
}
private Listbox lbProgressTypes;
private Combobox cbProgressTypes;
@Override
public void doAfterCompose(org.zkoss.zk.ui.Component comp) {
@ -141,20 +141,22 @@ public class CompanyPlanningController implements Composer {
}
private void initializeListboxProgressTypes() {
if (lbProgressTypes == null) {
lbProgressTypes = (Listbox) planner.getFellow("lbProgressTypes");
if (cbProgressTypes == null) {
cbProgressTypes = (Combobox) planner.getFellow("cbProgressTypes");
}
lbProgressTypes.setModel(new SimpleListModel(ProgressType.getAll()));
cbProgressTypes.setModel(new SimpleListModel(ProgressType.getAll()));
// Select default configuration option
lbProgressTypes.renderAll();
Listitem item = findListitemValue(lbProgressTypes, getProgressTypeFromConfiguration());
// FIXME: Select default configuration option
// cbProgressTypes.renderAll();
cbProgressTypes.invalidate();
Comboitem item = findListitemValue(cbProgressTypes,
getProgressTypeFromConfiguration());
if (item != null) {
lbProgressTypes.setSelectedItem(item);
cbProgressTypes.setSelectedItem(item);
}
// Update completion of tasks on selecting new progress type
lbProgressTypes.addEventListener(Events.ON_SELECT, new EventListener() {
cbProgressTypes.addEventListener(Events.ON_SELECT, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
@ -162,16 +164,17 @@ public class CompanyPlanningController implements Composer {
}
private ProgressType getSelectedProgressType() {
return (ProgressType) lbProgressTypes.getSelectedItem().getValue();
return (ProgressType) cbProgressTypes.getSelectedItem().getValue();
}
});
planner.getFellow("hboxProgressType").setVisible(true);
cbProgressTypes.setVisible(true);
}
private Listitem findListitemValue(Listbox listbox, ProgressType value) {
private Comboitem findListitemValue(Combobox listbox, ProgressType value) {
for (Object each : listbox.getChildren()) {
final Listitem item = (Listitem) each;
final Comboitem item = (Comboitem) each;
if (value.equals(item.getValue())) {
return item;
}

View file

@ -1471,3 +1471,22 @@ display:none;
.earned-parameter-column {
white-space: nowrap;
}
.progress-types.z-combobox {
position: relative;
left: -3px;
}
.progress-types.z-combobox .z-combobox-inp {
width:0;
margin:0;
padding:0;
border:0;
border-right: solid 1px #86A4BE;
color: transparent;
background: transparent;
}
.progress-types.z-combobox-focus {
border:0;
}