From 2ed38652a9c98fae36461046ce9bd5581df045cf Mon Sep 17 00:00:00 2001 From: angryziber Date: Sat, 10 Nov 2007 15:28:48 +0000 Subject: [PATCH] * Preferences and Fetchers buttons added to the MainWindow * png icons are taken from the gnome Echo theme (by Fedora) git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@236 375186e5-ef17-0410-b0b6-91563547dcda --- TODO | 6 +- dictionary.txt | 1 + resources/Labels.txt | 4 +- resources/images/buttons/fetchers.png | Bin 0 -> 736 bytes resources/images/buttons/fetchers.svg | 281 ++++++++++++++++++ resources/images/buttons/fetchers2.png | Bin 0 -> 852 bytes resources/images/buttons/prefs.png | Bin 0 -> 1016 bytes resources/images/buttons/prefs.svg | 238 +++++++++++++++ .../azib/ipscan/config/ComponentRegistry.java | 4 + src/net/azib/ipscan/gui/MainWindow.java | 42 ++- 10 files changed, 565 insertions(+), 11 deletions(-) create mode 100644 resources/images/buttons/fetchers.png create mode 100644 resources/images/buttons/fetchers.svg create mode 100644 resources/images/buttons/fetchers2.png create mode 100644 resources/images/buttons/prefs.png create mode 100644 resources/images/buttons/prefs.svg diff --git a/TODO b/TODO index 3c371609..070036b8 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,3 @@ -Before 3.0 beta: - -* export/import of settings (profiles?) - Before 3.0: * command-line scanning start @@ -10,8 +6,8 @@ Before 3.0: * add new fetchers by configuration of PortTextFetcher * startup as root option * compile librocksaw for mac -* preferences & select fetchers buttons in the toolbar * plugin loader +* export/import of settings (profiles?) Later: diff --git a/dictionary.txt b/dictionary.txt index b18c3497..399b9916 100644 --- a/dictionary.txt +++ b/dictionary.txt @@ -30,3 +30,4 @@ compiz placeholder firewall registry +combo diff --git a/resources/Labels.txt b/resources/Labels.txt index f5fce890..29574150 100755 --- a/resources/Labels.txt +++ b/resources/Labels.txt @@ -79,7 +79,7 @@ text.threads=Threads: text.display.ALL=Display: All text.display.ALIVE=Display: Alive only text.display.PORTS=Display: Open ports -text.hostsSelected= hosts selected +text.hostsSelected=\u00A0hosts selected text.favorite.add=Enter the name of the new favorite text.favorite.edit=Below you can rearrange or delete favorites text.find=Enter the text to search for @@ -133,6 +133,8 @@ button.kill=Stop! button.kill.img=images/buttons/kill.png button.ipUp=IP button.ipUp.img=images/buttons/ipup.png +button.preferences.img=images/buttons/prefs.png +button.fetchers.img=images/buttons/fetchers.png button.up=&Up button.down=&Down button.delete=De&lete diff --git a/resources/images/buttons/fetchers.png b/resources/images/buttons/fetchers.png new file mode 100644 index 0000000000000000000000000000000000000000..36bcbebff85ad1e3b6bd8f1a8e946d0f8f0f4513 GIT binary patch literal 736 zcmV<60w4W}P)<_wvdrWuY*=3qKRQj4^r z!iAxNK~dDA$D-O+i-_7pi*^Me2vPI`cM2gv5WX1E8Ym1$45Y>fnWJOg>)iXb7$eM* z>1@8&Iec)wj}Z~FLH(J_c>?F{hS#$%nOc0)`QYv$01*EqMvk`Rs*2R=cDs^YkK5Xg zU%Yb5?Q%C282ZK?qoN)3RPv zhj+F#HyljYX zrLZ}WgW$Gecr+EFB;x$ZRs;+mN(=Kr%O;Ww3$PuhN7x#U{21u#-#ai6RRUg}*VRU_ z$)5w;A&kVwFp-!}JT%P+QEPF2(U} z^eYBqA5fq3o;U-0G`t`6bqAm*GTNVYfULRBE%U<{p1z#?%x*NGT9(nHs!RldF#yB> zB7h-tVgdsLK*;n#Ak(5{(?prb7><+_f%`TP`}Y^D`4u*o + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/resources/images/buttons/fetchers2.png b/resources/images/buttons/fetchers2.png new file mode 100644 index 0000000000000000000000000000000000000000..886804a69f8961e242f7837ed0119f5962266b35 GIT binary patch literal 852 zcmV-a1FQUrP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iFK6 z3>z?g5QuF600PuWL_t(I%Wad-Z&XznhM(`;GsE0z>Ci?LTkK-6NUWd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mmo;Ey9($@x=s$ksKQH}c m?_tQ4L4-} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/net/azib/ipscan/config/ComponentRegistry.java b/src/net/azib/ipscan/config/ComponentRegistry.java index efdf501d..77ea5d45 100755 --- a/src/net/azib/ipscan/config/ComponentRegistry.java +++ b/src/net/azib/ipscan/config/ComponentRegistry.java @@ -149,6 +149,8 @@ public class ComponentRegistry { anyComponentParameter, anyComponentParameter, anyComponentParameter, + anyComponentParameter, + anyComponentParameter, anyComponentParameter}); container.registerComponentImplementation(ResultTable.class, ResultTable.class, new Parameter[] { new ComponentParameter("mainShell"), @@ -186,6 +188,8 @@ public class ComponentRegistry { container.registerComponentImplementation(ColumnsActions.AboutFetcher.class); container.registerComponentImplementation(ColumnsActions.ColumnClick.class); container.registerComponentImplementation(ColumnsActions.ColumnResize.class); + container.registerComponentImplementation(ToolsActions.Preferences.class); + container.registerComponentImplementation(ToolsActions.ChooseFetchers.class); container.registerComponentImplementation(ToolsActions.TableSelection.class); } diff --git a/src/net/azib/ipscan/gui/MainWindow.java b/src/net/azib/ipscan/gui/MainWindow.java index 4e7052df..105f994c 100755 --- a/src/net/azib/ipscan/gui/MainWindow.java +++ b/src/net/azib/ipscan/gui/MainWindow.java @@ -15,6 +15,7 @@ import net.azib.ipscan.core.state.StateMachine; import net.azib.ipscan.core.state.StateTransitionListener; import net.azib.ipscan.gui.MainMenu.CommandsMenu; import net.azib.ipscan.gui.actions.StartStopScanningAction; +import net.azib.ipscan.gui.actions.ToolsActions; import net.azib.ipscan.gui.feeders.AbstractFeederGUI; import net.azib.ipscan.gui.feeders.FeederGUIRegistry; import net.azib.ipscan.gui.util.LayoutHelper; @@ -32,6 +33,7 @@ import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.MessageBox; @@ -54,18 +56,20 @@ public class MainWindow { private Combo feederSelectionCombo; private FeederGUIRegistry feederRegistry; + private Button prefsButton; + private Button fetchersButton; /** * Creates and initializes the main window. */ - public MainWindow(Shell shell, GlobalConfig globalConfig, Composite feederArea, Composite controlsArea, Combo feederSelectionCombo, Button startStopButton, StartStopScanningAction startStopScanningAction, ResultTable resultTable, StatusBar statusBar, CommandsMenu resultsContextMenu, FeederGUIRegistry feederGUIRegistry, StateMachine stateMachine) { + public MainWindow(Shell shell, GlobalConfig globalConfig, Composite feederArea, Composite controlsArea, Combo feederSelectionCombo, Button startStopButton, StartStopScanningAction startStopScanningAction, ResultTable resultTable, StatusBar statusBar, CommandsMenu resultsContextMenu, FeederGUIRegistry feederGUIRegistry, StateMachine stateMachine, ToolsActions.Preferences preferencesListener, ToolsActions.ChooseFetchers chooseFetchersListsner) { this.globalConfig = globalConfig; initShell(shell); initFeederArea(feederArea, feederGUIRegistry); - initControlsArea(controlsArea, feederSelectionCombo, startStopButton, startStopScanningAction); + initControlsArea(controlsArea, feederSelectionCombo, startStopButton, startStopScanningAction, preferencesListener, chooseFetchersListsner); initTableAndStatusBar(resultTable, resultsContextMenu, statusBar); @@ -83,7 +87,7 @@ public class MainWindow { if (globalConfig.isFirstRun) { if (Platform.CRIPPLED_WINDOWS) { - // inform crippled windows owners of configuration changes + // inform crippled windows owners of their default configuration MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK); box.setText(Version.NAME); box.setMessage(Labels.getLabel("text.crippledWindowsInfo")); @@ -150,7 +154,7 @@ public class MainWindow { /** * This method initializes main controls of the main window */ - private void initControlsArea(Composite controlsArea, Combo feederSelectionCombo, Button startStopButton, StartStopScanningAction startStopScanningAction) { + private void initControlsArea(final Composite controlsArea, final Combo feederSelectionCombo, final Button startStopButton, final StartStopScanningAction startStopScanningAction, final ToolsActions.Preferences preferencesListener, final ToolsActions.ChooseFetchers chooseFetchersListsner) { controlsArea.setLayoutData(LayoutHelper.formData(new FormAttachment(feederArea), new FormAttachment(100), new FormAttachment(0), new FormAttachment(feederArea, 0, SWT.BOTTOM))); RowLayout rowLayout = new RowLayout(SWT.VERTICAL); @@ -182,6 +186,31 @@ public class MainWindow { ((RowData)startStopButton.getLayoutData()).height = feederSelectionCombo.getBounds().height; ((RowData)startStopButton.getLayoutData()).width = feederSelectionCombo.getBounds().width; + + // traverse the button before the combo (and don't traverse other buttons at all) + controlsArea.setTabList(new Control[] {startStopButton, feederSelectionCombo}); + + prefsButton = new Button(controlsArea, SWT.NONE); + prefsButton.setImage(new Image(null, Labels.getInstance().getImageAsStream("button.preferences.img"))); + prefsButton.setToolTipText(Labels.getLabel("title.preferences")); + prefsButton.setLayoutData(new RowData(controlHeight, controlHeight)); + prefsButton.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + startStopButton.forceFocus(); + preferencesListener.handleEvent(event); + } + }); + + fetchersButton = new Button(controlsArea, SWT.NONE); + fetchersButton.setImage(new Image(null, Labels.getInstance().getImageAsStream("button.fetchers.img"))); + fetchersButton.setToolTipText(Labels.getLabel("title.fetchers.select")); + fetchersButton.setLayoutData(new RowData(controlHeight, controlHeight)); + fetchersButton.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + startStopButton.forceFocus(); + chooseFetchersListsner.handleEvent(event); + } + }); } /** @@ -215,7 +244,10 @@ public class MainWindow { shell.getDisplay().asyncExec(new Runnable() { public void run() { - feederSelectionCombo.setEnabled(state == ScanningState.IDLE); + boolean enabled = state == ScanningState.IDLE; + feederSelectionCombo.setEnabled(enabled); + prefsButton.setEnabled(enabled); + fetchersButton.setEnabled(enabled); } }); }