Commit 95bfb92b authored by Matija Obreza's avatar Matija Obreza
Browse files

Tab order improved

parent 54bac54f
......@@ -585,16 +585,26 @@ public class AppWindow {
});
tltmSettings.setText("Settings");
tltmSettings.setImage(settingsIcon);
ToolItem tltmAddFile = new ToolItem(toolBar, SWT.NONE);
tltmAddFile.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
addSourceFile();
}
});
tltmAddFile.setText("Add file");
tltmAddFile.setImage(openPackageIcon);
ToolItem tltmAddFile = new ToolItem(toolBar, SWT.NONE);
tltmAddFile.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
addSourceFile();
}
});
tltmAddFile.setText("Add file");
tltmAddFile.setImage(openPackageIcon);
ToolItem tltmDatabase = new ToolItem(toolBar, SWT.NONE);
tltmDatabase.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doDatabase();
}
});
tltmDatabase.setText("Add database");
tltmDatabase.setImage(AppWindow.addDatabaseIcon);
ToolItem tltmAutomap = new ToolItem(toolBar, SWT.NONE);
tltmAutomap.addSelectionListener(new SelectionAdapter() {
......@@ -615,16 +625,6 @@ public class AppWindow {
});
tltmPush.setText("Push");
tltmPush.setImage(pushDataIcon);
ToolItem tltmDatabase = new ToolItem(toolBar, SWT.NONE);
tltmDatabase.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doDatabase();
}
});
tltmDatabase.setText("Add database");
tltmDatabase.setImage(AppWindow.addDatabaseIcon);
m_bindingContext = initDataBindings();
}
......
/**
* Copyright 2014 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.genesys2.anno.gui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
import swing2swt.layout.BorderLayout;
public class AppWindow2 {
protected Shell shlGenesysMagic;
private MenuItem mntmQuit;
private Table table;
/**
* Launch the application.
*
* @param args
*/
public static void main(String[] args) {
try {
AppWindow2 window = new AppWindow2();
window.open();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Open the window.
*/
public void open() {
Display display = Display.getDefault();
createContents();
shlGenesysMagic.open();
shlGenesysMagic.layout();
while (!shlGenesysMagic.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
public static boolean isMac() {
if (System.getProperty("os.name").equals("Mac OS X")) {
return true;
}
return false;
}
/**
* Create contents of the window.
*/
protected void createContents() {
shlGenesysMagic = new Shell();
shlGenesysMagic.setMinimumSize(new Point(100, 22));
shlGenesysMagic.setSize(554, 374);
shlGenesysMagic.setText("Genesys Magic");
shlGenesysMagic.setLayout(new BorderLayout(5, 5));
Menu menu = new Menu(shlGenesysMagic, SWT.BAR);
shlGenesysMagic.setMenuBar(menu);
MenuItem mntmFile = new MenuItem(menu, SWT.CASCADE);
mntmFile.setText("File");
Menu menu_1 = new Menu(mntmFile);
mntmFile.setMenu(menu_1);
MenuItem mntmOpen = new MenuItem(menu_1, SWT.NONE);
mntmOpen.setText("Open");
new MenuItem(menu_1, SWT.SEPARATOR);
mntmQuit = new MenuItem(menu_1, SWT.NONE);
mntmQuit.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
System.err.println("Exiting now.");
shlGenesysMagic.dispose();
}
});
mntmQuit.setText("Quit");
MenuItem mntmHelp = new MenuItem(menu, SWT.CASCADE);
mntmHelp.setText("Help");
Menu menu_2 = new Menu(mntmHelp);
mntmHelp.setMenu(menu_2);
MenuItem mntmAbout = new MenuItem(menu_2, SWT.NONE);
mntmAbout.setText("About");
new MenuItem(menu_2, SWT.SEPARATOR);
MenuItem mntmVersion = new MenuItem(menu_2, SWT.NONE);
mntmVersion.setText("Version...");
SashForm sashForm = new SashForm(shlGenesysMagic, SWT.NONE);
sashForm.setLayoutData(BorderLayout.CENTER);
table = new Table(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableColumn tblclmnColumn = new TableColumn(table, SWT.NONE);
tblclmnColumn.setWidth(100);
tblclmnColumn.setText("Column");
TableColumn tblclmnRdfTerm = new TableColumn(table, SWT.NONE);
tblclmnRdfTerm.setWidth(200);
tblclmnRdfTerm.setText("Ontology Term");
Tree tree = new Tree(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
tree.setLinesVisible(true);
tree.setHeaderVisible(true);
TreeColumn trclmnTerms = new TreeColumn(tree, SWT.NONE);
trclmnTerms.setWidth(200);
trclmnTerms.setText("Terms");
TreeColumn trclmnUrl = new TreeColumn(tree, SWT.NONE);
trclmnUrl.setWidth(100);
trclmnUrl.setText("URL");
TreeItem trtmSomeTree = new TreeItem(tree, SWT.NONE);
trtmSomeTree.setChecked(true);
trtmSomeTree.setText("Some tree");
trtmSomeTree.setExpanded(true);
TreeItem trtmNewTreeitem_1 = new TreeItem(tree, SWT.NONE);
trtmNewTreeitem_1.setText("Bugger");
TreeItem trtmNewTreeitem = new TreeItem(tree, SWT.NONE);
trtmNewTreeitem.setText(new String[] { "Alpha", "beta" });
trtmNewTreeitem.setText("Another treee");
sashForm.setWeights(new int[] { 310, 239 });
}
}
......@@ -103,7 +103,7 @@ public class DatabaseDialog extends Dialog {
*/
private void createContents() {
shell = new Shell(getParent(), SWT.SHELL_TRIM);
shell.setSize(665, 445);
shell.setSize(674, 281);
shell.setText(getText());
shell.setLayout(new BorderLayout(0, 0));
......@@ -121,7 +121,7 @@ public class DatabaseDialog extends Dialog {
/* Datasource type */
Label lblType = new Label(grpDbConfiguration, SWT.NONE);
lblType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
lblType.setText("Datasource type");
lblType.setText("Database type");
comboType = new Combo(grpDbConfiguration, SWT.NONE);
comboType.setItems(getDriversNames(drivers.getJdbcDrivers()));
......@@ -149,7 +149,7 @@ public class DatabaseDialog extends Dialog {
Label lblDbUrl = new Label(grpDbConfiguration, SWT.NONE);
lblDbUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
lblDbUrl.setAlignment(SWT.RIGHT);
lblDbUrl.setText("Connection URL");
lblDbUrl.setText("JDBC Connection URL");
txtDbUrl = new Text(grpDbConfiguration, SWT.BORDER);
txtDbUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
......@@ -157,7 +157,7 @@ public class DatabaseDialog extends Dialog {
Label lblDbUserName = new Label(grpDbConfiguration, SWT.NONE);
lblDbUserName.setAlignment(SWT.RIGHT);
lblDbUserName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblDbUserName.setText("User");
lblDbUserName.setText("Username");
txtDbUserName = new Text(grpDbConfiguration, SWT.BORDER);
txtDbUserName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
......@@ -171,8 +171,7 @@ public class DatabaseDialog extends Dialog {
txtDbPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
Composite compositeFooter = new Composite(composite, SWT.NONE);
GridData gdFooter = new GridData(SWT.CENTER, SWT.TOP, true, false, 1, 1);
compositeFooter.setLayoutData(gdFooter);
compositeFooter.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false, 1, 1));
compositeFooter.setLayout(new RowLayout(SWT.HORIZONTAL));
Button btnDownloadFile = new Button(compositeFooter, SWT.NONE);
......
......@@ -51,6 +51,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import swing2swt.layout.BorderLayout;
import org.eclipse.swt.widgets.Control;
public class PushDialog extends Dialog {
private static final Logger _log = Logger.getLogger(PushDialog.class);
......@@ -84,6 +85,7 @@ public class PushDialog extends Dialog {
private SwtLogAppender logAppender;
private IDataSource dataSource;
private List<Future<?>> futures = new ArrayList<Future<?>>();
private ToolBar toolBar;
static {
deleteDataIcon = ImageDescriptor.createFromURL(PushDialog.class.getResource("/icon/delete.png")).createImage();
......@@ -115,6 +117,7 @@ public class PushDialog extends Dialog {
createContents();
logAppender = new SwtLogAppender(this.txtJson);
shell.setTabList(new Control[]{txtJson, toolBar});
logAppender.setConversionPattern("%d{yyyy-MM-dd HH:mm:ss} %-5p - %m%n");
shell.open();
......@@ -168,7 +171,7 @@ public class PushDialog extends Dialog {
shell.setText(getText());
shell.setLayout(new BorderLayout(0, 0));
ToolBar toolBar = new ToolBar(shell, SWT.FLAT);
toolBar = new ToolBar(shell, SWT.FLAT);
toolBar.setLayoutData(BorderLayout.NORTH);
ToolItem tltmNewItem = new ToolItem(toolBar, SWT.NONE);
......@@ -221,10 +224,10 @@ public class PushDialog extends Dialog {
logAppender.setThreshold(Level.DEBUG);
}
});
tltmRadioItemDebug.setSelection(true);
tltmRadioItemDebug.setText("DEBUG");
ToolItem tltmRadioItemInfo = new ToolItem(toolBar, SWT.RADIO);
tltmRadioItemInfo.setSelection(true);
tltmRadioItemInfo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
......
......@@ -231,8 +231,8 @@ public class SettingsDialog extends Dialog {
scrolledComposite.setContent(composite);
scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
TabItem tbtmTodo = new TabItem(tabFolder, SWT.NONE);
tbtmTodo.setText("TODO");
// TabItem tbtmTodo = new TabItem(tabFolder, SWT.NONE);
// tbtmTodo.setText("TODO");
m_bindingContext = initDataBindings();
}
......
......@@ -23,6 +23,7 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.SWTResourceManager;
import swing2swt.layout.BorderLayout;
import org.eclipse.swt.widgets.Control;
public class WorkspaceDialog extends Dialog {
......@@ -122,6 +123,7 @@ public class WorkspaceDialog extends Dialog {
lblWorkspaceError.setText("Cannot use selected directory as workspace!");
lblWorkspaceError.setVisible(false);
new Label(composite, SWT.NONE);
composite.setTabList(new Control[]{btnBrowse, txtWorkspacePath});
Composite composite_1 = new Composite(shlWorkspaceLauncher, SWT.NONE);
composite_1.setLayoutData(BorderLayout.SOUTH);
......@@ -149,6 +151,7 @@ public class WorkspaceDialog extends Dialog {
}
});
btnOk.setText("OK");
composite_1.setTabList(new Control[]{btnOk, btnCancel});
Composite composite_2 = new Composite(shlWorkspaceLauncher, SWT.NONE);
composite_2.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment