mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
* RandomFeeder.getInfo() now returns the count before the addresses - this seems more logical
* workaround of strange SWT or GTK bug with spinner: it updates it's textual value only when it looses focus * ExportProcessorTest fixed git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@156 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
parent
c6c4f5be0a
commit
5b24ec0ff0
@ -103,7 +103,7 @@ public class RandomFeeder implements Feeder {
|
||||
*/
|
||||
public String getInfo() {
|
||||
try {
|
||||
return InetAddress.getByAddress(prototypeBytes).getHostAddress() + " / " + InetAddress.getByAddress(maskBytes).getHostAddress() + ": " + addressCount;
|
||||
return addressCount + ": " + InetAddress.getByAddress(prototypeBytes).getHostAddress() + " / " + InetAddress.getByAddress(maskBytes).getHostAddress();
|
||||
}
|
||||
catch (UnknownHostException e) {
|
||||
assert false : e;
|
||||
|
||||
@ -18,6 +18,8 @@ import net.azib.ipscan.feeders.RandomFeeder;
|
||||
import net.azib.ipscan.gui.actions.FeederActions;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.TraverseEvent;
|
||||
import org.eclipse.swt.events.TraverseListener;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.FormAttachment;
|
||||
import org.eclipse.swt.layout.FormData;
|
||||
@ -146,6 +148,15 @@ public class RandomFeederGUI extends AbstractFeederGUI {
|
||||
formData.top = new FormAttachment(ipUpButton, 0, SWT.CENTER);
|
||||
formData.right = new FormAttachment(ipMaskCombo, 0, SWT.RIGHT);
|
||||
countSpinner.setLayoutData(formData);
|
||||
countSpinner.addTraverseListener(new TraverseListener() {
|
||||
public void keyTraversed(TraverseEvent e) {
|
||||
// this due to a bug either in SWT or GTK:
|
||||
// spinner getText() returns the new value only if
|
||||
// it has lost the focus first
|
||||
ipPrototypeText.forceFocus();
|
||||
countSpinner.forceFocus();
|
||||
}
|
||||
});
|
||||
|
||||
// do this stuff asynchronously (to show GUI faster)
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
@ -100,6 +100,7 @@ public class ExportProcessorTest {
|
||||
private Feeder createMockFeeder(String feederInfo) {
|
||||
Feeder feeder = createMock(Feeder.class);
|
||||
expect(feeder.getInfo()).andReturn(feederInfo);
|
||||
expect(feeder.getLabel()).andReturn("feeder.range");
|
||||
replay(feeder);
|
||||
return feeder;
|
||||
}
|
||||
|
||||
@ -137,8 +137,8 @@ public class RandomFeederTest {
|
||||
public void testGetInfo() {
|
||||
RandomFeeder randomFeeder = new RandomFeeder();
|
||||
randomFeeder.initialize("100.11.12.13", "100.11.12.15", 3);
|
||||
assertEquals("100.11.12.13 / 100.11.12.15: 3", randomFeeder.getInfo());
|
||||
assertEquals("3: 100.11.12.13 / 100.11.12.15", randomFeeder.getInfo());
|
||||
randomFeeder.initialize("0.0.0.0", "255.255.255.255", 129876);
|
||||
assertEquals("0.0.0.0 / 255.255.255.255: 129876", randomFeeder.getInfo());
|
||||
assertEquals("129876: 0.0.0.0 / 255.255.255.255", randomFeeder.getInfo());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user