Class HttpFormEntry

java.lang.Object
ucar.unidata.ui.HttpFormEntry

public class HttpFormEntry extends Object
Class HttpFormEntry Represents a http form post input field.
Version:
$Revision: 1.18 $
Author:
IDV Development Team
  • Field Details

  • Constructor Details

    • HttpFormEntry

      public HttpFormEntry(String name, String fileName, byte[] bytes)
      Create an entry that already holds the byte contents of a file. Having an entry like this will result in a multi-part post
      Parameters:
      name - The name of the file
      fileName - filename - this is the name that is posted
      bytes - the bytes
    • HttpFormEntry

      public HttpFormEntry(String name, String label, String value)
    • HttpFormEntry

      public HttpFormEntry(String name, String label)
      Create the entry
      Parameters:
      name - The name
      label - The label
    • HttpFormEntry

      public HttpFormEntry(int type, String name, String label)
      Create the entry
      Parameters:
      type - The type of this entry
      name - The name
      label - The label
    • HttpFormEntry

      public HttpFormEntry(int type, String name, String label, String value)
      Create the entry
      Parameters:
      type - The type of this entry
      name - The name
      label - The label
      value - Initial value
    • HttpFormEntry

      public HttpFormEntry(int type, String name, String label, String value, boolean required)
      Create the entry
      Parameters:
      type - The type of this entry
      name - The name
      label - The label
      value - Initial value
      required - Is this entry required
    • HttpFormEntry

      public HttpFormEntry(int type, String name, String label, int rows, int cols)
      Create the entry
      Parameters:
      type - The type of this entry
      name - The name
      label - The label
      rows - How may rows in the text area
      cols - How many columns in the text area
    • HttpFormEntry

      public HttpFormEntry(int type, String name, String label, String value, int rows, int cols)
      Create the entry
      Parameters:
      type - The type of this entry
      name - The name
      label - The label
      value - Initial value
      rows - How many rows
      cols - How many cols
    • HttpFormEntry

      public HttpFormEntry(int type, String name, String label, String value, int rows, int cols, boolean required)
      Create the entry
      Parameters:
      type - The type of this entry
      name - The name
      label - The label
      value - Initial value
      rows - How many rows
      cols - How many cols
      required - Is this entry required
  • Method Details

    • hidden

      public static HttpFormEntry hidden(String name, String value)
    • ok

      public boolean ok()
      Is this entry ok. That is, has their been input if it is required
      Returns:
      Is ok
    • addToGui

      public void addToGui(List guiComps)
      Add the label/gui component into the list of components
      Parameters:
      guiComps - A list.
    • browse

      public void browse(JTextField fld)
      Open a file browser associated with the text field
      Parameters:
      fld - the JTextField
    • getValue

      public String getValue()
      Get the value the user entered.
      Returns:
      The input value
    • setValue

      public void setValue(String newValue)
      Set the text value to the given newValue
      Parameters:
      newValue - The new text
    • getName

      public String getName()
      Get the name
      Returns:
      The name
    • getLabel

      public String getLabel()
      Get the label
      Returns:
      The label
    • getBytes

      public byte[] getBytes()
      Get the bytes
      Returns:
      The bytes
    • makeUI

      public static JComponent makeUI(List<HttpFormEntry> entries)
      Create the GUI from the list of entries
      Parameters:
      entries - List of entries
      Returns:
      The gui
    • checkEntries

      public static boolean checkEntries(List<HttpFormEntry> entries)
      Check the entries to make sure they have been filled in
      Parameters:
      entries - list of entries
      Returns:
      false if some are not filled in.
    • showUI

      public static boolean showUI(List<HttpFormEntry> entries, String title, Window window, JComponent extraTop)
      Show the UI in a modeful dialog. Note: this method should not be called from a swing process. It does a busy wait on the dialog and does not rely on the modality of the dialog to do its wait.
      Parameters:
      entries - List of entries
      title - The dialog title
      window - The parent window
      extraTop - If non-null then this is added to the top of the gui. It allows you to provide a label, etc.
      Returns:
      Did user press ok
    • showUI

      public static boolean showUI(List<HttpFormEntry> entries, String title, Window parent, JComponent extraTop, JComponent extraBottom)
      Show the UI in a modeful dialog. Note: this method should not be called from a swing process. It does a busy wait on the dialog and does not rely on the modality of the dialog to do its wait.
      Parameters:
      entries - List of entries
      title - The dialog title
      parent - The parent window
      extraTop - If non-null then this is added to the top of the gui. It allows you to provide a label, etc.
      extraBottom - Like extraTop but on the bottom of the window
      Returns:
      Did user press ok
    • showUI

      public static boolean showUI(List<HttpFormEntry> entries, JComponent extraTop, JComponent extraBottom, JDialog dialog, boolean shouldDoBusyWait)
      Show the UI in a modeful dialog. Note: The calling method is responsible for disposing of the dialog. Also: This method should not be called from a swing process. It does a busy wait on the dialog and does not rely on the modality of the dialog to do its wait.
      Parameters:
      entries - List of entries
      extraTop - If non-null then this is added to the top of the gui. It allows you to provide a label, etc.
      extraBottom - Like extraTop but on the bottom of the window
      dialog - the dialog
      shouldDoBusyWait - true to wait
      Returns:
      Did user press ok
    • okToPost

      public boolean okToPost()
      Post the file
      Returns:
      true if posted
    • doPost

      public static String[] doPost(List<HttpFormEntry> entries, String urlPath)
      Post the given entries tot he given url
      Parameters:
      entries - The entries
      urlPath - The url to post to
      Returns:
      2 element array. First element is non-null if there was an error. Second element is non-null if no error. This is the returned html.