ItEr45S19CUTraspasoDeResponsabilidadesTraballoEntreUnidadesPlanificacion: Moving Type enum to package top level from member class
This commit is contained in:
parent
9de00bd136
commit
fa80634ebf
3 changed files with 81 additions and 58 deletions
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.web.planner.reassign.ReassignController.Type;
|
||||
import org.zkoss.ganttz.data.Task;
|
||||
|
||||
/**
|
||||
|
|
@ -38,11 +37,11 @@ public class ReassignConfiguration {
|
|||
return new ReassignConfiguration(type, date);
|
||||
}
|
||||
|
||||
private ReassignController.Type type;
|
||||
private Type type;
|
||||
|
||||
private LocalDate date;
|
||||
|
||||
private ReassignConfiguration(ReassignController.Type type, LocalDate date) {
|
||||
private ReassignConfiguration(Type type, LocalDate date) {
|
||||
this.type = type;
|
||||
Validate.isTrue(!type.needsAssociatedDate() || date != null);
|
||||
this.date = date == null ? new LocalDate() : date;
|
||||
|
|
@ -69,3 +68,4 @@ public class ReassignConfiguration {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,61 +52,6 @@ import org.zkoss.zul.Window;
|
|||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class ReassignController extends GenericForwardComposer {
|
||||
|
||||
public enum Type {
|
||||
ALL {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("All");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsAssociatedDate() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
FROM_TODAY {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("From Today");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsAssociatedDate() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
FROM_CHOOSEN {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("From Choosen");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsAssociatedDate() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
public static Type fromRadio(Radio selectedItem) {
|
||||
return Type.valueOf(selectedItem.getValue());
|
||||
}
|
||||
|
||||
public Radio createRadio() {
|
||||
Radio result = new Radio();
|
||||
result.setLabel(getName());
|
||||
result.setValue(this.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
public abstract boolean needsAssociatedDate();
|
||||
|
||||
}
|
||||
|
||||
public static void openOn(org.zkoss.zk.ui.Component component,
|
||||
IConfigurationResult configurationResult) {
|
||||
Window result = (Window) Executions.createComponents(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* This file is part of ###PROJECT_NAME###
|
||||
*
|
||||
* Copyright (C) 2009 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/>.
|
||||
*/
|
||||
package org.navalplanner.web.planner.reassign;
|
||||
|
||||
import static org.navalplanner.web.I18nHelper._;
|
||||
|
||||
import org.zkoss.zul.Radio;
|
||||
public enum Type {
|
||||
ALL {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("All");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsAssociatedDate() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
FROM_TODAY {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("From Today");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsAssociatedDate() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
FROM_CHOOSEN {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("From Choosen");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsAssociatedDate() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
public static Type fromRadio(Radio selectedItem) {
|
||||
return Type.valueOf(selectedItem.getValue());
|
||||
}
|
||||
|
||||
public Radio createRadio() {
|
||||
Radio result = new Radio();
|
||||
result.setLabel(getName());
|
||||
result.setValue(this.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
public abstract boolean needsAssociatedDate();
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue