File:  [mozdev] / autoform / www / jsdoc / overview-summary-preferences_elements_BooleanPreference.js.html
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Wed Mar 30 14:13:47 2005 UTC (14 years, 4 months ago) by kessler
Branches: MAIN
CVS tags: HEAD
Added jsdoc

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<HTML>
<HEAD>
<TITLE>
autoform.mozdev.org Overview
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<SCRIPT>
function asd()
{
parent.document.title=" Overview";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  
  
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><b>Overview</b></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev">	&nbsp;<FONT CLASS="NavBarFont1Rev"><b>File</b></FONT>&nbsp;</TD>
  

  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1"> 	<FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><b>Tree</b></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"--><FONT CLASS="NavBarFont1"><b>Index</b></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><b>Help</b></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD BGCOLOR="#EEEEFF" ALIGN="right" VALIGN="top">
<EM>
<b>autoform.mozdev.org</b></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="overview-summary.html" TARGET="_top"><B>NO FRAMES</B></A>
&nbsp;&nbsp;
<SCRIPT>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<CENTER>

   <H2>preferences/elements/BooleanPreference.js</H2>

</CENTER>
        
            
        
        
        <h4>Summary</h4>
        <p>
        
           No overview generated for 'preferences/elements/BooleanPreference.js'<BR/><BR/>
           
        </p>

<HR>




<!-- START SOURCECODE -->
<pre class="sourceview">
<span class="comment">/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is from autoform.
 *
 * The Initial Developer of the Original Code is
 * Michael Kessler, Bluewin AG &lt;michael.kessler<span class="attrib">@team</span>.bluewin.com&gt;.
 * Portions created by the Initial Developer are Copyright (C) 2005
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */</span>

<span class="comment">/**
 * Handles boolean preferences. Represents
 * a checkbox in the preference dialog
 *
 * <span class="attrib">@param</span> elementId the xul element id in the dialog
 * <span class="attrib">@param</span> defaultValue used if preference is not stored
 *
 * <span class="attrib">@constructor</span>
 */</span>
<span class="reserved">function</span> BooleanPreference(elementId, defaultValue) {
<span class="comment">
   // inherit</span>
   <span class="reserved">this</span>.superclass = PreferencesService;
   <span class="reserved">this</span>.superclass();
   
   <span class="reserved">this</span>.elementId = elementId;
   <span class="reserved">this</span>.defaultValue = defaultValue;

   <span class="comment">/**
    * put preference value to its gui representation
    */</span>
   <span class="reserved">this</span>.loadElement = <span class="reserved">function</span>() {
      document.getElementById(<span class="reserved">this</span>.elementId).checked = <span class="reserved">this</span>.getValue();
   };

   <span class="comment">/**
    * store preference value from its gui representation
    */</span>
   <span class="reserved">this</span>.saveElement = <span class="reserved">function</span>() {
      var prefs = <span class="reserved">this</span>.getUserPreferenceStore();
      prefs.setBoolPref(<span class="reserved">this</span>.elementId, document.getElementById(<span class="reserved">this</span>.elementId).checked);
   }
   
   <span class="comment">/**
    * reads the preference value from the preference service
    */</span>
   <span class="reserved">this</span>.getValue = <span class="reserved">function</span>() {
      var prefs = <span class="reserved">this</span>.getUserPreferenceStore();
      try {
         <span class="reserved">return</span> prefs.getBoolPref(<span class="reserved">this</span>.elementId);
      } catch (e) {
<span class="comment">         // default</span>
         prefs.setBoolPref(<span class="reserved">this</span>.elementId, <span class="reserved">this</span>.defaultValue);
         <span class="reserved">return</span> <span class="reserved">this</span>.defaultValue;
      }
   };

   <span class="comment">/**
    * string representation
    */</span>
   <span class="reserved">this</span>.toString = <span class="reserved">function</span>() {
      <span class="reserved">return</span> <span class="literal">"BooleanPreference "</span> + <span class="reserved">this</span>.elementId + <span class="literal">" = "</span> + <span class="reserved">this</span>.getValue();
   };
} 
<span class="comment">
// inherit</span>
BooleanPreference.<span class="reserved">prototype</span> = new PreferencesService();

</pre>
<!-- END SOURCECODE -->
<HR>




<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  
  
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><b>Overview</b></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev">	&nbsp;<FONT CLASS="NavBarFont1Rev"><b>File</b></FONT>&nbsp;</TD>
  

  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><b>Tree</b></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"--><FONT CLASS="NavBarFont1"><b>Index</b></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><b>Help</b></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD BGCOLOR="#EEEEFF" ALIGN="right" VALIGN="top"><EM>
<b>autoform.mozdev.org</b></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="overview-summary.html" TARGET="_top"><B>NO FRAMES</B></A>
&nbsp;&nbsp;
<SCRIPT>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<FONT SIZE="-1">

</FONT>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/">JSDoc</a> on Wed Mar 30 16:06:04 2005</div>
</BODY>
</HTML>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>