/[gcjwebplugin]/gcjwebplugin/src/gnu/gcjwebplugin/AppletTag.java
ViewVC logotype

Diff of /gcjwebplugin/src/gnu/gcjwebplugin/AppletTag.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by mkoch, Tue Aug 24 13:34:41 2004 UTC revision 1.21 by tromey, Wed Jul 20 16:42:05 2005 UTC
# Line 1  Line 1 
1  /* AppletTag.java - representation of an HTML APPLET tag  /* AppletTag.java - representation of an HTML APPLET tag
2     Copyright (C) 2003, 2004  Thomas Fitzsimmons <fitzsim@redhat.com>     Copyright (C) 2003, 2004, 2005  Thomas Fitzsimmons <fitzsim@redhat.com>
3    
4     This file is part of GCJ Applet Viewer.     This file is part of GCJ Applet Viewer.
5    
# Line 108  class AppletTag Line 108  class AppletTag
108    
109      while (tagTokenizer.nextToken() != '>')      while (tagTokenizer.nextToken() != '>')
110        {        {
111            if (tagTokenizer.ttype == StreamTokenizer.TT_EOF)
112              break;
113    
114          if (tagTokenizer.ttype == StreamTokenizer.TT_WORD)          if (tagTokenizer.ttype == StreamTokenizer.TT_WORD)
115            {            {
116              if (tagTokenizer.sval.equals("name"))              if (tagTokenizer.sval.equals("name"))
# Line 422  class AppletTag Line 425  class AppletTag
425            }            }
426          token = tagTokenizer.nextToken();          token = tagTokenizer.nextToken();
427        }        }
428    
429        // If we hit EOF, just go ahead with whatever we've got.  Some
430        // pages don't properly terminate; besides which our parser is a
431        // bit bogus anyway.
432        if (currentTag != null)
433          {
434            currentTag.parseArchives();
435            return currentTag;
436          }
437    
438      return null;      return null;
439    }    }
440    
# Line 436  class AppletTag Line 449  class AppletTag
449    public static Dimension getSize (AppletTag tag)    public static Dimension getSize (AppletTag tag)
450    {    {
451      NumberFormat numberFormat;      NumberFormat numberFormat;
452      Dimension size = new Dimension();      Dimension size = new Dimension(320, 200);
453    
454      try      try
455        {        {
456          String widthStr = (String) tag.parameters.get("width");          String widthStr = (String) tag.parameters.get("width");
457    
458          if (widthStr.charAt(widthStr.length() - 1) == '%')          if (widthStr != null)
459            numberFormat = NumberFormat.getPercentInstance(Locale.US);            {
460          else              if (widthStr.charAt(widthStr.length() - 1) == '%')
461            numberFormat = NumberFormat.getInstance(Locale.US);                numberFormat = NumberFormat.getPercentInstance(Locale.US);
462                else
463                  numberFormat = NumberFormat.getInstance(Locale.US);
464    
465          // FIXME: Handle percentage somehow.              // FIXME: Handle percentage somehow.
466          size.width = numberFormat.parse(widthStr).intValue();              size.width = numberFormat.parse(widthStr).intValue();
467              }
468        }        }
469      catch (ParseException e)      catch (ParseException e)
470        {        {
471          // Use default.          // Use default.
         size.width = 320;  
472        }        }
473    
474      try      try
475        {        {
476          String heightStr = (String) tag.parameters.get("height");          String heightStr = (String) tag.parameters.get("height");
477    
478          if (heightStr.charAt(heightStr.length() - 1) == '%')          if (heightStr != null)
479            numberFormat = NumberFormat.getPercentInstance(Locale.US);            {
480          else              if (heightStr.charAt(heightStr.length() - 1) == '%')
481            numberFormat = NumberFormat.getInstance(Locale.US);                numberFormat = NumberFormat.getPercentInstance(Locale.US);
482                else
483                  numberFormat = NumberFormat.getInstance(Locale.US);
484    
485          // FIXME: Handle percentage somehow.              // FIXME: Handle percentage somehow.
486          size.height = numberFormat.parse(heightStr).intValue();              size.height = numberFormat.parse(heightStr).intValue();
487              }
488        }        }
489      catch (ParseException e)      catch (ParseException e)
490        {        {
491          // Use default.          // Use default.
         size.height = 200;  
492        }        }
493    
494      return size;      return size;

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26