Don't pollute throws clauses
Extracting method that produces a warning when failing to set the sort property of a Column. FEA: ItEr75S08MigrationZK5
This commit is contained in:
parent
7e759bafed
commit
7bc19f827d
5 changed files with 30 additions and 28 deletions
|
|
@ -29,6 +29,8 @@ import java.util.Date;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.zkoss.ganttz.util.ComponentsFinder;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
|
|
@ -48,6 +50,7 @@ import org.zkoss.zul.Radio;
|
|||
import org.zkoss.zul.Textbox;
|
||||
import org.zkoss.zul.Timebox;
|
||||
import org.zkoss.zul.api.Checkbox;
|
||||
import org.zkoss.zul.api.Column;
|
||||
|
||||
/**
|
||||
* Utilities class. <br />
|
||||
|
|
@ -57,6 +60,8 @@ import org.zkoss.zul.api.Checkbox;
|
|||
*/
|
||||
public class Util {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(Util.class);
|
||||
|
||||
private Util() {
|
||||
}
|
||||
|
||||
|
|
@ -615,4 +620,13 @@ public class Util {
|
|||
}
|
||||
}
|
||||
|
||||
public static void setSort(Column column, String sortSpec) {
|
||||
try {
|
||||
column.setSort(sortSpec);
|
||||
} catch (Exception e) {
|
||||
LOG.error("failed to set sort property for: " + column + " with: "
|
||||
+ sortSpec, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,17 +336,14 @@ public class AssignedTaskQualityFormsToOrderElementController extends
|
|||
}
|
||||
}
|
||||
|
||||
private void appendDetails(Row row, TaskQualityForm taskQualityForm)
|
||||
throws ClassNotFoundException, InstantiationException,
|
||||
IllegalAccessException {
|
||||
private void appendDetails(Row row, TaskQualityForm taskQualityForm) {
|
||||
Detail details = new Detail();
|
||||
details.setParent(row);
|
||||
details.appendChild(appendGridItems(row, taskQualityForm));
|
||||
details.setOpen(false);
|
||||
}
|
||||
|
||||
private Grid appendGridItems(Row row, TaskQualityForm taskQualityForm)
|
||||
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
|
||||
private Grid appendGridItems(Row row, TaskQualityForm taskQualityForm) {
|
||||
Grid gridItems = new Grid();
|
||||
|
||||
gridItems.setMold("paging");
|
||||
|
|
@ -362,8 +359,7 @@ public class AssignedTaskQualityFormsToOrderElementController extends
|
|||
return gridItems;
|
||||
}
|
||||
|
||||
private void renderColumns(Grid gridItems)
|
||||
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
|
||||
private void renderColumns(Grid gridItems) {
|
||||
|
||||
Columns columns = gridItems.getColumns();
|
||||
// Create listhead first time is rendered
|
||||
|
|
@ -377,7 +373,7 @@ public class AssignedTaskQualityFormsToOrderElementController extends
|
|||
// Add static headers
|
||||
Column columnName = new Column();
|
||||
columnName.setLabel(_("Name"));
|
||||
columnName.setSort("auto=(name)");
|
||||
Util.setSort(columnName, "auto=(name)");
|
||||
columnName.setSortDirection("ascending");
|
||||
columns.appendChild(columnName);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,16 +30,13 @@ import org.navalplanner.web.common.entrypoints.EntryPoints;
|
|||
public interface IWorkReportCRUDControllerEntryPoints {
|
||||
|
||||
@EntryPoint("editDTO")
|
||||
public abstract void goToEditForm(WorkReportDTO workReportDTO)
|
||||
throws ClassNotFoundException, InstantiationException, IllegalAccessException;
|
||||
public abstract void goToEditForm(WorkReportDTO workReportDTO);
|
||||
|
||||
@EntryPoint("edit")
|
||||
public abstract void goToEditForm(WorkReport workReport)
|
||||
throws ClassNotFoundException, InstantiationException, IllegalAccessException;
|
||||
public abstract void goToEditForm(WorkReport workReport);
|
||||
|
||||
@EntryPoint("create")
|
||||
public abstract void goToCreateForm(WorkReportType workReportType)
|
||||
throws ClassNotFoundException, InstantiationException, IllegalAccessException;
|
||||
public abstract void goToCreateForm(WorkReportType workReportType);
|
||||
|
||||
@EntryPoint("list")
|
||||
public abstract void goToList();
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ import org.navalplanner.web.common.components.Autocomplete;
|
|||
import org.navalplanner.web.common.components.NewDataSortableColumn;
|
||||
import org.navalplanner.web.common.components.NewDataSortableGrid;
|
||||
import org.navalplanner.web.common.components.bandboxsearch.BandboxSearch;
|
||||
import org.navalplanner.web.common.entrypoints.IURLHandlerRegistry;
|
||||
import org.navalplanner.web.common.entrypoints.EntryPointsHandler;
|
||||
import org.navalplanner.web.common.entrypoints.IURLHandlerRegistry;
|
||||
import org.zkoss.ganttz.IPredicate;
|
||||
import org.zkoss.ganttz.util.ComponentsFinder;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
|
|
@ -605,8 +605,7 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
|||
}
|
||||
}
|
||||
|
||||
public void goToCreateForm(WorkReportType workReportType)
|
||||
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
|
||||
public void goToCreateForm(WorkReportType workReportType) {
|
||||
cameBackList = false;
|
||||
workReportModel.initCreate(workReportType);
|
||||
prepareWorkReportList();
|
||||
|
|
@ -616,13 +615,12 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
|||
Util.reloadBindings(createWindow);
|
||||
}
|
||||
|
||||
public void goToEditForm(WorkReportDTO workReportDTO)
|
||||
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
|
||||
public void goToEditForm(WorkReportDTO workReportDTO) {
|
||||
workReportModel.setListingQuery(false);
|
||||
goToEditForm(workReportDTO.getWorkReport());
|
||||
}
|
||||
|
||||
public void goToEditForm(WorkReport workReport) throws ClassNotFoundException, InstantiationException, IllegalAccessException{
|
||||
public void goToEditForm(WorkReport workReport) {
|
||||
workReportModel.initEdit(workReport);
|
||||
createWindow.setTitle(_("Edit Work Report"));
|
||||
loadComponents(createWindow);
|
||||
|
|
@ -702,8 +700,7 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
|||
* @throws ClassNotFoundException
|
||||
*
|
||||
*/
|
||||
private void prepareWorkReportList()
|
||||
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
|
||||
private void prepareWorkReportList() {
|
||||
/*
|
||||
* The only way to clean the listhead, is to clean all its attributes
|
||||
* and children The paging component cannot be removed manually. It is
|
||||
|
|
@ -733,8 +730,7 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
|||
* @throws InstantiationException
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
private void appendColumns(Grid grid) throws
|
||||
ClassNotFoundException, InstantiationException, IllegalAccessException {
|
||||
private void appendColumns(Grid grid) {
|
||||
|
||||
Columns columns = grid.getColumns();
|
||||
// Create listhead first time is rendered
|
||||
|
|
@ -751,7 +747,7 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
|||
NewDataSortableColumn columnDate = new NewDataSortableColumn();
|
||||
columnDate.setLabel(_("Date"));
|
||||
columnDate.setSclass("date-column");
|
||||
columnDate.setSort("auto=(date)");
|
||||
Util.setSort(columnDate, "auto=(date)");
|
||||
columnDate.setSortDirection("ascending");
|
||||
|
||||
columnDate.addEventListener("onSort", new EventListener() {
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ import org.navalplanner.web.common.OnlyOneVisible;
|
|||
import org.navalplanner.web.common.Util;
|
||||
import org.navalplanner.web.common.components.Autocomplete;
|
||||
import org.navalplanner.web.common.components.NewDataSortableGrid;
|
||||
import org.navalplanner.web.common.entrypoints.IURLHandlerRegistry;
|
||||
import org.navalplanner.web.common.entrypoints.EntryPointsHandler;
|
||||
import org.navalplanner.web.common.entrypoints.IURLHandlerRegistry;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zk.ui.event.CheckEvent;
|
||||
|
|
@ -265,8 +265,7 @@ public class WorkReportTypeCRUDController extends GenericForwardComposer
|
|||
}
|
||||
}
|
||||
|
||||
public void goToEditNewWorkReportForm(WorkReportType workReportType)
|
||||
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
|
||||
public void goToEditNewWorkReportForm(WorkReportType workReportType) {
|
||||
workReportCRUD.goToCreateForm(workReportType);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue