NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/Chameleon/trunk/Chameleon/ROIRemoveLast/ROIRemoveLast.widget.php

Revision 13 (checked in by jcleary, 17 years ago)

Latest Chameleon code checkout from previous repository

Line 
1 <?php
2 /**
3  * ROIRemoveLast Widget class
4  *
5  * @project     CWC2
6  * @revision    $Id: ROIRemoveLast.widget.php,v 1.4 2004/10/14 18:19:19 pspencer Exp $
7  * @purpose     ROI Removal Tool Widget class.  Allows the user to remove the
8  *              last ROI added to the ROI manager.
9  *
10  * @author      DM Solutions Group (spencer@dmsolutions.ca)
11  * @copyright
12  * <b>Copyright (c) 2002, DM Solutions Group Inc.</b>
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included
21  * in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  */
31
32 include_once(dirname(__FILE__)."/../Widget.php");
33 include_once(dirname(__FILE__)."/../Button.php");
34
35 /**
36  * ROIRemoveLast
37  *
38  * @desc A widget to remove the last ROI added to the ROI manager.
39  */
40 class ROIRemoveLast extends CWCWidget
41 {
42     /* the button that is the interface for this widget */
43     var $moButton;
44    
45     /**
46      * construct a new ROI Removal Tool widget
47      */
48     function ROIRemoveLast()
49     {
50         // invoke constructor of parent
51         parent::CWCWidget();
52        
53         // set the description for this widget
54         $this->szWidgetDescription = <<<EOT
55 The ROIRemoveLast widget allows the user to remove the last
56 ROI added to the ROI manager.
57 EOT;
58         $this->moButton = new CWCButton( $this );
59         $this->mnMaturityLevel = MATURITY_BETA;
60     }
61    
62     /**
63      * initialize the widget, only need to initialize the button in this case.
64      */
65     function InitDefaults()
66     {
67         parent::InitDefaults();
68        
69         $this->moButton->InitDefaults();
70         $this->moButton->SetOnClick("ROIRemoveLast");
71     }
72    
73     function GetJavascriptVariables()
74     {
75         if ($this->mbVisible)
76             return $this->moButton->GetJavascriptVariables();
77         else return array();
78     }
79    
80     function GetJavascriptFunctions()
81     {
82         $aReturn = array();
83        
84         $aReturn['ROIRemoveLast'] = <<<EOT
85 function ROIRemoveLast()
86 {
87     goCWCROIManager.RemoveLast();
88 }
89 EOT;
90        
91         return $aReturn;
92     }
93
94     function GetJavascriptInitFunctions()
95     {
96         if ($this->mbVisible)
97             return $this->moButton->GetJavascriptInitFunctions();
98         else return array();
99     }
100
101     function GetJavascriptOnLoadFunctions()
102     {
103         if ($this->mbVisible)
104             $aReturn = $this->moButton->GetJavascriptOnLoadFunctions();
105         else
106             $aReturn = array();
107         return $aReturn;
108     }
109
110     function GetJavascriptIncludeFunctions()
111     {
112         return $this->moButton->GetJavascriptIncludeFunctions();
113     }
114
115     function GetHTMLHiddenVariables()
116     {
117         $aReturn = $this->moButton->GetHTMLHiddenVariables();
118        
119         return $aReturn;
120     }
121
122     /**
123      * draw this widget on the page
124      */
125     function DrawPublish()
126     {
127         if (isset($this->maSharedResourceWidgets["CWCJSAPI"]))
128           $bCWCJSAPI = 1;
129         else
130           $bCWCJSAPI = 0;
131
132         if (!$this->mbVisible)
133             return "<!-- ROIRemoveLast hidden -->";
134
135         $szReturn = $this->moButton->DrawPublish();
136
137         return $szReturn;
138     }
139 }
140 ?>
Note: See TracBrowser for help on using the browser.