1:/*
   2: * Page1.java
   3: *
   4: * Created on December 10, 2005, 6:33 PM
   5: * Copyright Mike
   6: */
   7:package webreservations;
   8:
   9:import javax.faces.context.FacesContext;
  10:import com.sun.web.ui.appbase.AbstractPageBean;
  11:import com.sun.web.ui.component.Body;
  12:import com.sun.web.ui.component.Form;
  13:import com.sun.web.ui.component.Head;
  14:import com.sun.web.ui.component.Html;
  15:import com.sun.web.ui.component.Link;
  16:import com.sun.web.ui.component.Page;
  17:import javax.faces.FacesException;
  18:import com.sun.web.ui.component.Table;
  19:import com.sun.web.ui.component.StaticText;
  20:import com.sun.web.ui.component.TableRowGroup;
  21:import com.sun.web.ui.model.DefaultTableDataProvider;
  22:import com.sun.web.ui.component.TableColumn;
  23:import com.sun.data.provider.impl.CachedRowSetDataProvider;
  24:import com.sun.web.ui.component.Button;
  25:import com.sun.web.ui.component.Label;
  26:
  27:/**
  28: * <p>Page bean that corresponds to a similarly named JSP page.  This
  29: * class contains component definitions (and initialization code) for
  30: * all components that you have defined on this page, as well as
  31: * lifecycle methods and event handlers where you may add behavior
  32: * to respond to incoming events.</p>
  33: */
  34:public class ConferenceRooms extends AbstractPageBean {
  35:    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
  36:    private int __placeholder;
  37:    
  38:    private Page page1 = new Page();
  39:    
  40:    public Page getPage1() {
  41:        return page1;
  42:    }
  43:    
  44:    public void setPage1(Page p) {
  45:        this.page1 = p;
  46:    }
  47:    
  48:    private Html html1 = new Html();
  49:    
  50:    public Html getHtml1() {
  51:        return html1;
  52:    }
  53:    
  54:    public void setHtml1(Html h) {
  55:        this.html1 = h;
  56:    }
  57:    
  58:    private Head head1 = new Head();
  59:    
  60:    public Head getHead1() {
  61:        return head1;
  62:    }
  63:    
  64:    public void setHead1(Head h) {
  65:        this.head1 = h;
  66:    }
  67:    
  68:    private Link link1 = new Link();
  69:    
  70:    public Link getLink1() {
  71:        return link1;
  72:    }
  73:    
  74:    public void setLink1(Link l) {
  75:        this.link1 = l;
  76:    }
  77:    
  78:    private Body body1 = new Body();
  79:    
  80:    public Body getBody1() {
  81:        return body1;
  82:    }
  83:    
  84:    public void setBody1(Body b) {
  85:        this.body1 = b;
  86:    }
  87:    
  88:    private Form form1 = new Form();
  89:    
  90:    public Form getForm1() {
  91:        return form1;
  92:    }
  93:    
  94:    public void setForm1(Form f) {
  95:        this.form1 = f;
  96:    }
  97:    
  98:    private Table tblRooms = new Table();
  99:    
 100:    public Table getTblRooms() {
 101:        return tblRooms;
 102:    }
 103:    
 104:    public void setTblRooms(Table t) {
 105:        this.tblRooms = t;
 106:    }
 107:    
 108:    private StaticText table1Title = new StaticText();
 109:    
 110:    public StaticText getTable1Title() {
 111:        return table1Title;
 112:    }
 113:    
 114:    public void setTable1Title(StaticText st) {
 115:        this.table1Title = st;
 116:    }
 117:    
 118:    private TableRowGroup tableRowGroup1 = new TableRowGroup();
 119:    
 120:    public TableRowGroup getTableRowGroup1() {
 121:        return tableRowGroup1;
 122:    }
 123:    
 124:    public void setTableRowGroup1(TableRowGroup trg) {
 125:        this.tableRowGroup1 = trg;
 126:    }
 127:    
 128:    private CachedRowSetDataProvider conference_roomsDataProvider = new CachedRowSetDataProvider();
 129:    
 130:    public CachedRowSetDataProvider getConference_roomsDataProvider() {
 131:        return conference_roomsDataProvider;
 132:    }
 133:    
 134:    public void setConference_roomsDataProvider(CachedRowSetDataProvider crsdp) {
 135:        this.conference_roomsDataProvider = crsdp;
 136:    }
 137:    
 138:    private TableColumn tableColumn1 = new TableColumn();
 139:    
 140:    public TableColumn getTableColumn1() {
 141:        return tableColumn1;
 142:    }
 143:    
 144:    public void setTableColumn1(TableColumn tc) {
 145:        this.tableColumn1 = tc;
 146:    }
 147:    
 148:    private StaticText staticText1 = new StaticText();
 149:    
 150:    public StaticText getStaticText1() {
 151:        return staticText1;
 152:    }
 153:    
 154:    public void setStaticText1(StaticText st) {
 155:        this.staticText1 = st;
 156:    }
 157:    
 158:    private TableColumn tableColumn2 = new TableColumn();
 159:    
 160:    public TableColumn getTableColumn2() {
 161:        return tableColumn2;
 162:    }
 163:    
 164:    public void setTableColumn2(TableColumn tc) {
 165:        this.tableColumn2 = tc;
 166:    }
 167:    
 168:    private StaticText staticText2 = new StaticText();
 169:    
 170:    public StaticText getStaticText2() {
 171:        return staticText2;
 172:    }
 173:    
 174:    public void setStaticText2(StaticText st) {
 175:        this.staticText2 = st;
 176:    }
 177:    
 178:    private TableColumn tableColumn3 = new TableColumn();
 179:    
 180:    public TableColumn getTableColumn3() {
 181:        return tableColumn3;
 182:    }
 183:    
 184:    public void setTableColumn3(TableColumn tc) {
 185:        this.tableColumn3 = tc;
 186:    }
 187:    
 188:    private StaticText staticText3 = new StaticText();
 189:    
 190:    public StaticText getStaticText3() {
 191:        return staticText3;
 192:    }
 193:    
 194:    public void setStaticText3(StaticText st) {
 195:        this.staticText3 = st;
 196:    }
 197:    
 198:    private TableColumn tableColumn4 = new TableColumn();
 199:    
 200:    public TableColumn getTableColumn4() {
 201:        return tableColumn4;
 202:    }
 203:    
 204:    public void setTableColumn4(TableColumn tc) {
 205:        this.tableColumn4 = tc;
 206:    }
 207:    
 208:    private Button btnViewReservations = new Button();
 209:    
 210:    public Button getBtnViewReservations() {
 211:        return btnViewReservations;
 212:    }
 213:    
 214:    public void setBtnViewReservations(Button b) {
 215:        this.btnViewReservations = b;
 216:    }
 217:
 218:    private TableColumn tableColumn5 = new TableColumn();
 219:
 220:    public TableColumn getTableColumn5() {
 221:        return tableColumn5;
 222:    }
 223:
 224:    public void setTableColumn5(TableColumn tc) {
 225:        this.tableColumn5 = tc;
 226:    }
 227:
 228:    private StaticText staticText4 = new StaticText();
 229:
 230:    public StaticText getStaticText4() {
 231:        return staticText4;
 232:    }
 233:
 234:    public void setStaticText4(StaticText st) {
 235:        this.staticText4 = st;
 236:    }
 237:
 238:    private Label lblWelcomeHeading = new Label();
 239:
 240:    public Label getLblWelcomeHeading() {
 241:        return lblWelcomeHeading;
 242:    }
 243:
 244:    public void setLblWelcomeHeading(Label l) {
 245:        this.lblWelcomeHeading = l;
 246:    }
 247:
 248:    private Label lblInstructions = new Label();
 249:
 250:    public Label getLblInstructions() {
 251:        return lblInstructions;
 252:    }
 253:
 254:    public void setLblInstructions(Label l) {
 255:        this.lblInstructions = l;
 256:    }
 257:
 258:    private TableColumn tableColumn6 = new TableColumn();
 259:
 260:    public TableColumn getTableColumn6() {
 261:        return tableColumn6;
 262:    }
 263:
 264:    public void setTableColumn6(TableColumn tc) {
 265:        this.tableColumn6 = tc;
 266:    }
 267:
 268:    private Button btnMakeReservation = new Button();
 269:
 270:    public Button getBtnMakeReservation() {
 271:        return btnMakeReservation;
 272:    }
 273:
 274:    public void setBtnMakeReservation(Button b) {
 275:        this.btnMakeReservation = b;
 276:    }
 277:    
 278:    // </editor-fold>
 279:    
 280:    
 281:    /**
 282:     * <p>Construct a new Page bean instance.</p>
 283:     */
 284:    public ConferenceRooms() {
 285:        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
 286:        try {
 287:            conference_roomsDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet)getValue("#{ReservationsSessionBean.conference_roomsRowSet}"));
 288:        } catch (Exception e) {
 289:            log("Page1 Initialization Failure", e);
 290:            throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
 291:        }
 292:        // </editor-fold>
 293:        // TODO: Add your own initialization code here (optional)
 294:    }
 295:    
 296:    /**
 297:     * <p>Return a reference to the scoped data bean.</p>
 298:     */
 299:    protected ReservationsSessionBean getReservationsSessionBean() {
 300:        return (ReservationsSessionBean)getBean("ReservationsSessionBean");
 301:    }
 302:    
 303:    
 304:    /**
 305:     * <p>Callback method that is called whenever a page is navigated to,
 306:     * either directly via a URL, or indirectly via page navigation.
 307:     * Customize this method to acquire resources that will be needed
 308:     * for event handlers and lifecycle methods, whether or not this
 309:     * page is performing post back processing.</p>
 310:     *
 311:     * <p>Note that, if the current request is a postback, the property
 312:     * values of the components do <strong>not</strong> represent any
 313:     * values submitted with this request.  Instead, they represent the
 314:     * property values that were saved for this view when it was rendered.</p>
 315:     */
 316:    public void init() {
 317:    }
 318:    
 319:    /**
 320:     * <p>Callback method that is called after the component tree has been
 321:     * restored, but before any event processing takes place.  This method
 322:     * will <strong>only</strong> be called on a postback request that
 323:     * is processing a form submit.  Customize this method to allocate
 324:     * resources that will be required in your event handlers.</p>
 325:     */
 326:    public void preprocess() {
 327:    }
 328:    
 329:    /**
 330:     * <p>Callback method that is called just before rendering takes place.
 331:     * This method will <strong>only</strong> be called for the page that
 332:     * will actually be rendered (and not, for example, on a page that
 333:     * handled a postback and then navigated to a different page).  Customize
 334:     * this method to allocate resources that will be required for rendering
 335:     * this page.</p>
 336:     */
 337:    public void prerender() {
 338:    }
 339:    
 340:    
 341:    /**
 342:     * <p>Callback method that is called after rendering is completed for
 343:     * this request, if <code>init()</code> was called (regardless of whether
 344:     * or not this was the page that was actually rendered).  Customize this
 345:     * method to release resources acquired in the <code>init()</code>,
 346:     * <code>preprocess()</code>, or <code>prerender()</code> methods (or
 347:     * acquired during execution of an event handler).</p>
 348:     */
 349:    public void destroy() {
 350:        conference_roomsDataProvider.close();
 351:    }
 352:    
 353:    
 354:    public String btnViewReservations_action() {
 355:        //Store selected room id and name of selected row...
 356:        Object id = getValue("#{currentRow.value['conference_rooms.room_id']}");
 357:        Object name = getValue("#{currentRow.value['conference_rooms.room_name']}");
 358:        ReservationsSessionBean resBean =
 359:                (ReservationsSessionBean)this.getBean("ReservationsSessionBean");
 360:        resBean.setRoomId(id.toString());
 361:        resBean.setRoomName(name.toString());
 362:      
 363:        return "view";
 364:    }
 365:
 366:
 367:    public String btnMakeReservation_action() {
 368:        Object id = getValue("#{currentRow.value['conference_rooms.room_id']}");
 369:        ReservationsSessionBean resBean =
 370:                (ReservationsSessionBean)this.getBean("ReservationsSessionBean");
 371:        resBean.setRoomId(id.toString());
 372:        
 373:        return "reserve";
 374:    }
 375:}
 376: