ItEr60S04ValidacionEProbasFuncionaisItEr59S04: [Bug #592] Initial fix for bug.

It needs some changes in CSS in order to work properly with long order names.
This commit is contained in:
Manuel Rego Casasnovas 2010-08-17 16:26:01 +02:00 committed by Lorenzo Tilve
parent b5186d9933
commit 3bdc973c00
6 changed files with 114 additions and 33 deletions

View file

@ -83,8 +83,14 @@ public class LeftTasksTree extends HtmlMacroComponent {
if (task.isContainer()) {
expandWhenOpened((TaskContainer) task, item);
}
Component row = Executions.getCurrent().createComponents(
"~./ganttz/zul/leftTasksTreeRow.zul", item, null);
Component row;
if (disabilityConfiguration.isTreeEditable()) {
row = Executions.getCurrent().createComponents(
"~./ganttz/zul/leftTasksTreeRow.zul", item, null);
} else {
row = Executions.getCurrent().createComponents(
"~./ganttz/zul/leftTasksTreeRowLabels.zul", item, null);
}
leftTasksTreeRow.doAfterCompose(row);
List<Object> rowChildren = row.getChildren();
List<Treecell> treeCells = ComponentsFinder.findComponentsOfType(

View file

@ -41,6 +41,7 @@ import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Treecell;
import org.zkoss.zul.api.Label;
import org.zkoss.zul.api.Treerow;
public class LeftTasksTreeRow extends GenericForwardComposer {
@ -55,10 +56,16 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
private final Task task;
private Label nameLabel;
private Textbox nameBox;
private Label startDateLabel;
private Textbox startDateTextBox;
private Label endDateLabel;
private Textbox endDateTextBox;
private Datebox startDateBox;
@ -254,22 +261,24 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
}
private void registerListeners() {
registerKeyboardListener(nameBox);
registerKeyboardListener(startDateTextBox);
registerKeyboardListener(endDateTextBox);
if (disabilityConfiguration.isTreeEditable()) {
registerKeyboardListener(nameBox);
registerKeyboardListener(startDateTextBox);
registerKeyboardListener(endDateTextBox);
registerOnEnterListener(startDateTextBox);
registerOnEnterListener(endDateTextBox);
registerOnEnterListener(startDateTextBox);
registerOnEnterListener(endDateTextBox);
registerOnEnterOpenDateBox(startDateBox);
registerOnEnterOpenDateBox(endDateBox);
registerOnEnterOpenDateBox(startDateBox);
registerOnEnterOpenDateBox(endDateBox);
registerBlurListener(startDateBox);
registerBlurListener(endDateBox);
registerBlurListener(startDateBox);
registerBlurListener(endDateBox);
registerOnChange(nameBox);
registerOnChange(startDateBox);
registerOnChange(endDateBox);
registerOnChange(nameBox);
registerOnChange(startDateBox);
registerOnChange(endDateBox);
}
}
private void findComponents(Treerow row) {
@ -293,7 +302,11 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
}
private void findComponentsForNameCell(Treecell treecell) {
nameBox = (Textbox) treecell.getChildren().get(0);
if (disabilityConfiguration.isTreeEditable()) {
nameBox = (Textbox) treecell.getChildren().get(0);
} else {
nameLabel = (Label) treecell.getChildren().get(0);
}
}
private void registerKeyboardListener(final Textbox textBox) {
@ -337,14 +350,22 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
}
private void findComponentsForStartDateCell(Treecell treecell) {
startDateTextBox = findTextBoxOfCell(treecell);
startDateBox = findDateBoxOfCell(treecell);
if (disabilityConfiguration.isTreeEditable()) {
startDateTextBox = findTextBoxOfCell(treecell);
startDateBox = findDateBoxOfCell(treecell);
} else {
startDateLabel = (Label) treecell.getChildren().get(0);
}
}
private void findComponentsForEndDateCell(Treecell treecell) {
endDateBox = findDateBoxOfCell(treecell);
endDateBox.setDisabled(true);
endDateTextBox = findTextBoxOfCell(treecell);
if (disabilityConfiguration.isTreeEditable()) {
endDateBox = findDateBoxOfCell(treecell);
endDateBox.setDisabled(true);
endDateTextBox = findTextBoxOfCell(treecell);
} else {
endDateLabel = (Label) treecell.getChildren().get(0);
}
}
private void registerBlurListener(final Datebox datebox) {
@ -371,20 +392,26 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
}
private void updateComponents() {
getNameBox().setValue(task.getName());
getNameBox().setDisabled(!canRenameTask());
getNameBox().setTooltiptext(task.getName());
if (disabilityConfiguration.isTreeEditable()) {
getNameBox().setValue(task.getName());
getNameBox().setDisabled(!canRenameTask());
getNameBox().setTooltiptext(task.getName());
getStartDateBox().setValue(task.getBeginDate());
getStartDateBox().setDisabled(!canChangeStartDate());
getStartDateTextBox().setDisabled(!canChangeStartDate());
getStartDateBox().setValue(task.getBeginDate());
getStartDateBox().setDisabled(!canChangeStartDate());
getStartDateTextBox().setDisabled(!canChangeStartDate());
getEndDateBox().setValue(task.getEndDate());
getEndDateBox().setDisabled(!canChangeEndDate());
getEndDateTextBox().setDisabled(!canChangeEndDate());
getEndDateBox().setValue(task.getEndDate());
getEndDateBox().setDisabled(!canChangeEndDate());
getEndDateTextBox().setDisabled(!canChangeEndDate());
getStartDateTextBox().setValue(asString(task.getBeginDate()));
getEndDateTextBox().setValue(asString(task.getEndDate()));
getStartDateTextBox().setValue(asString(task.getBeginDate()));
getEndDateTextBox().setValue(asString(task.getEndDate()));
} else {
nameLabel.setValue(task.getName());
startDateLabel.setValue(asString(task.getBeginDate()));
endDateLabel.setValue(asString(task.getEndDate()));
}
}
private boolean canChangeStartDate() {

View file

@ -43,4 +43,6 @@ public interface IDisabilityConfiguration {
public boolean isExpandPlanningViewCharts();
public boolean isTreeEditable();
}

View file

@ -137,6 +137,8 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
private boolean renamingTasksEnabled = true;
private boolean treeEditable = true;
// private String identifier = null;
private IDetailItemModificator firstLevelModificators = SeveralModificators
@ -414,4 +416,13 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
return Collections.unmodifiableList(postGraphChangeListeners);
}
public void setTreeEditable(boolean treeEditable) {
this.treeEditable = treeEditable;
}
@Override
public boolean isTreeEditable() {
return treeEditable;
}
}

View file

@ -0,0 +1,34 @@
<!--
This file is part of NavalPlan
Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
Desenvolvemento Tecnolóxico de Galicia
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<treerow sclass="taskdetail_grid">
<zscript><![CDATA[
]]>
</zscript>
<treecell>
<label class="task_title"/>
</treecell>
<treecell>
<label />
</treecell>
<treecell>
<label />
</treecell>
</treerow>

View file

@ -32,10 +32,10 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.Map.Entry;
import org.joda.time.LocalDate;
import org.navalplanner.business.calendars.entities.BaseCalendar;
@ -68,8 +68,8 @@ import org.navalplanner.web.planner.ITaskElementAdapter;
import org.navalplanner.web.planner.chart.Chart;
import org.navalplanner.web.planner.chart.ChartFiller;
import org.navalplanner.web.planner.chart.EarnedValueChartFiller;
import org.navalplanner.web.planner.chart.EarnedValueChartFiller.EarnedValueType;
import org.navalplanner.web.planner.chart.IChartFiller;
import org.navalplanner.web.planner.chart.EarnedValueChartFiller.EarnedValueType;
import org.navalplanner.web.planner.order.BankHolidaysMarker;
import org.navalplanner.web.planner.order.OrderPlanningModel;
import org.navalplanner.web.planner.tabs.MultipleTabsPlannerController;
@ -512,6 +512,7 @@ public abstract class CompanyPlanningModel implements ICompanyPlanningModel {
configuration.setExpandAllEnabled(false);
configuration.setFlattenTreeEnabled(false);
configuration.setRenamingTasksEnabled(false);
configuration.setTreeEditable(false);
}
private void addAdditionalCommands(