better search box
This commit is contained in:
@@ -11,6 +11,7 @@ import net.i2p.crypto.DSAEngine
|
||||
import net.i2p.data.Base64
|
||||
import net.i2p.data.Signature
|
||||
|
||||
import java.awt.event.ActionEvent
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
import javax.annotation.Nonnull
|
||||
@@ -51,11 +52,16 @@ class MainFrameController {
|
||||
private volatile Core core
|
||||
|
||||
@ControllerAction
|
||||
void search() {
|
||||
void search(ActionEvent evt) {
|
||||
if (evt.getActionCommand() == null)
|
||||
return
|
||||
def cardsPanel = builder.getVariable("cards-panel")
|
||||
cardsPanel.getLayout().show(cardsPanel, "search window")
|
||||
|
||||
def search = builder.getVariable("search-field").text
|
||||
def searchField = builder.getVariable("search-field")
|
||||
def search = searchField.getSelectedItem()
|
||||
searchField.model.addElement(search)
|
||||
|
||||
search = search.trim()
|
||||
if (search.length() == 0)
|
||||
return
|
||||
|
@@ -11,6 +11,7 @@ import net.i2p.data.DataHelper
|
||||
import javax.swing.BorderFactory
|
||||
import javax.swing.Box
|
||||
import javax.swing.BoxLayout
|
||||
import javax.swing.JComboBox
|
||||
import javax.swing.JFileChooser
|
||||
import javax.swing.JFrame
|
||||
import javax.swing.JLabel
|
||||
@@ -24,6 +25,8 @@ import javax.swing.SwingConstants
|
||||
import javax.swing.SwingUtilities
|
||||
import javax.swing.TransferHandler
|
||||
import javax.swing.border.Border
|
||||
import javax.swing.event.DocumentEvent
|
||||
import javax.swing.event.DocumentListener
|
||||
import javax.swing.event.TreeExpansionEvent
|
||||
import javax.swing.event.TreeExpansionListener
|
||||
import javax.swing.table.DefaultTableCellRenderer
|
||||
@@ -135,7 +138,11 @@ class MainFrameView {
|
||||
panel(constraints: BorderLayout.CENTER) {
|
||||
borderLayout()
|
||||
label(" Enter search here:", constraints: BorderLayout.WEST) // TODO: fix this
|
||||
textField(id: "search-field", constraints: BorderLayout.CENTER, action : searchAction)
|
||||
|
||||
def searchFieldModel = new SearchFieldModel(settings, new File(application.context.get("muwire-home")))
|
||||
JComboBox myComboBox = new SearchField(searchFieldModel)
|
||||
myComboBox.setAction(searchAction)
|
||||
widget(id: "search-field", constraints: BorderLayout.CENTER, myComboBox)
|
||||
|
||||
}
|
||||
panel( constraints: BorderLayout.EAST) {
|
||||
@@ -484,6 +491,10 @@ class MainFrameView {
|
||||
}
|
||||
}})
|
||||
|
||||
// search field
|
||||
def searchField = builder.getVariable("search-field")
|
||||
|
||||
// downloads table
|
||||
def downloadsTable = builder.getVariable("downloads-table")
|
||||
def selectionModel = downloadsTable.getSelectionModel()
|
||||
selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
|
||||
|
Reference in New Issue
Block a user