1 18 19 package org.apache.struts.webapp.tiles.portal; 20 21 import javax.servlet.http.HttpServletRequest ; 22 import javax.servlet.http.HttpServletResponse ; 23 24 import org.apache.struts.action.ActionForm; 25 import org.apache.struts.action.ActionForward; 26 import org.apache.struts.action.ActionMapping; 27 import org.apache.struts.tiles.ComponentContext; 28 import org.apache.struts.tiles.actions.TilesAction; 29 30 45 public final class UserPortalSettingsAction extends TilesAction { 46 47 64 public ActionForward execute( 65 ComponentContext context, 66 ActionMapping mapping, 67 ActionForm form, 68 HttpServletRequest request, 69 HttpServletResponse response) 70 throws Exception { 71 72 PortalSettingsForm prefsForm = (PortalSettingsForm) form; 73 74 PortalSettings settings = UserPortalAction.getSettings(request, context); 76 PortalCatalog catalog = 77 UserPortalAction.getPortalCatalog( 78 context, 79 getServlet().getServletContext()); 80 81 if (prefsForm.isSubmitted()) { 83 for (int i = 0; i < prefsForm.getNumCol(); i++) { 85 settings.setListAt(i, catalog.getTiles(prefsForm.getNewCol(i))); 86 } 87 88 prefsForm.reset(); 89 90 } 91 92 for (int i = 0; i < settings.getNumCols(); i++) { 94 prefsForm.addCol(settings.getListAt(i)); 95 prefsForm.addColLabels(catalog.getTileLabels(settings.getListAt(i))); 96 } 97 98 prefsForm.setChoices(catalog.getTiles()); 99 prefsForm.setChoiceLabels(catalog.getTilesLabels()); 100 101 return null; 102 } 103 104 } 105 | Popular Tags |