Logo Search packages:      
Sourcecode: wims version File versions  Download package

void GenericGraphApplet::setUpMainPanel (  )  [inline, protected]

This method is called to set up the main panel of the applet. The main panel object, of type JCMPanel, already exists in the variable mainPanel when it is called. It begins by calling setUpParser() and setUpExampleMenu(). This method processes applet parameters "Insets", "BackgroundColor", and "ForegroundColor" to set the gap and colors of the panel. It creates a DisplayCanvas and, if the applet parameter "UseLimitsPanel" is not equal to "no", it creates a LimitControlPanel. The coordinate limits are set using the "Limits" applet param, if presetn. This method assigns the Controller from the mainPanel to the member variable mainController. It then calls setUpBottomPanel(), setUpTopPanel(), setUpCanvas(), addCanvasBorder(), and, if there is a limits panel, setUpLimitsPanel(), in that order. Finally, if the value of the applet parameter "LoadFirstExample" is not "no", and if any examples were specifed, then the first ewxample is loaded.

Definition at line 171 of file GenericGraphApplet.java.

References addCanvasBorder(), canvas, doLoadExample(), getColorParam(), edu::hws::jcm::awt::JCMPanel::getController(), edu::hws::jcm::draw::DisplayCanvas::getCoordinateRect(), getNumericParam(), getParameter(), limitsPanel, mainController, mainPanel, parser, edu::hws::jcm::awt::JCMPanel::setInsetGap(), edu::hws::jcm::draw::CoordinateRect::setLimits(), setUpBottomPanel(), setUpCanvas(), setUpExampleMenu(), setUpLimitsPanel(), setUpParser(), and setUpTopPanel().

Referenced by init().

                                   {
      parser = new Parser(null,0);
      setUpParser();
      setUpExampleMenu();
      double[] gap = getNumericParam("Insets");
      if (gap == null || gap.length == 0 || gap[0] < 0 || gap[0] > 50)
         mainPanel.setInsetGap(3);
      else
         mainPanel.setInsetGap( (int)Math.round(gap[0]) );
      Color color;
      color = getColorParam("BackgroundColor", Color.gray);
      mainPanel.setBackground(color);
      color = getColorParam("ForegroundColor", Color.black);
      mainPanel.setForeground(color);
      canvas = new DisplayCanvas();
      double[] limits = getNumericParam("Limits");
      if (limits != null && limits.length >= 4)
         canvas.getCoordinateRect().setLimits(limits);
      if ( "yes".equalsIgnoreCase(getParameter("UseLimitsPanel", "yes")) ) {
         String h = getParameter("XName");
         if (h == null)
            h = getParameter("Variable","x");
         String v =getParameter("YName","y");
         limitsPanel = new LimitControlPanel( h+"min", h+"max", v+"min", v+"max", 0, false );
      }
      mainController = mainPanel.getController();
      setUpBottomPanel();
      setUpTopPanel();
      setUpCanvas();
      addCanvasBorder();
      if ( limitsPanel != null )
         setUpLimitsPanel();
      String loadDefault = (loadExampleButton == null)? "yes" : "no";
      if (exampleStrings != null && exampleStrings.size() > 0 &&
             ! "no".equalsIgnoreCase(getParameter("LoadFirstExample",loadDefault)))
         doLoadExample( (String)exampleStrings.elementAt(0) );
   }


Generated by  Doxygen 1.6.0   Back to index