Class NewStatusBar

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class NewStatusBar extends JPanel

This class contains the status bar. It contains the graphical component, and the methods to manage it.

The status bar is divided in several areas. At the very left, there is an icon and the main status text. There are three icons to show: Info, Warning and Error icons. They can be set together with the main status text using the methods setInfoText(), setWarningText() and setErrorText() (and also with setInfoTextTemporal() , etc). Then, there is a right area which contains labels and other controls. Labels are set in the config.xml files and are visible or not depending on the currently selected Andami window. Controls are associated to extensions, and are enabled/disabled and visible/hidden depending on the associated extension.

See Also:
  • Constructor Details

    • NewStatusBar

      public NewStatusBar()
      This is the default constructor
  • Method Details

    • clearMessage

      public void clearMessage()
    • message

      public void message(String msg, int messageType)
    • getStatusText

      public String getStatusText()
      Gets the status bar main text.
      Returns:
      The status bar main text.
      See Also:
    • restaurarTexto

      public void restaurarTexto()
      Restores the previous contents in the status bar main text, after the setInfoTextTemporal(String), setWarningTextTemporal(String) or setErrorTextTemporal(String) have been called.
      See Also:
    • setInfoTextTemporal

      public void setInfoTextTemporal(String texto)
      Sets a temporary information message in the status bar, and changes the icon to an Info icon. The previous text and icon can be restored using the restaurarTexto() method.
      Parameters:
      texto - The text to set
      See Also:
    • setWarningTextTemporal

      public void setWarningTextTemporal(String texto)
      Sets a temporary warning message in the status bar, and changes the icon to a Warning icon. The previous text and icon can be restored using the restaurarTexto() method.
      Parameters:
      texto - The text to set
      See Also:
    • setErrorTextTemporal

      public void setErrorTextTemporal(String texto)
      Sets a temporary error message in the status bar, and changes the icon to an Error icon. The previous text and icon can be restored using the restaurarTexto() method.
      Parameters:
      texto - The text to set
      See Also:
    • setInfoText

      public void setInfoText(String texto)
      Sets a permanent info message in the status bar, and changes the permanent icon to an Info icon. If there is a temporary message showing at the moment, the message set now is not shown until the restaurarTexto() method is called.
      Parameters:
      texto - The permanent info message to set
      See Also:
    • setWarningText

      public void setWarningText(String texto)
      Sets a permanent warning message in the status bar, and changes the permanent icon to a Warning icon. If there is a temporary message showing at the moment, the message set now is not shown until the restaurarTexto() method is called.
      Parameters:
      texto - The permanent warning message to set
      See Also:
    • setErrorText

      public void setErrorText(String texto)
      Sets a permanent error message in the status bar, and changes the permanent icon to an Error icon. If there is a temporary message showing at the moment, the message set now is not shown until the restaurarTexto() method is called.
      Parameters:
      texto - The permanent info message to set
      See Also:
    • setProgress

      public void setProgress(int p)
      If p is a value between 0 and 99, it shows a progress bar in the left area of the status bar, and sets the specified progress. If p is bigger than 99, it hides the progress bar.
      Parameters:
      p - The progress to set in the progress bar. If it is bigger than 99, the task will be considered to be finished, and the progress bar will be hidden.
    • setLabelSet

      public void setLabelSet(Label[] labels)
      Sets a label-set to be shown in the status bar. This method it is not intended to be used directly, because the set will be overwritten when the selected window changes. Use MainFrame.setStatusBarLabels(Class, Label[]) to permanently associate a label set with a window.
      Parameters:
      labels - The labels to set.
      See Also:
    • ajustar

      public void ajustar()
      Hides the empty labels and adjust the space in the bar.
    • setMessage

      public void setMessage(String id, String msg)
      Sets the text of the provided label.
      Parameters:
      id - The ID of the label to modify. It is defined in the config.xml file
      msg - The message to show in the label
    • setControlValue

      public void setControlValue(String id, String value)
      Sets the control identified by 'id' with the provided value.
      Parameters:
      id - The ID of the control to modify
      value - The value to set in the control
    • setFixedLabelWidth

      public void setFixedLabelWidth(double d)
      Sets the width of the main message label.
      Parameters:
      d - The width ob the main label
    • addControl

      public void addControl(String id, Component control)
      Adds a control to the status bar
      Parameters:
      id - The ID of the control, useful to later retrive it or set its value
      control - The control to add
    • removeControl

      public Component removeControl(String id)
      Remove a control from the status bar
      Parameters:
      id - The ID of the control to get
    • getControl

      public Component getControl(String id)
      Gets a control from the status bar
      Parameters:
      id - The ID of the control to get