mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
Select Fetchers now has a shortcut.
EditFavoritesDialog now used FormLayout. Some fixes in SelecteFetchersDialog and EditOpenersDialog. git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk/ipscan@118 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
parent
afa87fe2a0
commit
cbbf2ea694
@ -102,8 +102,8 @@ public abstract class AbstractModalDialog {
|
||||
cancelButton = fooButton;
|
||||
}
|
||||
// both buttons
|
||||
cancelButton.setLayoutData(LayoutHelper.formData(85, SWT.DEFAULT, null, new FormAttachment(100), new FormAttachment(control, 6), null));
|
||||
okButton.setLayoutData(LayoutHelper.formData(85, SWT.DEFAULT, null, new FormAttachment(cancelButton, -10), new FormAttachment(control, 6), null));
|
||||
cancelButton.setLayoutData(LayoutHelper.formData(85, SWT.DEFAULT, null, new FormAttachment(control, 0, SWT.RIGHT), new FormAttachment(control, 8), null));
|
||||
okButton.setLayoutData(LayoutHelper.formData(85, SWT.DEFAULT, null, new FormAttachment(cancelButton, -10), new FormAttachment(control, 8), null));
|
||||
}
|
||||
|
||||
// common listeners follow
|
||||
|
||||
@ -8,9 +8,10 @@ import java.util.Iterator;
|
||||
import net.azib.ipscan.config.Config;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.config.NamedListConfig;
|
||||
import net.azib.ipscan.gui.util.LayoutHelper;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.FormAttachment;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
@ -41,15 +42,13 @@ public class EditFavoritesDialog extends AbstractModalDialog {
|
||||
shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
|
||||
|
||||
shell.setText(Labels.getLabel("title.favorite.edit"));
|
||||
shell.setLayout(null);
|
||||
shell.setLayout(LayoutHelper.formLayout(10, 10, 4));
|
||||
|
||||
Label messageLabel = new Label(shell, SWT.NONE);
|
||||
messageLabel.setText(Labels.getLabel("text.favorite.edit"));
|
||||
messageLabel.pack();
|
||||
messageLabel.setLocation(10, 10);
|
||||
|
||||
favoritesList = new List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
|
||||
favoritesList.setBounds(new Rectangle(10, 30, 330, 200));
|
||||
favoritesList.setLayoutData(LayoutHelper.formData(330, 200, new FormAttachment(0), null, new FormAttachment(messageLabel), null));
|
||||
for (Iterator i = Config.getFavoritesConfig().iterateNames(); i.hasNext();) {
|
||||
String name = (String) i.next();
|
||||
favoritesList.add(name);
|
||||
@ -57,31 +56,29 @@ public class EditFavoritesDialog extends AbstractModalDialog {
|
||||
|
||||
Button upButton = new Button(shell, SWT.NONE);
|
||||
upButton.setText(Labels.getLabel("button.up"));
|
||||
upButton.pack();
|
||||
upButton.setLocation(350, 30);
|
||||
upButton.addListener(SWT.Selection, new UpButtonListener(favoritesList));
|
||||
|
||||
Button downButton = new Button(shell, SWT.NONE);
|
||||
downButton.setText(Labels.getLabel("button.down"));
|
||||
downButton.pack();
|
||||
downButton.setLocation(350, 60);
|
||||
downButton.addListener(SWT.Selection, new DownButtonListener(favoritesList));
|
||||
|
||||
Button deleteButton = new Button(shell, SWT.NONE);
|
||||
deleteButton.setText(Labels.getLabel("button.delete"));
|
||||
deleteButton.pack();
|
||||
deleteButton.setLocation(350, 105);
|
||||
deleteButton.addListener(SWT.Selection, new DeleteButtonListener());
|
||||
|
||||
upButton.setLayoutData(LayoutHelper.formData(new FormAttachment(favoritesList), new FormAttachment(deleteButton, 0, SWT.RIGHT), new FormAttachment(messageLabel), null));
|
||||
downButton.setLayoutData(LayoutHelper.formData(new FormAttachment(favoritesList), new FormAttachment(deleteButton, 0, SWT.RIGHT), new FormAttachment(upButton), null));
|
||||
deleteButton.setLayoutData(LayoutHelper.formData(new FormAttachment(favoritesList), null, new FormAttachment(downButton, 10), null));
|
||||
|
||||
Button okButton = new Button(shell, SWT.NONE);
|
||||
okButton.setText(Labels.getLabel("button.OK"));
|
||||
|
||||
Button cancelButton = new Button(shell, SWT.NONE);
|
||||
cancelButton.setText(Labels.getLabel("button.cancel"));
|
||||
|
||||
positionButtonsInFormLayout(okButton, cancelButton, favoritesList);
|
||||
|
||||
shell.pack();
|
||||
shell.setSize(shell.getSize().x, 297);
|
||||
positionButtons(okButton, cancelButton);
|
||||
|
||||
okButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
|
||||
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
|
||||
|
||||
@ -67,7 +67,7 @@ public class EditOpenersDialog extends AbstractModalDialog {
|
||||
openersList = new List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
|
||||
editFieldsGroup = new Group(shell, SWT.NONE);
|
||||
|
||||
openersList.setLayoutData(LayoutHelper.formData(135, 200, null, null, new FormAttachment(messageLabel), new FormAttachment(editFieldsGroup, 0, SWT.BOTTOM)));
|
||||
openersList.setLayoutData(LayoutHelper.formData(135, 200, null, null, new FormAttachment(messageLabel, 10), new FormAttachment(editFieldsGroup, 0, SWT.BOTTOM)));
|
||||
for (Iterator i = Config.getOpenersConfig().iterateNames(); i.hasNext();) {
|
||||
String name = (String) i.next();
|
||||
openersList.add(name);
|
||||
@ -90,12 +90,12 @@ public class EditOpenersDialog extends AbstractModalDialog {
|
||||
deleteButton.setText(Labels.getLabel("button.delete"));
|
||||
deleteButton.addListener(SWT.Selection, new DeleteButtonListener());
|
||||
|
||||
upButton.setLayoutData(LayoutHelper.formData(new FormAttachment(openersList), new FormAttachment(deleteButton, 0, SWT.RIGHT), new FormAttachment(messageLabel), null));
|
||||
upButton.setLayoutData(LayoutHelper.formData(new FormAttachment(openersList), new FormAttachment(deleteButton, 0, SWT.RIGHT), new FormAttachment(messageLabel, 10), null));
|
||||
downButton.setLayoutData(LayoutHelper.formData(new FormAttachment(openersList), new FormAttachment(deleteButton, 0, SWT.RIGHT), new FormAttachment(upButton), null));
|
||||
addButton.setLayoutData(LayoutHelper.formData(new FormAttachment(openersList), new FormAttachment(deleteButton, 0, SWT.RIGHT), new FormAttachment(downButton, 16), null));
|
||||
deleteButton.setLayoutData(LayoutHelper.formData(new FormAttachment(openersList), null, new FormAttachment(addButton), null));
|
||||
|
||||
editFieldsGroup.setLayoutData(LayoutHelper.formData(new FormAttachment(upButton, 10), null, new FormAttachment(messageLabel), null));
|
||||
editFieldsGroup.setLayoutData(LayoutHelper.formData(new FormAttachment(upButton, 10), null, new FormAttachment(messageLabel, 10), null));
|
||||
RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
|
||||
rowLayout.fill = true;
|
||||
rowLayout.justify = true;
|
||||
|
||||
@ -86,8 +86,8 @@ public class MainMenu {
|
||||
createFavoritesMenu(menu);
|
||||
|
||||
subMenu = initMenu(menu, "menu.tools");
|
||||
initMenuItem(subMenu, "menu.tools.options", Platform.MAC_OS ? "Ctrl+," : "Ctrl+O", new Integer(SWT.MOD1 | (Platform.MAC_OS ? ',' : 'O')), initListener(ToolsActions.Options.class));
|
||||
initMenuItem(subMenu, "menu.tools.fetchers", null, null, initListener(ToolsActions.SelectFetchers.class));
|
||||
initMenuItem(subMenu, "menu.tools.options", "Ctrl+O", new Integer(SWT.MOD1 | (Platform.MAC_OS ? ',' : 'O')), initListener(ToolsActions.Options.class));
|
||||
initMenuItem(subMenu, "menu.tools.fetchers", "Ctrl+Shift+O", new Integer(SWT.MOD1 | SWT.MOD2 | (Platform.MAC_OS ? ',' : 'O')), initListener(ToolsActions.SelectFetchers.class));
|
||||
initMenuItem(subMenu, null, null, null, null);
|
||||
initMenuItem(subMenu, "menu.tools.delete", null, null, null);
|
||||
initMenuItem(subMenu, "menu.tools.lastInfo", "Ctrl+I", new Integer(SWT.MOD1 | 'I'), null);
|
||||
|
||||
@ -16,6 +16,7 @@ import net.azib.ipscan.fetchers.IPFetcher;
|
||||
import net.azib.ipscan.gui.util.LayoutHelper;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.FormAttachment;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
@ -57,18 +58,17 @@ public class SelectFetchersDialog extends AbstractModalDialog {
|
||||
shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
|
||||
|
||||
shell.setText(Labels.getLabel("title.fetchers.select"));
|
||||
shell.setLayout(LayoutHelper.formLayout(10, 10, 4));
|
||||
shell.setLayout(LayoutHelper.formLayout(10, 10, 4));
|
||||
|
||||
Label messageLabel = new Label(shell, SWT.WRAP);
|
||||
messageLabel.setText(Labels.getLabel("text.fetchers.select"));
|
||||
messageLabel.setLayoutData(LayoutHelper.formData(new FormAttachment(0), new FormAttachment(100), null, null));
|
||||
|
||||
Label selectedLabel = new Label(shell, SWT.NONE);
|
||||
selectedLabel.setText(Labels.getLabel("text.fetchers.selectedList"));
|
||||
selectedLabel.setLayoutData(LayoutHelper.formData(null, null, new FormAttachment(messageLabel, 5), null));
|
||||
|
||||
selectedFetchersList = new List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
|
||||
selectedFetchersList.setLayoutData(LayoutHelper.formData(140, 200, null, null, new FormAttachment(selectedLabel), null));
|
||||
selectedFetchersList.setLayoutData(LayoutHelper.formData(140, 200, new FormAttachment(0), new FormAttachment(selectedLabel, 80, SWT.RIGHT), new FormAttachment(selectedLabel), null));
|
||||
Iterator i = fetcherRegistry.getSelectedFetchers().iterator();
|
||||
i.next(); // skip IP
|
||||
while (i.hasNext()) {
|
||||
@ -127,6 +127,11 @@ public class SelectFetchersDialog extends AbstractModalDialog {
|
||||
removeButton.addListener(SWT.Selection, removeButtonListener);
|
||||
selectedFetchersList.addListener(SWT.MouseDoubleClick, removeButtonListener);
|
||||
|
||||
// this is a workaround for limitation of FormLayout to remove the extra edge below the form
|
||||
shell.layout();
|
||||
Rectangle bounds = registeredFetchersList.getBounds();
|
||||
messageLabel.setLayoutData(LayoutHelper.formData(bounds.x + bounds.width - 10, SWT.DEFAULT, new FormAttachment(0), null, null, null));
|
||||
|
||||
shell.pack();
|
||||
|
||||
cancelButton.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user