net.fenyo.gnetwatch.GUI
Class GUI

java.lang.Object
  extended by net.fenyo.gnetwatch.GUI.GUI
All Implemented Interfaces:
java.lang.Runnable

public class GUI
extends java.lang.Object
implements java.lang.Runnable

Manages the main GUI.

Version:
$Id: GUI.java,v 1.127 2008/05/25 22:57:39 fenyo Exp $
Author:
Alexandre Fenyo

Field Summary
private  AwtGUI awtGUI
           
private  Background background
           
private  int bglevel
           
private  Config config
           
private  org.eclipse.swt.widgets.Display display
           
private  org.eclipse.swt.widgets.Group group_target_group
           
private  org.eclipse.swt.layout.GridLayout group_target_group_layout
           
private  org.eclipse.swt.widgets.Group group_target_host
           
private  org.eclipse.swt.layout.GridLayout group_target_host_layout
           
private  org.eclipse.swt.widgets.Group group_target_host6
           
private  org.eclipse.swt.layout.GridLayout group_target_host6_layout
           
private  org.eclipse.swt.widgets.Group group_target_range
           
private  org.eclipse.swt.layout.GridLayout group_target_range_layout
           
private  org.eclipse.swt.widgets.Group group_target_subnet
           
private  org.eclipse.swt.layout.GridLayout group_target_subnet_layout
           
private  org.eclipse.swt.widgets.Composite groups_composite
           
private  org.eclipse.swt.layout.GridData groups_composite_grid_data
           
private  org.eclipse.swt.layout.RowLayout groups_composite_layout
           
private  boolean[] GUI_created
           
private  org.eclipse.swt.widgets.Composite horizontal_composite
           
private  org.eclipse.swt.layout.GridLayout horizontal_composite_layout
           
private  org.eclipse.swt.custom.SashForm horizontal_sash
           
private  org.eclipse.swt.layout.GridData horizontal_sash_grid_data
           
private  org.eclipse.swt.graphics.Image image_exec
           
private  org.eclipse.swt.graphics.Image image_folder
           
private  org.eclipse.swt.graphics.Image image_host
           
private  org.eclipse.swt.graphics.Image image_host_snmp
           
private  org.eclipse.swt.graphics.Image image_host6
           
private  org.eclipse.swt.graphics.Image image_host6_snmp
           
private  org.eclipse.swt.graphics.Image image_interface
           
private  org.eclipse.swt.graphics.Image image_multirow
           
private  org.eclipse.swt.graphics.Image image_network
           
private  org.eclipse.swt.graphics.Image image_oscillo
           
private  org.eclipse.swt.graphics.Image image_queue
           
private  org.eclipse.swt.graphics.Image image_watch
           
private  org.eclipse.swt.widgets.ToolItem item_add_host
           
private  org.eclipse.swt.widgets.ToolItem item_add_network
           
private  org.eclipse.swt.widgets.ToolItem item_add_ping
           
private  org.eclipse.swt.widgets.ToolItem item_discover_start
           
private  org.eclipse.swt.widgets.ToolItem item_discover_stop
           
private  org.eclipse.swt.widgets.ToolItem item_remove_action
           
private  org.eclipse.swt.widgets.ToolItem item_remove_target
           
private  org.eclipse.swt.widgets.Label label1
           
private  org.eclipse.swt.widgets.Label label2
           
private  org.eclipse.swt.widgets.Label label3
           
private  org.eclipse.swt.widgets.Label label4
           
private  org.eclipse.swt.widgets.Label label5
           
private  org.eclipse.swt.widgets.Label label6
           
private  org.eclipse.swt.widgets.Label label7
           
private  org.eclipse.swt.layout.GridLayout layout
           
private static Log log
           
private  Main main
           
private  org.eclipse.swt.widgets.Menu menu_bar
           
private  org.eclipse.swt.widgets.Menu menu_file
           
private  org.eclipse.swt.widgets.MenuItem menu_item_add_flood
           
private  org.eclipse.swt.widgets.MenuItem menu_item_add_group
           
private  org.eclipse.swt.widgets.MenuItem menu_item_add_host
           
private  org.eclipse.swt.widgets.MenuItem menu_item_add_host6
           
private  org.eclipse.swt.widgets.MenuItem menu_item_add_http
           
private  org.eclipse.swt.widgets.MenuItem menu_item_add_network
           
private  org.eclipse.swt.widgets.MenuItem menu_item_add_ping
           
private  org.eclipse.swt.widgets.MenuItem menu_item_add_process
           
private  org.eclipse.swt.widgets.MenuItem menu_item_add_range
           
private  org.eclipse.swt.widgets.MenuItem menu_item_add_source
           
private  org.eclipse.swt.widgets.MenuItem menu_item_credentials
           
private  org.eclipse.swt.widgets.MenuItem menu_item_exit
           
private  org.eclipse.swt.widgets.MenuItem menu_item_explore_nmap
           
private  org.eclipse.swt.widgets.MenuItem menu_item_explore_snmp
           
private  org.eclipse.swt.widgets.MenuItem menu_item_file
           
private  org.eclipse.swt.widgets.MenuItem menu_item_generic_options
           
private  org.eclipse.swt.widgets.MenuItem menu_item_http_options
           
private  org.eclipse.swt.widgets.MenuItem menu_item_ip_options
           
private  org.eclipse.swt.widgets.MenuItem menu_item_remove_action
           
private  org.eclipse.swt.widgets.MenuItem menu_item_remove_action_explore
           
private  org.eclipse.swt.widgets.MenuItem menu_item_remove_action_flood
           
private  org.eclipse.swt.widgets.MenuItem menu_item_remove_action_ping
           
private  org.eclipse.swt.widgets.MenuItem menu_item_remove_target
           
private  org.eclipse.swt.widgets.MenuItem menu_item_remove_view
           
private  org.eclipse.swt.widgets.MenuItem menu_item_remove_view_explore
           
private  org.eclipse.swt.widgets.MenuItem menu_item_remove_view_flood
           
private  org.eclipse.swt.widgets.MenuItem menu_item_remove_view_ping
           
(package private)  VisualElement previous_selection
           
private  org.eclipse.swt.widgets.ProgressBar progress_bar
           
private  org.eclipse.swt.layout.GridData progress_bar_grid_data
           
private  org.eclipse.swt.widgets.Shell shell
           
private  SNMPManager snmp_manager
           
private  org.eclipse.swt.custom.StyledText status
           
private  org.eclipse.swt.layout.GridData status_grid_data
           
 java.lang.Object sync_tree
           
private  Synchro synchro
           
private  org.eclipse.swt.custom.CTabFolder tab_folder
           
private  org.eclipse.swt.custom.CTabItem tab_item1
           
private  org.eclipse.swt.custom.CTabItem tab_item2
           
private  org.eclipse.swt.widgets.Button target_group_push
           
private  org.eclipse.swt.widgets.Text target_group_value
           
private  org.eclipse.swt.widgets.Button target_host_push
           
private  org.eclipse.swt.widgets.Text target_host_value
           
private  org.eclipse.swt.widgets.Button target_host6_push
           
private  org.eclipse.swt.widgets.Text target_host6_value
           
private  java.util.Map<Target,Target> target_map
           
private  org.eclipse.swt.widgets.Text target_range_begin
           
private  org.eclipse.swt.widgets.Text target_range_end
           
private  org.eclipse.swt.widgets.Button target_range_push
           
private  org.eclipse.swt.widgets.Text target_subnet_address
           
private  org.eclipse.swt.widgets.Text target_subnet_mask
           
private  org.eclipse.swt.widgets.Button target_subnet_push
           
private  org.eclipse.swt.browser.Browser text_console
           
private  java.lang.StringBuffer text_console_content
           
private  int text_console_do_not_go_on_top
           
private  java.lang.Thread thread
           
private  org.eclipse.swt.widgets.ToolBar toolbar
           
private  org.eclipse.swt.layout.GridData toolbar_grid_data
           
private  org.eclipse.swt.widgets.Tree tree
           
private  org.eclipse.swt.widgets.TreeColumn tree_column1
           
private  org.eclipse.swt.widgets.TreeColumn tree_column2
           
private  org.eclipse.swt.widgets.TreeColumn tree_column3
           
private  TargetGroup user_defined
           
private  org.eclipse.swt.custom.SashForm vertical_sash
           
private  org.eclipse.swt.layout.GridData vertical_sash_grid_data
           
private  Views views
           
private  VisualElement visual_queues
           
private  VisualElement visual_root
           
private  TargetGroup visual_thishost
           
private  VisualElement visual_transient
           
private  TargetGroup visual_transient_all
           
private  TargetGroup visual_transient_networks
           
 
Constructor Summary
GUI(Config config, Background background, Main main, SNMPManager snmp_manager, Synchro synchro)
          Constructor.
 
Method Summary
private  void addActionAll(org.eclipse.swt.widgets.TreeItem item, java.lang.Class clazz)
          Adds an action on every node under a specified root node.
private  void addFloodAll(org.eclipse.swt.widgets.TreeItem item)
          Adds a flood action on every nodes under a specified root node.
private  void addHTTPAll(org.eclipse.swt.widgets.TreeItem item)
          Adds a flood action on every nodes under a specified root node.
private  void addPingAll(org.eclipse.swt.widgets.TreeItem item)
          Adds a ping action on every nodes under a specified root node.
private  void addProcessAll(org.eclipse.swt.widgets.TreeItem item)
          Adds a process action on every nodes under a specified root node.
private  void addSourceAll(org.eclipse.swt.widgets.TreeItem item)
          Adds a source action on every nodes under a specified root node.
private  boolean addTargetAtCurrentPosition(Target target)
          Creates a new target or attaches an existing one to the current position.
 void appendConsole(java.lang.String str)
          Adds a string to the console.
private  void appendNetworkInterfaces()
           
 void asyncExec(java.lang.Runnable r)
           
 void asyncExecIfNeeded(java.lang.Runnable r)
          Execute this operation in the future in the SWT thread.
 boolean containsCanonicalInstance(Target target)
          Checks that this instance has already been created.
 void createFromXML(java.lang.String filename)
          Parses a configuration file to create initial targets.
private  void createGUI()
          Instanciates the GUI objects.
 void dropTargetInstance(VisualElement target)
          Removes a target.
 void end()
           
private  void exitApplication()
          Terminates the application.
private  void expandAll(org.eclipse.swt.widgets.TreeItem item)
          Expands every nodes under a specified root node.
private  void exploreNmap(org.eclipse.swt.widgets.TreeItem item)
          Adds an "nmap explore" action on every nodes under a specified root node.
private  void exploreSNMP(org.eclipse.swt.widgets.TreeItem item)
          Adds an "SNMP explore" action on every nodes under a specified root node.
 AwtGUI getAwtGUI()
          Returns the AwtGUI instance used to build AWT frames that host Java2D-drawn components.
 org.eclipse.swt.graphics.Color getBackgroundColor()
          Computes the desired background color.
 Target getCanonicalInstance(Target target)
          Returns the canonical instance of a target and registers this target as the canonical one if needed.
 Config getConfig()
          Return the configuration.
 boolean[] getGUICreated()
          Returns the multithreaded synchronization lock for GUI creation.
 org.eclipse.swt.graphics.Image getImageExec()
          Returns the picture "exec".
 org.eclipse.swt.graphics.Image getImageFolder()
          Returns the picture "image folder".
 org.eclipse.swt.graphics.Image getImageHost()
          Returns the picture "IPv4 host".
 org.eclipse.swt.graphics.Image getImageHost6()
          Returns the picture "IPv6 host".
 org.eclipse.swt.graphics.Image getImageHost6SNMP()
          Returns the picture "IPv6 SNMP host".
 org.eclipse.swt.graphics.Image getImageHostSNMP()
          Returns the picture "IPv4 SNMP host".
 org.eclipse.swt.graphics.Image getImageInterface()
          Returns the picture "interface".
 org.eclipse.swt.graphics.Image getImageMultiRow()
          Returns the picture "multirow".
 org.eclipse.swt.graphics.Image getImageNetwork()
          Returns the picture "network".
 org.eclipse.swt.graphics.Image getImageOscillo()
          Returns the picture "oscilloscope".
 org.eclipse.swt.graphics.Image getImageQueue()
          Returns the picture "queue".
 org.eclipse.swt.graphics.Image getImageWatch()
          Returns the picture "watch".
 org.eclipse.swt.widgets.Shell getShell()
          Return the root shell.
 SNMPManager getSNMPManager()
          Returns the SNMPManager instance.
 Synchro getSynchro()
          Returns the Synchro instance.
private  void getSysdescr(org.eclipse.swt.widgets.TreeItem item)
          Synchronously get system descriptions via SNMP on every nodes under a specified root node.
 org.eclipse.swt.custom.CTabFolder getTabFolder()
          Returns the tab folder.
 TargetGroup getVisualThisHost()
          Gets the tree node acting as the "local host" root.
 VisualElement getVisualTransient()
          Gets the tree node acting as the visual transient root.
 TargetGroup getVisualTransientAll()
          Gets the tree node acting as the "every host" root.
 TargetGroup getVisualTransientNetworks()
          Gets the tree node acting as the "every network" root.
 java.lang.String htmlFace(java.lang.String html)
          Encapsulates an html part into a face definition.
 void informTargetHasNewEventClass(Target target, java.lang.Class clazz)
           
private  void initFromSynchro(VisualElement elt)
           
private  void initSNMPQueriers(VisualElement elt)
           
private  boolean isSelectionTransient()
          Check that the selection is under the transient node.
 void join()
          Waits for the main thread to terminate.
private  void mergeAll(org.eclipse.swt.widgets.TreeItem item)
          Merges every nodes under a specified root node.
private  void removeActionOrView(org.eclipse.swt.widgets.TreeItem item, java.lang.Class clazz)
          Detaches action or view nodes under a specified root node.
private  void removeActions(org.eclipse.swt.widgets.TreeItem item)
          Detaches action nodes under a specified root node.
private  void removeActionsExplore(org.eclipse.swt.widgets.TreeItem item)
          Detaches "SNMP explore" actions under a specified root node.
private  void removeActionsFlood(org.eclipse.swt.widgets.TreeItem item)
          Detaches flood actions under a specified root node.
private  void removeActionsPing(org.eclipse.swt.widgets.TreeItem item)
          Detaches ping actions under a specified root node.
private  void removeViews(org.eclipse.swt.widgets.TreeItem item)
          Detaches every views under a specified root node.
private  void removeViewsExplore(org.eclipse.swt.widgets.TreeItem item)
          Detaches "SNMP explore" views under a specified root node.
private  void removeViewsFlood(org.eclipse.swt.widgets.TreeItem item)
          Detaches flood views under a specified root node.
private  void removeViewsPing(org.eclipse.swt.widgets.TreeItem item)
          Detaches ping views under a specified root node.
private  void removeVisualElements(org.eclipse.swt.widgets.TreeItem item)
          Detaches every nodes under a specified root node.
 void run()
          GUI thread.
private  void setEnableGroupTargetGroup(boolean enable)
          Enable/disable "add group" in the GUI.
private  void setEnableGroupTargetHost(boolean enable)
          Enable/disable "add host" in the GUI.
private  void setEnableGroupTargetRange(boolean enable)
          Enable/disable "add range" in the GUI.
private  void setEnableGroupTargetSubnet(boolean enable)
          Enable/disable "add subnet" in the GUI.
private  void setEnableMenuAndTool(boolean enable)
           
private  void setEnableMenuItemOptions(boolean enable)
           
 void setProgress(int position)
          Sets the progress bar position.
 void setStatus(java.lang.String str)
          Resets the status string.
 void showGUI()
          Moves the application to the top of the drawing order.
 void updateEnableState()
           
 void waitForCreation()
          Wait for the creation of the GUI objects.
private  void wakeupActions(VisualElement elt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static Log log

config

private Config config

background

private Background background

main

private Main main

snmp_manager

private SNMPManager snmp_manager

views

private Views views

synchro

private Synchro synchro

awtGUI

private AwtGUI awtGUI

display

private org.eclipse.swt.widgets.Display display

shell

private org.eclipse.swt.widgets.Shell shell

layout

private org.eclipse.swt.layout.GridLayout layout

menu_bar

private org.eclipse.swt.widgets.Menu menu_bar

menu_file

private org.eclipse.swt.widgets.Menu menu_file

menu_item_file

private org.eclipse.swt.widgets.MenuItem menu_item_file

menu_item_exit

private org.eclipse.swt.widgets.MenuItem menu_item_exit

toolbar

private org.eclipse.swt.widgets.ToolBar toolbar

toolbar_grid_data

private org.eclipse.swt.layout.GridData toolbar_grid_data

vertical_sash

private org.eclipse.swt.custom.SashForm vertical_sash

vertical_sash_grid_data

private org.eclipse.swt.layout.GridData vertical_sash_grid_data

horizontal_composite

private org.eclipse.swt.widgets.Composite horizontal_composite

horizontal_composite_layout

private org.eclipse.swt.layout.GridLayout horizontal_composite_layout

text_console

private org.eclipse.swt.browser.Browser text_console

text_console_content

private java.lang.StringBuffer text_console_content

groups_composite

private org.eclipse.swt.widgets.Composite groups_composite

groups_composite_layout

private org.eclipse.swt.layout.RowLayout groups_composite_layout

groups_composite_grid_data

private org.eclipse.swt.layout.GridData groups_composite_grid_data

group_target_subnet

private org.eclipse.swt.widgets.Group group_target_subnet

group_target_range

private org.eclipse.swt.widgets.Group group_target_range

group_target_host

private org.eclipse.swt.widgets.Group group_target_host

group_target_group

private org.eclipse.swt.widgets.Group group_target_group

group_target_host6

private org.eclipse.swt.widgets.Group group_target_host6

group_target_subnet_layout

private org.eclipse.swt.layout.GridLayout group_target_subnet_layout

group_target_range_layout

private org.eclipse.swt.layout.GridLayout group_target_range_layout

group_target_host_layout

private org.eclipse.swt.layout.GridLayout group_target_host_layout

group_target_group_layout

private org.eclipse.swt.layout.GridLayout group_target_group_layout

group_target_host6_layout

private org.eclipse.swt.layout.GridLayout group_target_host6_layout

target_subnet_address

private org.eclipse.swt.widgets.Text target_subnet_address

target_subnet_mask

private org.eclipse.swt.widgets.Text target_subnet_mask

target_range_begin

private org.eclipse.swt.widgets.Text target_range_begin

target_range_end

private org.eclipse.swt.widgets.Text target_range_end

target_subnet_push

private org.eclipse.swt.widgets.Button target_subnet_push

target_range_push

private org.eclipse.swt.widgets.Button target_range_push

target_host_value

private org.eclipse.swt.widgets.Text target_host_value

target_group_value

private org.eclipse.swt.widgets.Text target_group_value

target_host6_value

private org.eclipse.swt.widgets.Text target_host6_value

target_host_push

private org.eclipse.swt.widgets.Button target_host_push

target_group_push

private org.eclipse.swt.widgets.Button target_group_push

target_host6_push

private org.eclipse.swt.widgets.Button target_host6_push

user_defined

private TargetGroup user_defined

bglevel

private final int bglevel
See Also:
Constant Field Values

horizontal_sash

private org.eclipse.swt.custom.SashForm horizontal_sash

horizontal_sash_grid_data

private org.eclipse.swt.layout.GridData horizontal_sash_grid_data

tree

private org.eclipse.swt.widgets.Tree tree

tree_column1

private org.eclipse.swt.widgets.TreeColumn tree_column1

tree_column2

private org.eclipse.swt.widgets.TreeColumn tree_column2

tree_column3

private org.eclipse.swt.widgets.TreeColumn tree_column3

status

private org.eclipse.swt.custom.StyledText status

status_grid_data

private org.eclipse.swt.layout.GridData status_grid_data

progress_bar

private org.eclipse.swt.widgets.ProgressBar progress_bar

progress_bar_grid_data

private org.eclipse.swt.layout.GridData progress_bar_grid_data

tab_folder

private org.eclipse.swt.custom.CTabFolder tab_folder

thread

private java.lang.Thread thread

GUI_created

private final boolean[] GUI_created

image_folder

private org.eclipse.swt.graphics.Image image_folder

image_oscillo

private org.eclipse.swt.graphics.Image image_oscillo

image_exec

private org.eclipse.swt.graphics.Image image_exec

image_watch

private org.eclipse.swt.graphics.Image image_watch

image_host

private org.eclipse.swt.graphics.Image image_host

image_host6

private org.eclipse.swt.graphics.Image image_host6

image_host_snmp

private org.eclipse.swt.graphics.Image image_host_snmp

image_host6_snmp

private org.eclipse.swt.graphics.Image image_host6_snmp

image_interface

private org.eclipse.swt.graphics.Image image_interface

image_queue

private org.eclipse.swt.graphics.Image image_queue

image_network

private org.eclipse.swt.graphics.Image image_network

image_multirow

private org.eclipse.swt.graphics.Image image_multirow

visual_root

private VisualElement visual_root

visual_queues

private VisualElement visual_queues

visual_transient

private VisualElement visual_transient

visual_thishost

private TargetGroup visual_thishost

visual_transient_all

private TargetGroup visual_transient_all

visual_transient_networks

private TargetGroup visual_transient_networks

label1

private org.eclipse.swt.widgets.Label label1

label2

private org.eclipse.swt.widgets.Label label2

label3

private org.eclipse.swt.widgets.Label label3

label4

private org.eclipse.swt.widgets.Label label4

label5

private org.eclipse.swt.widgets.Label label5

label6

private org.eclipse.swt.widgets.Label label6

label7

private org.eclipse.swt.widgets.Label label7

menu_item_add_host

private org.eclipse.swt.widgets.MenuItem menu_item_add_host

menu_item_add_host6

private org.eclipse.swt.widgets.MenuItem menu_item_add_host6

menu_item_add_range

private org.eclipse.swt.widgets.MenuItem menu_item_add_range

menu_item_add_network

private org.eclipse.swt.widgets.MenuItem menu_item_add_network

menu_item_add_group

private org.eclipse.swt.widgets.MenuItem menu_item_add_group

menu_item_remove_target

private org.eclipse.swt.widgets.MenuItem menu_item_remove_target

item_add_host

private org.eclipse.swt.widgets.ToolItem item_add_host

item_add_network

private org.eclipse.swt.widgets.ToolItem item_add_network

item_discover_start

private org.eclipse.swt.widgets.ToolItem item_discover_start

item_discover_stop

private org.eclipse.swt.widgets.ToolItem item_discover_stop

item_remove_target

private org.eclipse.swt.widgets.ToolItem item_remove_target

item_add_ping

private org.eclipse.swt.widgets.ToolItem item_add_ping

item_remove_action

private org.eclipse.swt.widgets.ToolItem item_remove_action

menu_item_credentials

private org.eclipse.swt.widgets.MenuItem menu_item_credentials

menu_item_ip_options

private org.eclipse.swt.widgets.MenuItem menu_item_ip_options

menu_item_http_options

private org.eclipse.swt.widgets.MenuItem menu_item_http_options

menu_item_generic_options

private org.eclipse.swt.widgets.MenuItem menu_item_generic_options

menu_item_add_ping

private org.eclipse.swt.widgets.MenuItem menu_item_add_ping

menu_item_add_process

private org.eclipse.swt.widgets.MenuItem menu_item_add_process

menu_item_add_source

private org.eclipse.swt.widgets.MenuItem menu_item_add_source

menu_item_add_flood

private org.eclipse.swt.widgets.MenuItem menu_item_add_flood

menu_item_add_http

private org.eclipse.swt.widgets.MenuItem menu_item_add_http

menu_item_explore_snmp

private org.eclipse.swt.widgets.MenuItem menu_item_explore_snmp

menu_item_explore_nmap

private org.eclipse.swt.widgets.MenuItem menu_item_explore_nmap

menu_item_remove_action

private org.eclipse.swt.widgets.MenuItem menu_item_remove_action

menu_item_remove_action_ping

private org.eclipse.swt.widgets.MenuItem menu_item_remove_action_ping

menu_item_remove_action_flood

private org.eclipse.swt.widgets.MenuItem menu_item_remove_action_flood

menu_item_remove_action_explore

private org.eclipse.swt.widgets.MenuItem menu_item_remove_action_explore

menu_item_remove_view

private org.eclipse.swt.widgets.MenuItem menu_item_remove_view

menu_item_remove_view_ping

private org.eclipse.swt.widgets.MenuItem menu_item_remove_view_ping

menu_item_remove_view_flood

private org.eclipse.swt.widgets.MenuItem menu_item_remove_view_flood

menu_item_remove_view_explore

private org.eclipse.swt.widgets.MenuItem menu_item_remove_view_explore

previous_selection

VisualElement previous_selection

sync_tree

public java.lang.Object sync_tree

target_map

private final java.util.Map<Target,Target> target_map

tab_item1

private org.eclipse.swt.custom.CTabItem tab_item1

tab_item2

private org.eclipse.swt.custom.CTabItem tab_item2

text_console_do_not_go_on_top

private int text_console_do_not_go_on_top
Constructor Detail

GUI

public GUI(Config config,
           Background background,
           Main main,
           SNMPManager snmp_manager,
           Synchro synchro)
Constructor. main thread. Builds a user interface. main thread.

Parameters:
none. -
Method Detail

getConfig

public Config getConfig()
Return the configuration.

Parameters:
none. -
Returns:
Config configuration.

getShell

public org.eclipse.swt.widgets.Shell getShell()
Return the root shell.

Parameters:
none. -
Returns:
Shell shell.

getBackgroundColor

public org.eclipse.swt.graphics.Color getBackgroundColor()
Computes the desired background color.

Parameters:
none. -
Returns:
background color.

getSNMPManager

public SNMPManager getSNMPManager()
Returns the SNMPManager instance.

Parameters:
none. -
Returns:
SNMPManager instance.

getSynchro

public Synchro getSynchro()
Returns the Synchro instance.

Parameters:
none. -
Returns:
Synchro instance.

getGUICreated

public boolean[] getGUICreated()
Returns the multithreaded synchronization lock for GUI creation.

Parameters:
none. -
Returns:
lock.

getVisualTransient

public VisualElement getVisualTransient()
Gets the tree node acting as the visual transient root.

Parameters:
none. -
Returns:
VisualElement visual transient element.

getVisualThisHost

public TargetGroup getVisualThisHost()
Gets the tree node acting as the "local host" root.

Parameters:
none. -
Returns:
TargetGroup visual transient node.

getVisualTransientAll

public TargetGroup getVisualTransientAll()
Gets the tree node acting as the "every host" root.

Parameters:
none. -
Returns:
TargetGroup "every host" node.

getVisualTransientNetworks

public TargetGroup getVisualTransientNetworks()
Gets the tree node acting as the "every network" root.

Parameters:
none. -
Returns:
TargetGroup "every network" node.

getAwtGUI

public AwtGUI getAwtGUI()
Returns the AwtGUI instance used to build AWT frames that host Java2D-drawn components.

Parameters:
none. -
Returns:
AwtGUI AWT gui.

dropTargetInstance

public void dropTargetInstance(VisualElement target)
Removes a target.

Parameters:
target - target to remove.

getCanonicalInstance

public Target getCanonicalInstance(Target target)
Returns the canonical instance of a target and registers this target as the canonical one if needed. The canonical instance is an instance that equals to this one and that was the first created.

Parameters:
target - instance.
Returns:
Target canonical instance.

containsCanonicalInstance

public boolean containsCanonicalInstance(Target target)
Checks that this instance has already been created.

Parameters:
target - checks against this instance.
Returns:
true if this instance has already been created.

asyncExecIfNeeded

public void asyncExecIfNeeded(java.lang.Runnable r)
Execute this operation in the future in the SWT thread.

Parameters:
r - operation to execute.

asyncExec

public void asyncExec(java.lang.Runnable r)

getTabFolder

public org.eclipse.swt.custom.CTabFolder getTabFolder()
Returns the tab folder.

Parameters:
none. -
Returns:
CTabFolder tab folder.

getImageFolder

public org.eclipse.swt.graphics.Image getImageFolder()
Returns the picture "image folder".

Parameters:
none. -
Returns:
Image picture.

getImageExec

public org.eclipse.swt.graphics.Image getImageExec()
Returns the picture "exec".

Parameters:
none. -
Returns:
Image picture.

getImageOscillo

public org.eclipse.swt.graphics.Image getImageOscillo()
Returns the picture "oscilloscope".

Parameters:
none. -
Returns:
Image picture.

getImageMultiRow

public org.eclipse.swt.graphics.Image getImageMultiRow()
Returns the picture "multirow".

Parameters:
none. -
Returns:
Image picture.

getImageWatch

public org.eclipse.swt.graphics.Image getImageWatch()
Returns the picture "watch".

Parameters:
none. -
Returns:
Image picture.

getImageHost

public org.eclipse.swt.graphics.Image getImageHost()
Returns the picture "IPv4 host".

Parameters:
none. -
Returns:
Image picture.

getImageHost6

public org.eclipse.swt.graphics.Image getImageHost6()
Returns the picture "IPv6 host".

Parameters:
none. -
Returns:
Image picture.

getImageInterface

public org.eclipse.swt.graphics.Image getImageInterface()
Returns the picture "interface".

Parameters:
none. -
Returns:
Image picture.

getImageQueue

public org.eclipse.swt.graphics.Image getImageQueue()
Returns the picture "queue".

Parameters:
none. -
Returns:
Image picture.

getImageNetwork

public org.eclipse.swt.graphics.Image getImageNetwork()
Returns the picture "network".

Parameters:
none. -
Returns:
Image picture.

getImageHostSNMP

public org.eclipse.swt.graphics.Image getImageHostSNMP()
Returns the picture "IPv4 SNMP host".

Parameters:
none. -
Returns:
Image picture.

getImageHost6SNMP

public org.eclipse.swt.graphics.Image getImageHost6SNMP()
Returns the picture "IPv6 SNMP host".

Parameters:
none. -
Returns:
Image picture.

setStatus

public void setStatus(java.lang.String str)
Resets the status string. May be called from any thread.

Parameters:
none. -

setProgress

public void setProgress(int position)
Sets the progress bar position.

Parameters:
position - position.

htmlFace

public java.lang.String htmlFace(java.lang.String html)
Encapsulates an html part into a face definition.

Parameters:
html - html source part.
Returns:
embeded html part.

appendConsole

public void appendConsole(java.lang.String str)
Adds a string to the console. May be called from any thread.

Parameters:
none. -

isSelectionTransient

private boolean isSelectionTransient()
Check that the selection is under the transient node.

Parameters:
none. -
Returns:
true if the selection is under the transient node.

expandAll

private void expandAll(org.eclipse.swt.widgets.TreeItem item)
Expands every nodes under a specified root node.

Parameters:
item - root node.

mergeAll

private void mergeAll(org.eclipse.swt.widgets.TreeItem item)
Merges every nodes under a specified root node.

Parameters:
item - root node.

addActionAll

private void addActionAll(org.eclipse.swt.widgets.TreeItem item,
                          java.lang.Class clazz)
Adds an action on every node under a specified root node.

Parameters:
item - root node.
clazz - action class.

addPingAll

private void addPingAll(org.eclipse.swt.widgets.TreeItem item)
Adds a ping action on every nodes under a specified root node.

Parameters:
item - root node.

addProcessAll

private void addProcessAll(org.eclipse.swt.widgets.TreeItem item)
Adds a process action on every nodes under a specified root node.

Parameters:
item - root node.

addSourceAll

private void addSourceAll(org.eclipse.swt.widgets.TreeItem item)
Adds a source action on every nodes under a specified root node.

Parameters:
item - root node.

addFloodAll

private void addFloodAll(org.eclipse.swt.widgets.TreeItem item)
Adds a flood action on every nodes under a specified root node.

Parameters:
item - root node.

addHTTPAll

private void addHTTPAll(org.eclipse.swt.widgets.TreeItem item)
Adds a flood action on every nodes under a specified root node.

Parameters:
item - root node.

exploreSNMP

private void exploreSNMP(org.eclipse.swt.widgets.TreeItem item)
Adds an "SNMP explore" action on every nodes under a specified root node.

Parameters:
item - root node.

exploreNmap

private void exploreNmap(org.eclipse.swt.widgets.TreeItem item)
Adds an "nmap explore" action on every nodes under a specified root node.

Parameters:
item - root node.

getSysdescr

private void getSysdescr(org.eclipse.swt.widgets.TreeItem item)
Synchronously get system descriptions via SNMP on every nodes under a specified root node.

Parameters:
item - item root node.

removeVisualElements

private void removeVisualElements(org.eclipse.swt.widgets.TreeItem item)
Detaches every nodes under a specified root node.

Parameters:
item - item root node.

removeActionOrView

private void removeActionOrView(org.eclipse.swt.widgets.TreeItem item,
                                java.lang.Class clazz)
Detaches action or view nodes under a specified root node.

Parameters:
item - item root node.

removeActions

private void removeActions(org.eclipse.swt.widgets.TreeItem item)
Detaches action nodes under a specified root node.

Parameters:
item - item root node.

removeActionsPing

private void removeActionsPing(org.eclipse.swt.widgets.TreeItem item)
Detaches ping actions under a specified root node.

Parameters:
item - item root node.

removeActionsFlood

private void removeActionsFlood(org.eclipse.swt.widgets.TreeItem item)
Detaches flood actions under a specified root node.

Parameters:
item - item root node.

removeActionsExplore

private void removeActionsExplore(org.eclipse.swt.widgets.TreeItem item)
Detaches "SNMP explore" actions under a specified root node.

Parameters:
item - item root node.

removeViews

private void removeViews(org.eclipse.swt.widgets.TreeItem item)
Detaches every views under a specified root node.

Parameters:
item - item root node.

removeViewsPing

private void removeViewsPing(org.eclipse.swt.widgets.TreeItem item)
Detaches ping views under a specified root node.

Parameters:
item - item root node.

removeViewsFlood

private void removeViewsFlood(org.eclipse.swt.widgets.TreeItem item)
Detaches flood views under a specified root node.

Parameters:
item - item root node.

removeViewsExplore

private void removeViewsExplore(org.eclipse.swt.widgets.TreeItem item)
Detaches "SNMP explore" views under a specified root node.

Parameters:
item - item root node.

addTargetAtCurrentPosition

private boolean addTargetAtCurrentPosition(Target target)
Creates a new target or attaches an existing one to the current position.

Parameters:
target - target.
Returns:
boolean true if the target has been created or attached.

exitApplication

private void exitApplication()
Terminates the application.

Parameters:
none. -

appendNetworkInterfaces

private void appendNetworkInterfaces()

createGUI

private void createGUI()
                throws java.net.UnknownHostException,
                       java.net.SocketException,
                       AlgorithmException
Instanciates the GUI objects. GUI thread.

Parameters:
none. -
Throws:
java.net.UnknownHostException
java.net.SocketException
AlgorithmException

informTargetHasNewEventClass

public void informTargetHasNewEventClass(Target target,
                                         java.lang.Class clazz)

waitForCreation

public void waitForCreation()
Wait for the creation of the GUI objects. Can be called from any thread. main thread.

Parameters:
none. -

run

public void run()
GUI thread.

Specified by:
run in interface java.lang.Runnable
Parameters:
none. -

end

public void end()
         throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

join

public void join()
Waits for the main thread to terminate. main thread.

Parameters:
none. -

updateEnableState

public void updateEnableState()

setEnableGroupTargetSubnet

private void setEnableGroupTargetSubnet(boolean enable)
Enable/disable "add subnet" in the GUI.

Parameters:
enable - enable/disable switch.

setEnableGroupTargetRange

private void setEnableGroupTargetRange(boolean enable)
Enable/disable "add range" in the GUI.

Parameters:
enable - enable/disable switch.

setEnableGroupTargetHost

private void setEnableGroupTargetHost(boolean enable)
Enable/disable "add host" in the GUI.

Parameters:
enable - enable/disable switch.

setEnableMenuItemOptions

private void setEnableMenuItemOptions(boolean enable)

setEnableMenuAndTool

private void setEnableMenuAndTool(boolean enable)

setEnableGroupTargetGroup

private void setEnableGroupTargetGroup(boolean enable)
Enable/disable "add group" in the GUI.

Parameters:
enable - enable/disable switch.

initFromSynchro

private void initFromSynchro(VisualElement elt)

wakeupActions

private void wakeupActions(VisualElement elt)

initSNMPQueriers

private void initSNMPQueriers(VisualElement elt)

createFromXML

public void createFromXML(java.lang.String filename)
Parses a configuration file to create initial targets.

Parameters:
filename - configuration file.

showGUI

public void showGUI()
Moves the application to the top of the drawing order.

Parameters:
none. -