{
label = label.substring(0, label.length() - 1);
}
Object[] args = {label, String.valueOf(1), String.valueOf(MAX_COLUMNS)};
PortletRequestContext pcontext = (PortletRequestContext)WebuiRequestContext.getCurrentInstance();
PortletPreferences pref = pcontext.getRequest().getPreferences();
String lastValue = pref.getValue(TOTAL_COLUMNS, "" + DEFAULT_COLUMNS);
if (uiInput.getValue() == null || uiInput.getValue().length() == 0)
{
uiInput.setValue(lastValue);
throw new MessageException(new ApplicationMessage("EmptyFieldValidator.msg.empty-input", args));
}
int totalCols = 0;
try
{
totalCols = Integer.parseInt(uiInput.getValue());
if (totalCols < 1 || totalCols > MAX_COLUMNS)
throw new Exception();
}
catch (Exception e)
{
uiInput.setValue(lastValue);
throw new MessageException(new ApplicationMessage("NumberFormatValidator.msg.Invalid-number", args));
}
uiInput = uiForm.getUIStringInput(DashboardParent.ISPRIVATE);
pref.setValue(DashboardParent.ISPRIVATE, uiInput.getValue());
uiInput = uiForm.getUIStringInput(DashboardParent.OWNER);
pref.setValue(DashboardParent.OWNER, uiInput.getValue());
UIDashboardContainer uiDashboardContainer =
((UIContainer)uiForm.getParent()).getChild(UIDashboard.class).getChild(UIDashboardContainer.class);
uiDashboardContainer.setColumns(totalCols);
uiDashboardContainer.save();
if (Util.getUIPortalApplication().getModeState() == UIPortalApplication.NORMAL_MODE)
pcontext.setApplicationMode(PortletMode.VIEW);
}