diff --git a/ganttzk/pom.xml b/ganttzk/pom.xml
index bded8822c..a76c27784 100644
--- a/ganttzk/pom.xml
+++ b/ganttzk/pom.xml
@@ -112,8 +112,8 @@
commons-logging
- commons-lang
- commons-lang
+ org.apache.commons
+ commons-lang3
commons-collections
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/CommandContextualized.java b/ganttzk/src/main/java/org/zkoss/ganttz/CommandContextualized.java
index 07f5f1721..c75db4723 100644
--- a/ganttzk/src/main/java/org/zkoss/ganttz/CommandContextualized.java
+++ b/ganttzk/src/main/java/org/zkoss/ganttz/CommandContextualized.java
@@ -21,7 +21,7 @@
package org.zkoss.ganttz;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.zkoss.ganttz.extensions.ICommand;
import org.zkoss.ganttz.extensions.IContext;
import org.zkoss.zk.ui.event.Event;
@@ -31,8 +31,7 @@ import org.zkoss.zul.Button;
class CommandContextualized {
- public static CommandContextualized create(ICommand command,
- IContext context) {
+ public static CommandContextualized create(ICommand command, IContext context) {
return new CommandContextualized(command, context);
}
@@ -52,28 +51,31 @@ class CommandContextualized {
}
Button toButton() {
- if (button != null) {
+ if ( button != null ) {
return button;
}
+
Button result = new Button();
- if (StringUtils.isEmpty(command.getImage())) {
+ if ( StringUtils.isEmpty(command.getImage()) ) {
result.setLabel(command.getName());
} else {
result.setImage(command.getImage());
result.setTooltiptext(command.getName());
}
- if (command.isDisabled()) {
+
+ if ( command.isDisabled() ) {
result.setDisabled(true);
} else {
result.addEventListener(Events.ON_CLICK, new EventListener() {
-
@Override
public void onEvent(Event event) {
doAction();
}
});
}
+
button = result;
+
return result;
}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/DatesMapperOnInterval.java b/ganttzk/src/main/java/org/zkoss/ganttz/DatesMapperOnInterval.java
index 3931cbbb5..e7092a549 100644
--- a/ganttzk/src/main/java/org/zkoss/ganttz/DatesMapperOnInterval.java
+++ b/ganttzk/src/main/java/org/zkoss/ganttz/DatesMapperOnInterval.java
@@ -19,15 +19,13 @@
* along with this program. If not, see .
*/
-/**
- *
- */
+
package org.zkoss.ganttz;
import java.math.BigDecimal;
import java.math.RoundingMode;
-import org.apache.commons.lang.math.Fraction;
+import org.apache.commons.lang3.math.Fraction;
import org.joda.time.DateTime;
import org.joda.time.Duration;
import org.joda.time.LocalDate;
@@ -43,16 +41,13 @@ public class DatesMapperOnInterval implements IDatesMapper {
public DatesMapperOnInterval(int horizontalSize, Interval interval) {
this.horizontalSize = horizontalSize;
this.interval = interval;
- this.millisecondsPerPixel = interval.getLengthBetween().getMillis()
- / horizontalSize;
- this.pixelsPerDay = Fraction.getFraction(horizontalSize, interval
- .getDaysBetween().getDays());
+ this.millisecondsPerPixel = interval.getLengthBetween().getMillis() / horizontalSize;
+ this.pixelsPerDay = Fraction.getFraction(horizontalSize, interval.getDaysBetween().getDays());
}
@Override
public LocalDate toDate(int pixels) {
- int daysInto = Fraction.getFraction(pixels, 1).divideBy(pixelsPerDay)
- .intValue();
+ int daysInto = Fraction.getFraction(pixels, 1).divideBy(pixelsPerDay).intValue();
return getInterval().getStart().plusDays(daysInto);
}
@@ -71,29 +66,29 @@ public class DatesMapperOnInterval implements IDatesMapper {
private int toPixels(Fraction proportion) {
try {
- return proportion.multiplyBy(Fraction.getFraction(horizontalSize, 1))
- .intValue();
+ return proportion.multiplyBy(Fraction.getFraction(horizontalSize, 1)).intValue();
} catch (ArithmeticException e) {
double d = Math.log10(horizontalSize);
int scale = (int) d + 1;
+
BigDecimal quotient = new BigDecimal(proportion.getNumerator())
- .divide(new BigDecimal(proportion.getDenominator()), scale,
- RoundingMode.HALF_UP);
- return quotient.multiply(new BigDecimal(horizontalSize))
- .intValue();
+ .divide(new BigDecimal(proportion.getDenominator()), scale, RoundingMode.HALF_UP);
+
+ return quotient.multiply(new BigDecimal(horizontalSize)).intValue();
}
}
@Override
public int toPixels(ReadableDuration duration) {
- DateTime end = getInterval().getStart().toDateTimeAtStartOfDay()
- .plus(duration);
+ DateTime end = getInterval().getStart().toDateTimeAtStartOfDay().plus(duration);
+
return toPixels(getProportion(end));
}
@Override
public int toPixelsAbsolute(long milliseconds) {
DateTime date = new DateTime(milliseconds);
+
return this.toPixels(getProportion(date));
}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/DependencyComponent.java b/ganttzk/src/main/java/org/zkoss/ganttz/DependencyComponent.java
index 45d6315db..90ee65899 100644
--- a/ganttzk/src/main/java/org/zkoss/ganttz/DependencyComponent.java
+++ b/ganttzk/src/main/java/org/zkoss/ganttz/DependencyComponent.java
@@ -26,7 +26,7 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
-import org.apache.commons.lang.Validate;
+import org.apache.commons.lang3.Validate;
import org.zkoss.ganttz.data.Dependency;
import org.zkoss.ganttz.data.DependencyType;
import org.zkoss.ganttz.data.GanttDate;
@@ -62,13 +62,13 @@ public class DependencyComponent extends XulElement implements AfterCompose {
private boolean violated = false;
- public DependencyComponent(TaskComponent source, TaskComponent destination,
- Dependency dependency) {
+ public DependencyComponent(TaskComponent source, TaskComponent destination, Dependency dependency) {
Validate.notNull(dependency);
Validate.notNull(source);
Validate.notNull(destination);
Validate.isTrue(source.getTask() == dependency.getSource());
Validate.isTrue(destination.getTask() == dependency.getDestination());
+
this.type = dependency.getType();
this.source = source;
this.destination = destination;
@@ -76,8 +76,7 @@ public class DependencyComponent extends XulElement implements AfterCompose {
}
private void sendCSSUpdate() {
- response("constraintViolated", new AuInvoke(DependencyComponent.this,
- "setCSSClass", getCSSClass()));
+ response("constraintViolated", new AuInvoke(DependencyComponent.this, "setCSSClass", getCSSClass()));
}
public String getCSSClass() {
@@ -88,9 +87,10 @@ public class DependencyComponent extends XulElement implements AfterCompose {
@Override
public void afterCompose() {
- if (listenerAdded) {
+ if ( listenerAdded ) {
return;
}
+
listener = new PropertyChangeListener() {
@Override
@@ -98,11 +98,11 @@ public class DependencyComponent extends XulElement implements AfterCompose {
redrawDependency();
}
};
+
this.source.getTask().addFundamentalPropertiesChangeListener(listener);
this.destination.getTask().addFundamentalPropertiesChangeListener(listener);
- violationListener = Constraint
- .onlyOnZKExecution(new IConstraintViolationListener() {
+ violationListener = Constraint.onlyOnZKExecution(new IConstraintViolationListener() {
@Override
public void constraintViolated(Constraint constraint, GanttDate value) {
@@ -116,16 +116,17 @@ public class DependencyComponent extends XulElement implements AfterCompose {
sendCSSUpdate();
}
});
- this.dependency.addConstraintViolationListener(violationListener,
- Mode.RECEIVE_PENDING);
+
+ this.dependency.addConstraintViolationListener(violationListener, Mode.RECEIVE_PENDING);
listenerAdded = true;
}
public void removeChangeListeners() {
- if (!listenerAdded) {
+ if ( !listenerAdded ) {
return;
}
+
this.source.getTask().removePropertyChangeListener(listener);
this.destination.getTask().removePropertyChangeListener(listener);
listenerAdded = false;
@@ -169,6 +170,7 @@ public class DependencyComponent extends XulElement implements AfterCompose {
public boolean contains(Task task) {
Task sourceTask = getSource().getTask();
Task destinationTask = getDestination().getTask();
+
return task.equals(sourceTask) || task.equals(destinationTask);
}
@@ -191,8 +193,8 @@ public class DependencyComponent extends XulElement implements AfterCompose {
public boolean hasSameSourceAndDestination(Dependency dependency) {
Task sourceTask = source.getTask();
Task destinationTask = destination.getTask();
- return sourceTask.equals(dependency.getSource())
- && destinationTask.equals(dependency.getDestination());
+
+ return sourceTask.equals(dependency.getSource()) && destinationTask.equals(dependency.getDestination());
}
protected void renderProperties(ContentRenderer renderer) throws IOException{
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/IDatesMapper.java b/ganttzk/src/main/java/org/zkoss/ganttz/IDatesMapper.java
index edf124f8c..a9a7473ec 100644
--- a/ganttzk/src/main/java/org/zkoss/ganttz/IDatesMapper.java
+++ b/ganttzk/src/main/java/org/zkoss/ganttz/IDatesMapper.java
@@ -21,7 +21,7 @@
package org.zkoss.ganttz;
-import org.apache.commons.lang.math.Fraction;
+import org.apache.commons.lang3.math.Fraction;
import org.joda.time.LocalDate;
import org.joda.time.ReadableDuration;
import org.zkoss.ganttz.util.Interval;
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java b/ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java
index b3bb12f30..f2384950f 100644
--- a/ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java
+++ b/ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java
@@ -29,7 +29,7 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.LocalDate;
@@ -71,8 +71,6 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
LeftTasksTreeRow getAboveRow();
}
- private static final Log LOG = LogFactory.getLog(LeftTasksTreeRow.class);
-
private final Task task;
private Label nameLabel;
@@ -101,20 +99,22 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
private final IDisabilityConfiguration disabilityConfiguration;
- public static LeftTasksTreeRow create(
- IDisabilityConfiguration disabilityConfiguration, Task bean,
- ILeftTasksTreeNavigator taskDetailnavigator, Planner planner) {
- return new LeftTasksTreeRow(disabilityConfiguration, bean,
- taskDetailnavigator, planner);
+ public static LeftTasksTreeRow create(IDisabilityConfiguration disabilityConfiguration,
+ Task bean,
+ ILeftTasksTreeNavigator taskDetailnavigator,
+ Planner planner) {
+
+ return new LeftTasksTreeRow(disabilityConfiguration, bean, taskDetailnavigator, planner);
}
private LeftTasksTreeRow(IDisabilityConfiguration disabilityConfiguration,
- Task task, ILeftTasksTreeNavigator leftTasksTreeNavigator,
- Planner planner) {
+ Task task,
+ ILeftTasksTreeNavigator leftTasksTreeNavigator,
+ Planner planner) {
+
this.disabilityConfiguration = disabilityConfiguration;
this.task = task;
- this.dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, Locales
- .getCurrent());
+ this.dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, Locales.getCurrent());
this.leftTasksTreeNavigator = leftTasksTreeNavigator;
this.planner = planner;
}
@@ -143,13 +143,14 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
* the component that has received focus
*/
public void userWantsDateBox(Component component) {
- if (component == startDateTextBox) {
- if (canChangeStartDate()) {
+ if ( component == startDateTextBox ) {
+ if ( canChangeStartDate() ) {
createDateBox(startDateTextBox);
}
}
- if (component == endDateTextBox) {
- if (canChangeEndDate()) {
+
+ if ( component == endDateTextBox ) {
+ if ( canChangeEndDate() ) {
createDateBox(endDateTextBox);
}
}
@@ -185,7 +186,7 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
public void focusGoUp(int position) {
LeftTasksTreeRow aboveDetail = leftTasksTreeNavigator.getAboveRow();
- if (aboveDetail != null) {
+ if ( aboveDetail != null ) {
aboveDetail.receiveFocus(position);
}
}
@@ -200,7 +201,7 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
public void focusGoDown(int position) {
LeftTasksTreeRow belowDetail = leftTasksTreeNavigator.getBelowRow();
- if (belowDetail != null) {
+ if ( belowDetail != null ) {
belowDetail.receiveFocus(position);
} else {
getListDetails().getGoingDownInLastArrowCommand().doAction();
@@ -212,6 +213,7 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
while (!(current instanceof LeftTasksTree)) {
current = current.getParent();
}
+
return (LeftTasksTree) current;
}
@@ -220,13 +222,15 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
List textBoxes = getTextBoxes();
int position = textBoxes.indexOf(textbox);
switch (navigation) {
- case UP:
+ case UP:
focusGoUp(position);
break;
- case DOWN:
+
+ case DOWN:
focusGoDown(position);
break;
- default:
+
+ default:
throw new RuntimeException("case not covered: " + navigation);
}
}
@@ -261,7 +265,7 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
}
private void registerTextboxesListeners() {
- if (disabilityConfiguration.isTreeEditable()) {
+ if ( disabilityConfiguration.isTreeEditable() ) {
registerKeyboardListener(nameBox);
registerOnChange(nameBox);
registerKeyboardListener(startDateTextBox);
@@ -275,9 +279,9 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
private void findComponents(Treerow row) {
List