<page xmlns="http://bali.us.oracle.com/cabo/baja" 
      xmlns:baja="http://bali.us.oracle.com/cabo/baja"
      xmlns:uix="http://bali.us.oracle.com/cabo/marlin"
      xmlns:marlin="http://bali.us.oracle.com/cabo/marlin" 
      xmlns:html="http://www.w3.org/TR/REC-html40"
      xmlns:ctrl="http://xmlns.oracle.com/uix/controller"      
      xmlns:data="http://bali.us.oracle.com/cabo/marlin">

  <baja:head xmlns="http://www.w3.org/TR/REC-html40">
        <html:meta http-equiv="Cache-Control" content="max-age=0"/>
  </baja:head>

  <baja:content xmlns="http://bali.us.oracle.com/cabo/marlin">
    <form name="hostSearch" method="POST">
      <contents>
        <dataScope>
          <contents>
            <script>
              <contents>
                function mySelect()
                { // create the proxy object
                  var proxy = new TableProxy("targetSearchTable");
                  // get the number of rows currently displayed
                  var length = proxy.getLength();
                  // get the selected index of a single-selection table
                  var selectedIndex = proxy.getSelectedRow();
                  // display the value of the text field in row 2, column "lastName"
                  var targetName = proxy.getFormElement("targetName", selectedIndex);
                  window.opener.document.copyMetThr.selectedTargetName.value = targetName.value;
                  top.close();
                }
              </contents>
            </script>

            <html:title>
              <text data:text="SELECT_TARGETS_HEADER@mntrResourceBundle"/>
            </html:title>

            <pageLayout data:title="SELECT_TARGETS_HEADER@mntrResourceBundle">
              <pageButtons>
                <pageButtonBar>
                  <contents>
                    <button data:text="CANCEL_BUTTON@commonResourceBundle" 
                            onClick="top.close();" />
                    <button data:text="SELECT@commonResourceBundle" 
                            onClick="mySelect();"  />
                  </contents>                 
                </pageButtonBar>
               </pageButtons> 

              <copyright>
               <include baja:node="../../../copyright"/>
              </copyright>

              <contents>  <!-- pageLayout contents... -->
                <stackLayout>
                  <contents>
                        <styledText styleClass="OraInstructionText" text=""/>

                        <spacer height="5"/>
                        <stackLayout>
                          <contents>
                            <spacer width="20"/>

                            <switcher data:childName="node@targetListData">
                              <case name="errNode">
                                <inlineMessage
                                  data:message="errMsg@targetListData"
                                  messageType="error">
                                </inlineMessage>
                              </case>
                              <case name="okNode">
		                       <stackLayout>
		                        <contents>
                                    <header data:text="SEARCH_TARGETS_HEADER@mntrResourceBundle">
                                      <contents>
                                        <rowLayout>
                                          <contents>
                                            <messageTextInput name="targetName" 
                                                              data:prompt="SEARCH_FOR_TARGETS_HEADER@mntrResourceBundle" 
                                                              columns="40" 
                                                              data:text="targetEntered@targetListData"/>
                                            <spacer width="3"/>
                                            <submitButton data:text="GO@commonResourceBundle" 
                                                          name="event" 
                                                          value="Go"/>
                                            <formValue name="searchPage"/>
                                          </contents>
                                        </rowLayout>
                                      </contents>
                                    </header>

                                    <header data:text="AVAILABLE_TARGETS_HEADER@mntrResourceBundle">
                                      <contents>                                          
	                                <table
	                                  name="targetSearchTable"
	                                  width="70%"
	                                  formSubmitted="true"
	                                  alternateText="no host found"
	                                  data:tableData="row@targetListData"
	                                  data:value="value@targetListData"
	                                  data:minValue="minValue@targetListData"
	                                  proxied="true"
	                                  data:blockSize="blockSize@targetListData"
                                      data:columnHeaderData="column@targetListData"
	                                  data:maxValue="maxValue@targetListData">
		
		                          <columnHeaderStamp>
                                            <sortableHeader data:text="text" data:sortable="sortable"/>
		                          </columnHeaderStamp>
		                                          
		                          <tableSelection>
		                            <singleSelection selectedIndex="0" >
		                            </singleSelection>
		                          </tableSelection>
		   
		                          <contents>
		                            <styledText data:text="targetName"/>
                                    <formValue name="targetName" 
                                               data:value="targetName"/>
		                          </contents>                                    
		                        </table>
                                      </contents>
                                    </header>
                                  </contents>
                                </stackLayout>
                              </case>
                            </switcher>
                          </contents>         
                        </stackLayout>
                  </contents>
                </stackLayout>  <!-- end of all page header sections -->
              </contents>
            </pageLayout>
          </contents>
          
          <!-- Data Providers -->
          <provider>
            <data name="sortHeaders">
              <method class="oracle.sysman.eml.mntr.util.TableHeaderSort"
                      method="getIsSortable"/>
            </data>
            <data name="sort">
              <method class="oracle.sysman.eml.mntr.util.TableHeaderSort"
                      method="sort"/>
            </data>
            <data name="targetListData">
              <method class="oracle.sysman.eml.mntr.metrics.MetricThresholdsDataObject" method="getTargetListData"/>
            </data>
            <data name="mntrResourceBundle">
              <bundle class="oracle.sysman.resources.MntrResourceBundle"/>
            </data>
            <data name="commonResourceBundle">
              <bundle class="oracle.sysman.resources.CommonResourceBundle"/>
            </data>
          </provider>

        </dataScope>
      </contents>
    </form>
  </baja:content>

  <baja:handlers>
    <event name="*">
      <method class="oracle.sysman.eml.mntr.metrics.MetricThresholdsDataObject"
              method="doLoad"/>
    </event>
    <event name="sort">
      <method class="oracle.sysman.eml.mntr.util.TableHeaderSort" method="doSort"/>
    </event>
    <event name="Go">
      <method class="oracle.sysman.eml.mntr.metrics.MetricThresholdsDataObject" method="selectTarget"/>
    </event>
    <event name="goto">
      <method class="oracle.sysman.eml.mntr.metrics.MetricThresholdsDataObject" method="doGoto"/>
    </event>
    <event name="sort">
      <method class="oracle.sysman.eml.mntr.metrics.MetricThresholdsDataObject" method="doSort"/>
    </event>
  </baja:handlers>
</page>
