Skip to content

Commit

Permalink
Add "Clear all button"
Browse files Browse the repository at this point in the history
  • Loading branch information
dtitov committed Oct 10, 2019
1 parent ae3b0fc commit aa9dffd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>no.uio.ifi</groupId>
<artifactId>trackfind</artifactId>
<version>2.8.5</version>
<version>2.8.6</version>
<packaging>jar</packaging>

<name>trackfind</name>
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/no/uio/ifi/trackfind/frontend/TrackFindMainUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ public void handleAction(Object sender, Object target) {
executeQuery(queryTextArea.getValue());
}
});

Button clearAllButton = new Button("Clear all");
clearAllButton.setSizeFull();
clearAllButton.addClickListener((Button.ClickListener) event -> queryTextArea.clear());

Button searchButton = new Button("Search ➚", (Button.ClickListener) clickEvent -> executeQuery(queryTextArea.getValue()));
queryTextArea.addValueChangeListener((HasValue.ValueChangeListener<String>) event -> searchButton.setEnabled(StringUtils.isNotEmpty(queryTextArea.getValue())));
queryTextArea.addStyleName("scrollable-text-area");
Expand Down Expand Up @@ -239,8 +244,9 @@ public void handleAction(Object sender, Object target) {

Panel categoriesChecklistPanel = new Panel("Categories", new VerticalLayout(categoriesChecklist));
categoriesChecklistPanel.setSizeFull();
VerticalLayout queryLayout = new VerticalLayout(queryPanel, categoriesChecklistPanel, searchLayout);
queryLayout.setExpandRatio(queryPanel, 0.5f);
VerticalLayout queryLayout = new VerticalLayout(queryPanel, clearAllButton, categoriesChecklistPanel, searchLayout);
queryLayout.setExpandRatio(queryPanel, 0.4f);
queryLayout.setExpandRatio(clearAllButton, 0.1f);
queryLayout.setExpandRatio(categoriesChecklistPanel, 0.4f);
queryLayout.setExpandRatio(searchLayout, 0.1f);
queryLayout.setSizeFull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private void processDragAndDropMultiple(TextArea textArea, boolean logicalOperat
private void processDragAndDropSingle(TextArea textArea, boolean logicalOperation, boolean inversion, TreeNode item) {
String condition = CONDITIONS.get(logicalOperation);
String query = textArea.getValue();
if (StringUtils.isNoneEmpty(query)) {
if (StringUtils.isNoneEmpty(query.trim())) {
query += condition;
}
if (inversion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ public class SchemaServiceTest {

public static final String ATTRIBUTES =
"{\n" +
" \"@schema\": [\n" +
" \"\"\n" +
" ],\n" +
" \"experiments\": [\n" +
" \"'@schema'\",\n" +
" \"'aggregated_from'\",\n" +
Expand Down

0 comments on commit aa9dffd

Please sign in to comment.