[Bug #953] Simulated click on progress button when changing type
FEA: ItEr75S04BugFixing
This commit is contained in:
parent
40ec28426e
commit
a22ba2e85b
3 changed files with 20 additions and 9 deletions
|
|
@ -595,6 +595,12 @@ public class Planner extends HtmlMacroComponent {
|
|||
}
|
||||
}
|
||||
|
||||
public void forcedShowAdvances() {
|
||||
if (!isShowingAdvances) {
|
||||
showAdvances();
|
||||
}
|
||||
}
|
||||
|
||||
public void showAdvances() {
|
||||
Button showAdvancesButton = (Button) getFellow("showAdvances");
|
||||
if (disabilityConfiguration.isAdvancesEnabled()) {
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ public class TaskGroup extends TaskElement {
|
|||
*
|
||||
*/
|
||||
public BigDecimal getAdvancePercentage(ProgressType progressType) {
|
||||
if (isTaskRoot(this)) {
|
||||
if (isTaskRoot(this) && (progressType != null)) {
|
||||
switch (progressType) {
|
||||
case ALL_NUMHOURS:
|
||||
return getProgressAllByNumHours();
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ import org.zkoss.zk.ui.event.Event;
|
|||
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.Button;
|
||||
import org.zkoss.zul.Checkbox;
|
||||
import org.zkoss.zul.Combobox;
|
||||
import org.zkoss.zul.Comboitem;
|
||||
|
|
@ -93,6 +94,7 @@ public class CompanyPlanningController implements Composer {
|
|||
}
|
||||
|
||||
private Combobox cbProgressTypes;
|
||||
private Button btnShowAdvances;
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(org.zkoss.zk.ui.Component comp) {
|
||||
|
|
@ -138,19 +140,14 @@ public class CompanyPlanningController implements Composer {
|
|||
if (cbProgressTypes == null) {
|
||||
cbProgressTypes = (Combobox) planner.getFellow("cbProgressTypes");
|
||||
}
|
||||
if (btnShowAdvances == null) {
|
||||
btnShowAdvances = (Button) planner.getFellow("showAdvances");
|
||||
}
|
||||
|
||||
cbProgressTypes.setModel(new ListModelList(ProgressType.getAll()));
|
||||
cbProgressTypes.setItemRenderer(new ProgressTypeRenderer());
|
||||
|
||||
// FIXME: Select default configuration option
|
||||
cbProgressTypes.invalidate();
|
||||
|
||||
Comboitem item = findListitemValue(cbProgressTypes,
|
||||
getProgressTypeFromConfiguration());
|
||||
|
||||
if (item != null) {
|
||||
cbProgressTypes.setSelectedItem(item);
|
||||
}
|
||||
|
||||
// Update completion of tasks on selecting new progress type
|
||||
cbProgressTypes.addEventListener(Events.ON_SELECT, new EventListener() {
|
||||
|
|
@ -158,6 +155,7 @@ public class CompanyPlanningController implements Composer {
|
|||
@Override
|
||||
public void onEvent(Event event) {
|
||||
planner.updateCompletion(getSelectedProgressType().toString());
|
||||
planner.forcedShowAdvances();
|
||||
}
|
||||
|
||||
private ProgressType getSelectedProgressType() {
|
||||
|
|
@ -168,6 +166,13 @@ public class CompanyPlanningController implements Composer {
|
|||
|
||||
cbProgressTypes.setVisible(true);
|
||||
|
||||
Comboitem item = findListitemValue(cbProgressTypes,
|
||||
getProgressTypeFromConfiguration());
|
||||
|
||||
if (item != null) {
|
||||
cbProgressTypes.setSelectedItem(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ProgressTypeRenderer implements ComboitemRenderer {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue