⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rowaction.java

📁 IBM RSA下的JSF开发示例
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (temperatureMediator != null) {
				temperatureMediator.setConnectionWrapper(null);
			}
		}
		return "";
	}
	/** 
	 * @paramBean id=temperature
	 */
	public DataObject getTemperatureParameters() {
		if (temperatureParameters == null) {
			try {
				temperatureParameters = getTemperatureMediator()
						.getParameterDataObject();
			} catch (MediatorException e) {
				logException(e);
			}
		}
		return temperatureParameters;
	}
	protected JDBCMediator getTemperatureMediator() {
		if (temperatureMediator == null) {
			try {
				temperatureMediator = JDBCMediatorFactory.soleInstance
						.createMediator(
								getResourceInputStream(temperature_metadataFileName),
								getSDOConnectionWrapper());
				initSchema(getRealPath(temperature_metadataFileName),
						temperatureMediator.getSchema());
			} catch (Throwable e) {
				logException(e);
			}
		} else {
			temperatureMediator.setConnectionWrapper(getSDOConnectionWrapper());
		}
		return temperatureMediator;
	}
	/** 
	 * @action id=temperature
	 */
	public String doTemperatureFetchAction() {
		try {
			resolveParams(getTemperatureParameters(), temperatureArgNames,
					temperatureArgValues, "temperature_params_cache");
			DataObject graph = getTemperatureMediator().getGraph(
					getTemperatureParameters());
			temperature = graph.getList(0);
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (temperatureMediator != null) {
				temperatureMediator.setConnectionWrapper(null);
			}
		}
		return "";
	}
	/** 
	 * @mediatorFactory com.ibm.etools.sdo.rdb.datahandlers.RelationalDataFactory
	 * @mediatorProperties metadataFileName=/WEB-INF/wdo/temperature.xml
	 * @methodEntry id=temperature/paramBean=temperature/action=temperature
	 * @action FILL
	 */
	public List getTemperature() {
		if (temperature == null) {
			doTemperatureFetchAction();
		}
		return temperature;
	}
	protected HtmlForm getForm1() {
		if (form1 == null) {
			form1 = (HtmlForm) findComponentInRoot("form1");
		}
		return form1;
	}
	protected UIColumn getColumn1() {
		if (column1 == null) {
			column1 = (UIColumn) findComponentInRoot("column1");
		}
		return column1;
	}
	protected HtmlOutputText getText1() {
		if (text1 == null) {
			text1 = (HtmlOutputText) findComponentInRoot("text1");
		}
		return text1;
	}
	protected HtmlOutputText getText3() {
		if (text3 == null) {
			text3 = (HtmlOutputText) findComponentInRoot("text3");
		}
		return text3;
	}
	protected HtmlOutputText getText5() {
		if (text5 == null) {
			text5 = (HtmlOutputText) findComponentInRoot("text5");
		}
		return text5;
	}
	protected HtmlOutputText getText20() {
		if (text20 == null) {
			text20 = (HtmlOutputText) findComponentInRoot("text20");
		}
		return text20;
	}
	protected HtmlOutputText getText8() {
		if (text8 == null) {
			text8 = (HtmlOutputText) findComponentInRoot("text8");
		}
		return text8;
	}
	protected HtmlOutputText getText9() {
		if (text9 == null) {
			text9 = (HtmlOutputText) findComponentInRoot("text9");
		}
		return text9;
	}
	protected HtmlOutputText getText10() {
		if (text10 == null) {
			text10 = (HtmlOutputText) findComponentInRoot("text10");
		}
		return text10;
	}
	protected HtmlOutputText getText11() {
		if (text11 == null) {
			text11 = (HtmlOutputText) findComponentInRoot("text11");
		}
		return text11;
	}
	protected HtmlOutputText getText12() {
		if (text12 == null) {
			text12 = (HtmlOutputText) findComponentInRoot("text12");
		}
		return text12;
	}
	protected HtmlOutputText getText13() {
		if (text13 == null) {
			text13 = (HtmlOutputText) findComponentInRoot("text13");
		}
		return text13;
	}
	protected HtmlOutputText getText14() {
		if (text14 == null) {
			text14 = (HtmlOutputText) findComponentInRoot("text14");
		}
		return text14;
	}
	protected HtmlOutputText getText15() {
		if (text15 == null) {
			text15 = (HtmlOutputText) findComponentInRoot("text15");
		}
		return text15;
	}
	protected HtmlOutputText getText16() {
		if (text16 == null) {
			text16 = (HtmlOutputText) findComponentInRoot("text16");
		}
		return text16;
	}
	protected HtmlOutputText getText17() {
		if (text17 == null) {
			text17 = (HtmlOutputText) findComponentInRoot("text17");
		}
		return text17;
	}
	protected HtmlOutputText getText18() {
		if (text18 == null) {
			text18 = (HtmlOutputText) findComponentInRoot("text18");
		}
		return text18;
	}
	protected HtmlOutputText getText19() {
		if (text19 == null) {
			text19 = (HtmlOutputText) findComponentInRoot("text19");
		}
		return text19;
	}
	protected HtmlOutputText getText7() {
		if (text7 == null) {
			text7 = (HtmlOutputText) findComponentInRoot("text7");
		}
		return text7;
	}
	protected HtmlDataTable getTable2() {
		if (table2 == null) {
			table2 = (HtmlDataTable) findComponentInRoot("table2");
		}
		return table2;
	}
	protected UIColumn getColumn4() {
		if (column4 == null) {
			column4 = (UIColumn) findComponentInRoot("column4");
		}
		return column4;
	}
	protected HtmlOutputText getText23() {
		if (text23 == null) {
			text23 = (HtmlOutputText) findComponentInRoot("text23");
		}
		return text23;
	}
	protected HtmlOutputText getText25() {
		if (text25 == null) {
			text25 = (HtmlOutputText) findComponentInRoot("text25");
		}
		return text25;
	}
	protected HtmlOutputText getText33() {
		if (text33 == null) {
			text33 = (HtmlOutputText) findComponentInRoot("text33");
		}
		return text33;
	}
	protected HtmlOutputText getText27() {
		if (text27 == null) {
			text27 = (HtmlOutputText) findComponentInRoot("text27");
		}
		return text27;
	}
	protected HtmlOutputText getText39() {
		if (text39 == null) {
			text39 = (HtmlOutputText) findComponentInRoot("text39");
		}
		return text39;
	}
	protected HtmlOutputText getText40() {
		if (text40 == null) {
			text40 = (HtmlOutputText) findComponentInRoot("text40");
		}
		return text40;
	}
	protected HtmlOutputText getText34() {
		if (text34 == null) {
			text34 = (HtmlOutputText) findComponentInRoot("text34");
		}
		return text34;
	}
	protected HtmlOutputText getText35() {
		if (text35 == null) {
			text35 = (HtmlOutputText) findComponentInRoot("text35");
		}
		return text35;
	}
	protected HtmlOutputText getText36() {
		if (text36 == null) {
			text36 = (HtmlOutputText) findComponentInRoot("text36");
		}
		return text36;
	}
	protected HtmlOutputText getText37() {
		if (text37 == null) {
			text37 = (HtmlOutputText) findComponentInRoot("text37");
		}
		return text37;
	}
	protected HtmlOutputText getText38() {
		if (text38 == null) {
			text38 = (HtmlOutputText) findComponentInRoot("text38");
		}
		return text38;
	}
	protected HtmlDataTable getTable1() {
		if (table1 == null) {
			table1 = (HtmlDataTable) findComponentInRoot("table1");
		}
		return table1;
	}
	protected HtmlOutputText getText2() {
		if (text2 == null) {
			text2 = (HtmlOutputText) findComponentInRoot("text2");
		}
		return text2;
	}
	protected UIColumn getColumn2() {
		if (column2 == null) {
			column2 = (UIColumn) findComponentInRoot("column2");
		}
		return column2;
	}
	protected HtmlOutputText getText4() {
		if (text4 == null) {
			text4 = (HtmlOutputText) findComponentInRoot("text4");
		}
		return text4;
	}
	protected UIColumn getColumn3() {
		if (column3 == null) {
			column3 = (UIColumn) findComponentInRoot("column3");
		}
		return column3;
	}
	protected HtmlOutputText getText6() {
		if (text6 == null) {
			text6 = (HtmlOutputText) findComponentInRoot("text6");
		}
		return text6;
	}
	protected HtmlCommandLink getLink1() {
		if (link1 == null) {
			link1 = (HtmlCommandLink) findComponentInRoot("link1");
		}
		return link1;
	}
	protected HtmlOutputText getText24() {
		if (text24 == null) {
			text24 = (HtmlOutputText) findComponentInRoot("text24");
		}
		return text24;
	}
	protected UIColumn getColumn5() {
		if (column5 == null) {
			column5 = (UIColumn) findComponentInRoot("column5");
		}
		return column5;
	}
	protected HtmlOutputText getText26() {
		if (text26 == null) {
			text26 = (HtmlOutputText) findComponentInRoot("text26");
		}
		return text26;
	}
	protected UIColumn getColumn9() {
		if (column9 == null) {
			column9 = (UIColumn) findComponentInRoot("column9");
		}
		return column9;
	}
	protected HtmlCommandLink getDetailsLink() {
		if (detailsLink == null) {
			detailsLink = (HtmlCommandLink) findComponentInRoot("detailsLink");
		}
		return detailsLink;
	}
	protected UIColumn getColumn10() {
		if (column10 == null) {
			column10 = (UIColumn) findComponentInRoot("column10");
		}
		return column10;
	}
	protected HtmlCommandLink getDeleteLink() {
		if (deleteLink == null) {
			deleteLink = (HtmlCommandLink) findComponentInRoot("deleteLink");
		}
		return deleteLink;
	}
	
	protected HtmlCommandExRowAction getRowAction1() {
		if (rowAction1 == null) {
			rowAction1 = (HtmlCommandExRowAction) findComponentInRoot("rowAction1");
		}
		return rowAction1;
	}
	
	protected HtmlJspPanel getAveragePanel() {
		if (averagePanel == null) {
			averagePanel = (HtmlJspPanel) findComponentInRoot("averagePanel");
		}
		return averagePanel;
	}
	
	protected HtmlJspPanel getDetailsPanel() {
		if (detailsPanel == null) {
			detailsPanel = (HtmlJspPanel) findComponentInRoot("detailsPanel");
		}
		return detailsPanel;
	}

	/*
	 * The Row Action method used to bring up the average temps. A stub of this method is generated for you
	 * by the tooling, but you will need to fill in some details. Auto-generated comments will guide you.
	 */
	public String doRowAction1Action() {
		//     Get the index of the selected row
			int row = getRowAction1().getRowIndex();
		//     Copy key values from the selection to the request so they can be used in a database filter
		//     For example, if the table has a column "keyvalue" and there is an SDO object that uses the
		//     filter "request.keyvalue", then this code sets up the request so the filter will work
		//     correctly
		
		//     For V6 server use:
			Object keyvalue = ((DataObject)getTemperature().get(row)).get("CITY");
		//
			getRequestScope().put("cityDetails", keyvalue);
			
			// rendering the details panel and "Close" link are initial set to false. To view them
			// we wet the rendering to true when a city is selected. Initial rendering value can be
			// set in the Properites-All menu.
			getAveragePanel().setRendered(true);
			getLink1().setRendered(true);
		//
		//     Specify the return value (a string) which is used by the navigation map to determine
		//     the next page to display

		return "";
	}
	
	/*
	 * Method used to close the Average Temp table.
	 */
	public String doLink1Action() {
		// set rendering back to false
		getAveragePanel().setRendered(false);
		getLink1().setRendered(false);
		return "";
	}
	/*
	 * The Show Details action used by Exerecise 2 to show additional information on the customers.
	 */
	public String doDetailsLinkAction() {
		// Type Java code that runs when the component is clicked
		getDetailsPanel().setRendered(true);
		return "";
	}
	/*
	 * The Delete action used by Exercise 2 to remove customers from the list
	 */
	public String doDeleteLinkAction() {
		// Type Java code that runs when the component is clicked
		
		try{	
			// pull out the first record and use that to find the root of the DataObjects
			DataObject record = (DataObject)getCustomers().get(0);
			DataObject root = record.getDataGraph().getRootObject();
			
			// select the DataObject and delete it based on the parameter passed from the JSP
			// and stored in the map...map.get("ID")
			root.getDataObject("CUSTOMERS2[ID=" + getRequestParam().get("ID") + "]").delete();
			
			// apply the changes to the dataMediator
			getCustomersMediator().applyChanges(root);
			getDetailsPanel().setRendered(false);
			} catch (Throwable e) {
				logException(e);
			} finally {
				SDOConnectionWrapper = null;
			}
		return "";
	}
	/** 
	 * @mediatorFactory com.ibm.etools.sdo.rdb.datahandlers.RelationalDataFactory
	 * @methodEntry id=customers/paramBean=customers/action=customers
	 * @action FILL
	 * @mediatorProperties metadataFileName=/WEB-INF/wdo/customers1.xml
	 */
	public List getCustomers() {
		if (customers == null) {
			doCustomersFetchAction();
		}
		return customers;
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -