List of usage examples for javax.swing.event DocumentListener DocumentListener
DocumentListener
From source file:com.mirth.connect.client.ui.components.rsta.MirthRSyntaxTextArea.java
public MirthRSyntaxTextArea(ContextType contextType, String styleKey, boolean autoCompleteEnabled) { super(new MirthRSyntaxDocument(styleKey)); this.contextType = contextType; setBackground(UIConstants.BACKGROUND_COLOR); setSyntaxEditingStyle(styleKey);/*from w ww . ja va 2 s .c o m*/ setCodeFoldingEnabled(true); setAntiAliasingEnabled(true); setWrapStyleWord(true); setAutoIndentEnabled(true); // Add a document listener so that the save button is enabled whenever changes are made. getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(DocumentEvent e) { onChange(); } @Override public void removeUpdate(DocumentEvent e) { onChange(); } @Override public void insertUpdate(DocumentEvent e) { onChange(); } private void onChange() { if (saveEnabled) { PlatformUI.MIRTH_FRAME.setSaveEnabled(true); } } }); addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (saveEnabled) { boolean isAccelerated = (((e.getModifiers() & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) > 0) || ((e.getModifiers() & InputEvent.CTRL_MASK) > 0)); if ((e.getKeyCode() == KeyEvent.VK_S) && isAccelerated) { PlatformUI.MIRTH_FRAME.doContextSensitiveSave(); } } } }); undoMenuItem = new CustomMenuItem(this, new UndoAction(), ActionInfo.UNDO); redoMenuItem = new CustomMenuItem(this, new RedoAction(), ActionInfo.REDO); cutMenuItem = new CustomMenuItem(this, new CutAction(this), ActionInfo.CUT); copyMenuItem = new CustomMenuItem(this, new CopyAction(this), ActionInfo.COPY); pasteMenuItem = new CustomMenuItem(this, new PasteAction(), ActionInfo.PASTE); deleteMenuItem = new CustomMenuItem(this, new DeleteAction(), ActionInfo.DELETE); selectAllMenuItem = new CustomMenuItem(this, new SelectAllAction(), ActionInfo.SELECT_ALL); findReplaceMenuItem = new CustomMenuItem(this, new FindReplaceAction(this), ActionInfo.FIND_REPLACE); findNextMenuItem = new CustomMenuItem(this, new FindNextAction(this), ActionInfo.FIND_NEXT); clearMarkedOccurrencesMenuItem = new CustomMenuItem(this, new ClearMarkedOccurrencesAction(this), ActionInfo.CLEAR_MARKED_OCCURRENCES); foldingMenu = new JMenu("Folding"); collapseFoldMenuItem = new CustomMenuItem(this, new CollapseFoldAction(), ActionInfo.FOLD_COLLAPSE); expandFoldMenuItem = new CustomMenuItem(this, new ExpandFoldAction(), ActionInfo.FOLD_EXPAND); collapseAllFoldsMenuItem = new CustomMenuItem(this, new CollapseAllFoldsAction(), ActionInfo.FOLD_COLLAPSE_ALL); collapseAllCommentFoldsMenuItem = new CustomMenuItem(this, new CollapseAllCommentFoldsAction(), ActionInfo.FOLD_COLLAPSE_ALL_COMMENTS); expandAllFoldsMenuItem = new CustomMenuItem(this, new ExpandAllFoldsAction(), ActionInfo.FOLD_EXPAND_ALL); displayMenu = new JMenu("Display"); showTabLinesMenuItem = new CustomJCheckBoxMenuItem(this, new ShowTabLinesAction(this), ActionInfo.DISPLAY_SHOW_TAB_LINES); showWhitespaceMenuItem = new CustomJCheckBoxMenuItem(this, new ShowWhitespaceAction(this), ActionInfo.DISPLAY_SHOW_WHITESPACE); showLineEndingsMenuItem = new CustomJCheckBoxMenuItem(this, new ShowLineEndingsAction(this), ActionInfo.DISPLAY_SHOW_LINE_ENDINGS); wrapLinesMenuItem = new CustomJCheckBoxMenuItem(this, new WrapLinesAction(this), ActionInfo.DISPLAY_WRAP_LINES); macroMenu = new JMenu("Macro"); beginMacroMenuItem = new CustomMenuItem(this, new BeginMacroAction(), ActionInfo.MACRO_BEGIN); endMacroMenuItem = new CustomMenuItem(this, new EndMacroAction(), ActionInfo.MACRO_END); playbackMacroMenuItem = new CustomMenuItem(this, new PlaybackMacroAction(), ActionInfo.MACRO_PLAYBACK); viewUserAPIMenuItem = new CustomMenuItem(this, new ViewUserAPIAction(this), ActionInfo.VIEW_USER_API); // Add actions that wont be in the popup menu getActionMap().put(ActionInfo.DELETE_REST_OF_LINE.getActionMapKey(), new DeleteRestOfLineAction()); getActionMap().put(ActionInfo.DELETE_LINE.getActionMapKey(), new DeleteLineAction()); getActionMap().put(ActionInfo.JOIN_LINE.getActionMapKey(), new JoinLineAction()); getActionMap().put(ActionInfo.GO_TO_MATCHING_BRACKET.getActionMapKey(), new GoToMatchingBracketAction()); getActionMap().put(ActionInfo.TOGGLE_COMMENT.getActionMapKey(), new ToggleCommentAction()); getActionMap().put(ActionInfo.DOCUMENT_START.getActionMapKey(), new DocumentStartAction(false)); getActionMap().put(ActionInfo.DOCUMENT_SELECT_START.getActionMapKey(), new DocumentStartAction(true)); getActionMap().put(ActionInfo.DOCUMENT_END.getActionMapKey(), new DocumentEndAction(false)); getActionMap().put(ActionInfo.DOCUMENT_SELECT_END.getActionMapKey(), new DocumentEndAction(true)); getActionMap().put(ActionInfo.LINE_START.getActionMapKey(), new LineStartAction(false)); getActionMap().put(ActionInfo.LINE_SELECT_START.getActionMapKey(), new LineStartAction(true)); getActionMap().put(ActionInfo.LINE_END.getActionMapKey(), new LineEndAction(false)); getActionMap().put(ActionInfo.LINE_SELECT_END.getActionMapKey(), new LineEndAction(true)); getActionMap().put(ActionInfo.MOVE_LEFT.getActionMapKey(), new MoveLeftAction(false)); getActionMap().put(ActionInfo.MOVE_LEFT_SELECT.getActionMapKey(), new MoveLeftAction(true)); getActionMap().put(ActionInfo.MOVE_LEFT_WORD.getActionMapKey(), new MoveLeftWordAction(false)); getActionMap().put(ActionInfo.MOVE_LEFT_WORD_SELECT.getActionMapKey(), new MoveLeftWordAction(true)); getActionMap().put(ActionInfo.MOVE_RIGHT.getActionMapKey(), new MoveRightAction(false)); getActionMap().put(ActionInfo.MOVE_RIGHT_SELECT.getActionMapKey(), new MoveRightAction(true)); getActionMap().put(ActionInfo.MOVE_RIGHT_WORD.getActionMapKey(), new MoveRightWordAction(false)); getActionMap().put(ActionInfo.MOVE_RIGHT_WORD_SELECT.getActionMapKey(), new MoveRightWordAction(true)); getActionMap().put(ActionInfo.MOVE_UP.getActionMapKey(), new MoveUpAction(false)); getActionMap().put(ActionInfo.MOVE_UP_SELECT.getActionMapKey(), new MoveUpAction(true)); getActionMap().put(ActionInfo.MOVE_UP_SCROLL.getActionMapKey(), new ScrollAction(true)); getActionMap().put(ActionInfo.MOVE_UP_LINE.getActionMapKey(), new MoveLineAction(true)); getActionMap().put(ActionInfo.MOVE_DOWN.getActionMapKey(), new MoveDownAction(false)); getActionMap().put(ActionInfo.MOVE_DOWN_SELECT.getActionMapKey(), new MoveDownAction(true)); getActionMap().put(ActionInfo.MOVE_DOWN_SCROLL.getActionMapKey(), new ScrollAction(false)); getActionMap().put(ActionInfo.MOVE_DOWN_LINE.getActionMapKey(), new MoveLineAction(false)); getActionMap().put(ActionInfo.PAGE_UP.getActionMapKey(), new PageUpAction(false)); getActionMap().put(ActionInfo.PAGE_UP_SELECT.getActionMapKey(), new PageUpAction(true)); getActionMap().put(ActionInfo.PAGE_LEFT_SELECT.getActionMapKey(), new HorizontalPageAction(this, true)); getActionMap().put(ActionInfo.PAGE_DOWN.getActionMapKey(), new PageDownAction(false)); getActionMap().put(ActionInfo.PAGE_DOWN_SELECT.getActionMapKey(), new PageDownAction(true)); getActionMap().put(ActionInfo.PAGE_RIGHT_SELECT.getActionMapKey(), new HorizontalPageAction(this, false)); getActionMap().put(ActionInfo.INSERT_LF_BREAK.getActionMapKey(), new InsertBreakAction("\n")); getActionMap().put(ActionInfo.INSERT_CR_BREAK.getActionMapKey(), new InsertBreakAction("\r")); List<Action> actionList = new ArrayList<Action>(); for (Object key : getActionMap().allKeys()) { actionList.add(getActionMap().get(key)); } actions = actionList.toArray(new Action[actionList.size()]); if (autoCompleteEnabled) { LanguageSupportFactory.get().register(this); // Remove the default auto-completion trigger since we handle that ourselves getInputMap().remove(AutoCompletion.getDefaultTriggerKey()); } }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java
private JPanel getOverlayPanel() { final JPanel overlayPanel = new JPanel(); overlayPanel.setOpaque(false);/*from w ww . j a va 2 s. com*/ overlayPanel.setLayout(new GridBagLayout()); filterTextField.addKeyListener(new KeyListener() { @Override public void keyTyped(final KeyEvent e) { } @Override public void keyReleased(final KeyEvent e) { } @Override public void keyPressed(final KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { hideFilter(); } } }); filterTextField.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(final DocumentEvent e) { textChanged(); } @Override public void insertUpdate(final DocumentEvent e) { textChanged(); } @Override public void changedUpdate(final DocumentEvent e) { } private void textChanged() { serverListModel.filter(filterTextField.getText()); } }); final SearchField searchField = new SearchField(filterTextField); final ImageIcon closeIcon = Utils.icon("cross16.png"); final JButton closeButton = new JButton(closeIcon); closeButton.setBounds(10, 10, closeIcon.getIconWidth(), closeIcon.getIconHeight()); closeButton.setMargin(new Insets(0, 0, 0, 0)); closeButton.setOpaque(false); closeButton.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { hideFilter(); } }); searchPanel.add(searchField); searchPanel.add(closeButton); // searchPanel.setBorder(BorderFactory // .createBevelBorder(BevelBorder.RAISED)); searchPanel.setBorder(BorderFactory.createEtchedBorder()); searchPanel.setVisible(false); searchPanel.setAlignmentX(RIGHT_ALIGNMENT); final GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.LAST_LINE_END; c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 0; c.weightx = 1.0; c.weighty = 1.0; c.insets = new Insets(3, 3, 3, 3); overlayPanel.add(searchPanel, c); return overlayPanel; }
From source file:jpad.MainEditor.java
void textChanged() { mainTextArea.getDocument().addDocumentListener(new DocumentListener() { @Override//from ww w. j a va 2s . co m public void removeUpdate(DocumentEvent e) { if (!isOpen) { updateDocModded(); hasChanges = true; } } @Override public void insertUpdate(DocumentEvent e) { if (!isOpen) { updateDocModded(); hasChanges = true; } } @Override public void changedUpdate(DocumentEvent e) { if (!isOpen) { updateDocModded(); hasChanges = true; } } }); }
From source file:net.sf.taverna.t2.activities.spreadsheet.views.SpreadsheetImportConfigView.java
@Override protected void initialise() { super.initialise(); newConfiguration = getJson().deepCopy(); // title//from ww w . ja va 2 s . co m titlePanel = new JPanel(new BorderLayout()); titlePanel.setBackground(Color.WHITE); addDivider(titlePanel, SwingConstants.BOTTOM, true); titleLabel = new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.panelTitle")); titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 13.5f)); titleIcon = new JLabel(""); titleMessage = new DialogTextArea(DEFAULT_MESSAGE); titleMessage.setMargin(new Insets(5, 10, 10, 10)); // titleMessage.setMinimumSize(new Dimension(0, 30)); titleMessage.setFont(titleMessage.getFont().deriveFont(11f)); titleMessage.setEditable(false); titleMessage.setFocusable(false); // titleMessage.setFont(titleLabel.getFont().deriveFont(Font.PLAIN, // 12f)); // column range columnLabel = new JLabel( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.columnSectionLabel")); JsonNode columnRange = newConfiguration.get("columnRange"); columnFromValue = new JTextField(new UpperCaseDocument(), SpreadsheetUtils.getColumnLabel(columnRange.get("start").intValue()), 4); columnFromValue.setMinimumSize(columnFromValue.getPreferredSize()); columnToValue = new JTextField(new UpperCaseDocument(), SpreadsheetUtils.getColumnLabel(columnRange.get("end").intValue()), 4); columnToValue.setMinimumSize(columnToValue.getPreferredSize()); columnFromValue.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { } public void insertUpdate(DocumentEvent e) { checkValue(columnFromValue.getText()); } public void removeUpdate(DocumentEvent e) { checkValue(columnFromValue.getText()); } private void checkValue(String text) { if (text.trim().equals("")) { addErrorMessage(EMPTY_FROM_COLUMN_ERROR_MESSAGE); } else if (text.trim().matches("[A-Za-z]+")) { String fromColumn = columnFromValue.getText().toUpperCase(); String toColumn = columnToValue.getText().toUpperCase(); int fromColumnIndex = SpreadsheetUtils.getColumnIndex(fromColumn); int toColumnIndex = SpreadsheetUtils.getColumnIndex(toColumn); if (checkColumnRange(fromColumnIndex, toColumnIndex)) { columnMappingTableModel.setFromColumn(fromColumnIndex); columnMappingTableModel.setToColumn(toColumnIndex); newConfiguration.set("columnRange", newConfiguration.objectNode() .put("start", fromColumnIndex).put("end", toColumnIndex)); validatePortNames(); } removeErrorMessage(FROM_COLUMN_ERROR_MESSAGE); removeErrorMessage(EMPTY_FROM_COLUMN_ERROR_MESSAGE); } else { addErrorMessage(FROM_COLUMN_ERROR_MESSAGE); removeErrorMessage(EMPTY_FROM_COLUMN_ERROR_MESSAGE); } } }); columnToValue.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { } public void insertUpdate(DocumentEvent e) { checkValue(columnToValue.getText()); } public void removeUpdate(DocumentEvent e) { checkValue(columnToValue.getText()); } private void checkValue(String text) { if (text.trim().equals("")) { addErrorMessage(EMPTY_TO_COLUMN_ERROR_MESSAGE); } else if (text.trim().matches("[A-Za-z]+")) { String fromColumn = columnFromValue.getText().toUpperCase(); String toColumn = columnToValue.getText().toUpperCase(); int fromColumnIndex = SpreadsheetUtils.getColumnIndex(fromColumn); int toColumnIndex = SpreadsheetUtils.getColumnIndex(toColumn); if (checkColumnRange(fromColumnIndex, toColumnIndex)) { columnMappingTableModel.setFromColumn(fromColumnIndex); columnMappingTableModel.setToColumn(toColumnIndex); newConfiguration.set("columnRange", newConfiguration.objectNode() .put("start", fromColumnIndex).put("end", toColumnIndex)); validatePortNames(); } removeErrorMessage(TO_COLUMN_ERROR_MESSAGE); removeErrorMessage(EMPTY_TO_COLUMN_ERROR_MESSAGE); } else { addErrorMessage(TO_COLUMN_ERROR_MESSAGE); removeErrorMessage(EMPTY_TO_COLUMN_ERROR_MESSAGE); } } }); // row range rowLabel = new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.rowSectionLabel")); addDivider(rowLabel, SwingConstants.TOP, false); rowSelectAllOption = new JCheckBox( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.selectAllRowsOption")); rowExcludeFirstOption = new JCheckBox( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.excludeHeaderRowOption")); rowIgnoreBlankRows = new JCheckBox( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.ignoreBlankRowsOption")); rowSelectAllOption.setFocusable(false); rowExcludeFirstOption.setFocusable(false); JsonNode rowRange = newConfiguration.get("rowRange"); rowFromValue = new JTextField(new NumericDocument(), String.valueOf(rowRange.get("start").intValue() + 1), 4); if (rowRange.get("end").intValue() == -1) { rowToValue = new JTextField(new NumericDocument(), "", 4); } else { rowToValue = new JTextField(new NumericDocument(), String.valueOf(rowRange.get("end").intValue() + 1), 4); } rowFromValue.setMinimumSize(rowFromValue.getPreferredSize()); rowToValue.setMinimumSize(rowToValue.getPreferredSize()); if (newConfiguration.get("allRows").booleanValue()) { rowSelectAllOption.setSelected(true); rowFromValue.setEditable(false); rowFromValue.setEnabled(false); rowToValue.setEditable(false); rowToValue.setEnabled(false); } else { rowExcludeFirstOption.setEnabled(false); } rowExcludeFirstOption.setSelected(newConfiguration.get("excludeFirstRow").booleanValue()); rowIgnoreBlankRows.setSelected(newConfiguration.get("ignoreBlankRows").booleanValue()); rowFromValue.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { } public void insertUpdate(DocumentEvent e) { checkValue(rowFromValue.getText()); } public void removeUpdate(DocumentEvent e) { checkValue(rowFromValue.getText()); } private void checkValue(String text) { if (text.trim().equals("")) { addErrorMessage(EMPTY_FROM_ROW_ERROR_MESSAGE); } else if (text.trim().matches("[1-9][0-9]*")) { checkRowRange(rowFromValue.getText(), rowToValue.getText()); int fromRow = Integer.parseInt(rowFromValue.getText()); ((ObjectNode) newConfiguration.get("rowRange")).put("start", fromRow - 1); removeErrorMessage(FROM_ROW_ERROR_MESSAGE); removeErrorMessage(EMPTY_FROM_ROW_ERROR_MESSAGE); } else { addErrorMessage(FROM_ROW_ERROR_MESSAGE); removeErrorMessage(EMPTY_FROM_ROW_ERROR_MESSAGE); } } }); rowToValue.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { } public void insertUpdate(DocumentEvent e) { checkValue(rowToValue.getText()); } public void removeUpdate(DocumentEvent e) { checkValue(rowToValue.getText()); } private void checkValue(String text) { if (text.trim().equals("")) { ((ObjectNode) newConfiguration.get("rowRange")).put("end", -1); removeErrorMessage(TO_ROW_ERROR_MESSAGE); removeErrorMessage(INCONSISTENT_ROW_MESSAGE); } else if (text.trim().matches("[0-9]+")) { checkRowRange(rowFromValue.getText(), rowToValue.getText()); int toRow = Integer.parseInt(rowToValue.getText()); ((ObjectNode) newConfiguration.get("rowRange")).put("end", toRow - 1); removeErrorMessage(TO_ROW_ERROR_MESSAGE); } else { addErrorMessage(TO_ROW_ERROR_MESSAGE); } } }); rowSelectAllOption.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { newConfiguration.put("allRows", true); rowExcludeFirstOption.setEnabled(true); if (rowExcludeFirstOption.isSelected()) { rowFromValue.setText("2"); } else { rowFromValue.setText("1"); } rowToValue.setText(""); rowFromValue.setEditable(false); rowFromValue.setEnabled(false); rowToValue.setEditable(false); rowToValue.setEnabled(false); } else { newConfiguration.put("allRows", false); rowExcludeFirstOption.setEnabled(false); rowFromValue.setEditable(true); rowFromValue.setEnabled(true); rowToValue.setEditable(true); rowToValue.setEnabled(true); } } }); rowExcludeFirstOption.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { newConfiguration.put("excludeFirstRow", true); rowFromValue.setText("2"); ((ObjectNode) newConfiguration.get("rowRange")).put("start", 1); } else { newConfiguration.put("excludeFirstRow", false); rowFromValue.setText("1"); ((ObjectNode) newConfiguration.get("rowRange")).put("start", 0); } } }); rowIgnoreBlankRows.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { newConfiguration.put("ignoreBlankRows", e.getStateChange() == ItemEvent.SELECTED); } }); // empty cells emptyCellLabel = new JLabel( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.emptyCellSectionLabel")); addDivider(emptyCellLabel, SwingConstants.TOP, false); emptyCellButtonGroup = new ButtonGroup(); emptyCellEmptyStringOption = new JRadioButton( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.emptyStringOption")); emptyCellUserDefinedOption = new JRadioButton( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.userDefinedOption")); emptyCellErrorValueOption = new JRadioButton( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.generateErrorOption")); emptyCellEmptyStringOption.setFocusable(false); emptyCellUserDefinedOption.setFocusable(false); emptyCellErrorValueOption.setFocusable(false); emptyCellUserDefinedValue = new JTextField(newConfiguration.get("emptyCellValue").textValue()); emptyCellButtonGroup.add(emptyCellEmptyStringOption); emptyCellButtonGroup.add(emptyCellUserDefinedOption); emptyCellButtonGroup.add(emptyCellErrorValueOption); if (newConfiguration.get("emptyCellPolicy").textValue().equals("GENERATE_ERROR")) { emptyCellErrorValueOption.setSelected(true); emptyCellUserDefinedValue.setEnabled(false); emptyCellUserDefinedValue.setEditable(false); } else if (newConfiguration.get("emptyCellPolicy").textValue().equals("EMPTY_STRING")) { emptyCellEmptyStringOption.setSelected(true); emptyCellUserDefinedValue.setEnabled(false); emptyCellUserDefinedValue.setEditable(false); } else { emptyCellUserDefinedOption.setSelected(true); emptyCellUserDefinedValue.setText(newConfiguration.get("emptyCellValue").textValue()); emptyCellUserDefinedValue.setEnabled(true); emptyCellUserDefinedValue.setEditable(true); } emptyCellEmptyStringOption.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { newConfiguration.put("emptyCellPolicy", "EMPTY_STRING"); emptyCellUserDefinedValue.setEnabled(false); emptyCellUserDefinedValue.setEditable(false); } }); emptyCellUserDefinedOption.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { newConfiguration.put("emptyCellPolicy", "USER_DEFINED"); emptyCellUserDefinedValue.setEnabled(true); emptyCellUserDefinedValue.setEditable(true); emptyCellUserDefinedValue.requestFocusInWindow(); } }); emptyCellErrorValueOption.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { newConfiguration.put("emptyCellPolicy", "GENERATE_ERROR"); emptyCellUserDefinedValue.setEnabled(false); emptyCellUserDefinedValue.setEditable(false); } }); emptyCellUserDefinedValue.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { newConfiguration.put("emptyCellValue", emptyCellUserDefinedValue.getText()); } public void insertUpdate(DocumentEvent e) { newConfiguration.put("emptyCellValue", emptyCellUserDefinedValue.getText()); } public void removeUpdate(DocumentEvent e) { newConfiguration.put("emptyCellValue", emptyCellUserDefinedValue.getText()); } }); // column mappings columnMappingLabel = new JLabel( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.columnMappingSectionLabel")); addDivider(columnMappingLabel, SwingConstants.TOP, false); Map<String, String> columnToPortMapping = new HashMap<>(); if (newConfiguration.has("columnNames")) { for (JsonNode columnName : newConfiguration.get("columnNames")) { columnToPortMapping.put(columnName.get("column").textValue(), columnName.get("port").textValue()); } } columnMappingTableModel = new SpreadsheetImportConfigTableModel(columnFromValue.getText(), columnToValue.getText(), columnToPortMapping); columnMappingTable = new JTable(); columnMappingTable.setRowSelectionAllowed(false); columnMappingTable.getTableHeader().setReorderingAllowed(false); columnMappingTable.setGridColor(Color.LIGHT_GRAY); // columnMappingTable.setFocusable(false); columnMappingTable.setColumnModel(new DefaultTableColumnModel() { public TableColumn getColumn(int columnIndex) { TableColumn column = super.getColumn(columnIndex); if (columnIndex == 0) { column.setMaxWidth(100); } return column; } }); TableCellEditor defaultEditor = columnMappingTable.getDefaultEditor(String.class); if (defaultEditor instanceof DefaultCellEditor) { DefaultCellEditor defaultCellEditor = (DefaultCellEditor) defaultEditor; defaultCellEditor.setClickCountToStart(1); Component editorComponent = defaultCellEditor.getComponent(); if (editorComponent instanceof JTextComponent) { final JTextComponent textField = (JTextComponent) editorComponent; textField.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { updateModel(textField.getText()); } public void insertUpdate(DocumentEvent e) { updateModel(textField.getText()); } public void removeUpdate(DocumentEvent e) { updateModel(textField.getText()); } private void updateModel(String text) { int row = columnMappingTable.getEditingRow(); int column = columnMappingTable.getEditingColumn(); columnMappingTableModel.setValueAt(text, row, column); ArrayNode columnNames = newConfiguration.arrayNode(); Map<String, String> columnToPortMapping = columnMappingTableModel.getColumnToPortMapping(); for (Entry<String, String> entry : columnToPortMapping.entrySet()) { columnNames.add(newConfiguration.objectNode().put("column", entry.getKey()).put("port", entry.getValue())); } newConfiguration.put("columnNames", columnNames); validatePortNames(); } }); } } columnMappingTable.setModel(columnMappingTableModel); // output format outputFormatLabel = new JLabel( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.outputFormatSectionLabel")); outputFormatMultiplePort = new JRadioButton( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.multiplePortOption")); outputFormatSinglePort = new JRadioButton( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.singlePortOption")); outputFormatMultiplePort.setFocusable(false); outputFormatSinglePort.setFocusable(false); outputFormatDelimiterLabel = new JLabel( SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.userDefinedCsvDelimiter")); outputFormatDelimiter = new JTextField(newConfiguration.get("csvDelimiter").textValue(), 5); outputFormatButtonGroup = new ButtonGroup(); outputFormatButtonGroup.add(outputFormatMultiplePort); outputFormatButtonGroup.add(outputFormatSinglePort); if (newConfiguration.get("outputFormat").textValue().equals("PORT_PER_COLUMN")) { outputFormatMultiplePort.setSelected(true); outputFormatDelimiterLabel.setEnabled(false); outputFormatDelimiter.setEnabled(false); } else { outputFormatSinglePort.setSelected(true); columnMappingLabel.setEnabled(false); enableTable(columnMappingTable, false); } outputFormatMultiplePort.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { outputFormatDelimiterLabel.setEnabled(false); outputFormatDelimiter.setEnabled(false); columnMappingLabel.setEnabled(true); enableTable(columnMappingTable, true); newConfiguration.put("outputFormat", "PORT_PER_COLUMN"); } }); outputFormatSinglePort.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { outputFormatDelimiterLabel.setEnabled(true); outputFormatDelimiter.setEnabled(true); columnMappingLabel.setEnabled(false); enableTable(columnMappingTable, false); newConfiguration.put("outputFormat", "SINGLE_PORT"); } }); outputFormatDelimiter.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { handleUpdate(); } public void insertUpdate(DocumentEvent e) { handleUpdate(); } public void removeUpdate(DocumentEvent e) { handleUpdate(); } private void handleUpdate() { String text = null; try { text = StringEscapeUtils.unescapeJava(outputFormatDelimiter.getText()); } catch (RuntimeException re) { } if (text == null || text.length() == 0) { newConfiguration.put("csvDelimiter", ","); } else { newConfiguration.put("csvDelimiter", text.substring(0, 1)); } } }); // buttons nextButton = new JButton(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.nextButton")); nextButton.setFocusable(false); nextButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { backButton.setVisible(true); nextButton.setVisible(false); cardLayout.last(contentPanel); } }); backButton = new JButton(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.backButton")); backButton.setFocusable(false); backButton.setVisible(false); backButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { nextButton.setVisible(true); backButton.setVisible(false); cardLayout.first(contentPanel); } }); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); addDivider(buttonPanel, SwingConstants.TOP, true); removeAll(); layoutPanel(); }
From source file:edu.mit.fss.examples.gui.ExecutionControlPanel.java
/** * Instantiates a new execution control panel. *//*from w w w.j a v a 2 s . c o m*/ public ExecutionControlPanel() { initializeAction.putValue(Action.SHORT_DESCRIPTION, "Initialize the execution."); initializeAction.setEnabled(false); runAction.putValue(Action.SHORT_DESCRIPTION, "Run the execution."); runAction.setEnabled(false); stopAction.putValue(Action.SHORT_DESCRIPTION, "Stop the execution."); stopAction.setEnabled(false); terminateAction.putValue(Action.SHORT_DESCRIPTION, "Terminate the execution."); terminateAction.setEnabled(false); setLayout(new BorderLayout()); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(new JButton(initializeAction)); buttonPanel.add(new JButton(runAction)); buttonPanel.add(new JButton(stopAction)); buttonPanel.add(new JButton(terminateAction)); timeStepField = new JFormattedTextField(NumberFormat.getNumberInstance()); timeStepField.getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(DocumentEvent e) { checkUpdate(); } private void checkUpdate() { long unitConversion = getTimeStepUnits(); long timeStep = FastMath.round(unitConversion * ((Number) timeStepField.getValue()).doubleValue()); setTimeStepAction.setEnabled(timeStep != federate.getTimeStep()); } @Override public void insertUpdate(DocumentEvent e) { checkUpdate(); } @Override public void removeUpdate(DocumentEvent e) { checkUpdate(); } }); timeStepField.setColumns(4); buttonPanel.add(new JLabel("Time Step: ")); buttonPanel.add(timeStepField); timeStepUnits.setSelectedItem(TimeUnit.SECONDS); buttonPanel.add(timeStepUnits); timeStepUnits.addActionListener(new ActionListener() { private long lastUnitConversion = getTimeStepUnits(); @Override public void actionPerformed(ActionEvent e) { long unitConversion = getTimeStepUnits(); // update field value using new units timeStepField.setValue(((Double) timeStepField.getValue()) * lastUnitConversion / unitConversion); // update stored value lastUnitConversion = unitConversion; } }); buttonPanel.add(new JButton(setTimeStepAction)); buttonPanel.add(new JLabel("Min. Step Duration")); stepDurationField = new JFormattedTextField(NumberFormat.getNumberInstance()); stepDurationField.setColumns(4); stepDurationField.getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(DocumentEvent e) { checkUpdate(); } private void checkUpdate() { long unitConversion = getStepDurationUnits(); long minStepDuration = FastMath .round(unitConversion * ((Number) stepDurationField.getValue()).doubleValue()); setMinStepDurationAction.setEnabled(minStepDuration != federate.getMinimumStepDuration()); } @Override public void insertUpdate(DocumentEvent e) { checkUpdate(); } @Override public void removeUpdate(DocumentEvent e) { checkUpdate(); } }); buttonPanel.add(stepDurationField); stepDurationUnits.setSelectedItem(TimeUnit.MILLISECONDS); buttonPanel.add(stepDurationUnits); stepDurationUnits.addActionListener(new ActionListener() { private long lastUnitConversion = getStepDurationUnits(); @Override public void actionPerformed(ActionEvent e) { long unitConversion = getStepDurationUnits(); // update field value using new units stepDurationField .setValue(((Double) stepDurationField.getValue()) * lastUnitConversion / unitConversion); // update stored value lastUnitConversion = unitConversion; } }); buttonPanel.add(new JButton(setMinStepDurationAction)); add(buttonPanel, BorderLayout.CENTER); }
From source file:com.u2apple.rt.ui.RecognitionToolJFrame.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//from ww w . j a v a 2 s .co m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); productIdLabel = new javax.swing.JLabel(); productIdTextField = new javax.swing.JTextField(); brandLabel = new javax.swing.JLabel(); brandTextField = new javax.swing.JTextField(); productLabel = new javax.swing.JLabel(); productTextField = new javax.swing.JTextField(); aliasLabel = new javax.swing.JLabel(); aliasTextField = new javax.swing.JTextField(); typeComboBox = new javax.swing.JComboBox(); jLabel2 = new javax.swing.JLabel(); productIdExistCheckBox = new javax.swing.JCheckBox(); jPanel12 = new javax.swing.JPanel(); jScrollPane4 = new javax.swing.JScrollPane(); resultTextArea = new javax.swing.JTextArea(); jPanel13 = new javax.swing.JPanel(); connectButton = new javax.swing.JButton(); deviceButton = new javax.swing.JButton(); modelButton = new javax.swing.JButton(); testCaseButton = new javax.swing.JButton(); knockOffButton = new javax.swing.JButton(); knockOffCheckBox = new javax.swing.JCheckBox(); productIdButton = new javax.swing.JButton(); updateModelButton = new javax.swing.JButton(); conditionCheckBox = new javax.swing.JCheckBox(); detailButton = new javax.swing.JButton(); queryLimitSpinner = new javax.swing.JSpinner(); allCheckBox = new javax.swing.JCheckBox(); googleButton = new javax.swing.JButton(); baiduButton = new javax.swing.JButton(); sortButton = new javax.swing.JButton(); updateTestCaseButton = new javax.swing.JButton(); deviceCountButton = new javax.swing.JButton(); addButton = new javax.swing.JButton(); updateButton = new javax.swing.JButton(); jPanel14 = new javax.swing.JPanel(); resolutionLabel = new javax.swing.JLabel(); resolutionComboBox = new javax.swing.JComboBox(); partitionLabel = new javax.swing.JLabel(); partitionTextField = new javax.swing.JTextField(); jPanel6 = new javax.swing.JPanel(); modelLabel = new javax.swing.JLabel(); modelTextField = new javax.swing.JTextField(); vidLabel = new javax.swing.JLabel(); vidTextField = new javax.swing.JTextField(); existCheckBox = new javax.swing.JCheckBox(); existInVidCheckBox = new javax.swing.JCheckBox(); conditionComboBox = new javax.swing.JComboBox(); conditionTextField = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); vid2TextField = new javax.swing.JTextField(); condition2ComboBox = new javax.swing.JComboBox(); condition2TextField = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); deviceTable = new javax.swing.JTable(); queryPanel = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); daysSpinner = new javax.swing.JSpinner(); deviceRankingButton = new javax.swing.JButton(); detailCheckBox = new javax.swing.JCheckBox(); errorRecognitionButton = new javax.swing.JButton(); queryTextField = new javax.swing.JTextField(); queryButton = new javax.swing.JButton(); whiteListButton = new javax.swing.JButton(); rootSpritButton = new javax.swing.JButton(); filterButton = new javax.swing.JButton(); matchButton = new javax.swing.JButton(); existenceFilterButton = new javax.swing.JButton(); excludeFilterButton = new javax.swing.JButton(); queryFilterButton = new javax.swing.JButton(); removeDeviceButton = new javax.swing.JButton(); othersDevicesButton = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); deviceDetailTable = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Recognition Tool"); jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Device")); productIdLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N productIdLabel.setText("Product ID:"); productIdTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N productIdTextField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { productIdTextFieldActionPerformed(evt); } }); productIdTextField.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { productIdTextFieldPropertyChange(evt); } }); productIdTextField.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { } public void removeUpdate(DocumentEvent e) { String productId = productIdTextField.getText(); productIdExistCheckBox.setSelected(RecognitionTool.isProductIdExist(productId)); } public void insertUpdate(DocumentEvent e) { String productId = productIdTextField.getText(); productIdExistCheckBox.setSelected(RecognitionTool.isProductIdExist(productId)); } }); brandLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N brandLabel.setText("Brand:"); brandTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N productLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N productLabel.setText("Product:"); productTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N aliasLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N aliasLabel.setText("Alias:"); aliasTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N typeComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N typeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Phone&Pad", "Box", "Watch" })); jLabel2.setFont(new java.awt.Font("", 0, 12)); // NOI18N jLabel2.setText("Type:"); productIdExistCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N productIdExistCheckBox.setText("Product ID"); productIdExistCheckBox.setEnabled(false); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(productIdLabel).addComponent(brandLabel).addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(brandTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE) .addComponent(productIdTextField)).addGap(37, 37, 37) .addGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addComponent(productLabel) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(productTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(44, 44, 44).addComponent(aliasLabel) .addGap(18, 18, 18).addComponent(aliasTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 208, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(productIdExistCheckBox))) .addComponent(typeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(productIdLabel) .addComponent(productIdTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(productIdExistCheckBox)).addGap(9, 9, 9) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(productLabel) .addComponent(productTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(brandLabel) .addComponent(brandTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(aliasLabel).addComponent(aliasTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2).addComponent(typeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())); jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder("Result")); resultTextArea.setColumns(20); resultTextArea.setFont(new java.awt.Font("", 0, 13)); // NOI18N resultTextArea.setRows(5); jScrollPane4.setViewportView(resultTextArea); javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12); jPanel12.setLayout(jPanel12Layout); jPanel12Layout .setHorizontalGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout.createSequentialGroup() .addContainerGap().addComponent(jScrollPane4).addContainerGap())); jPanel12Layout .setVerticalGroup( jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout .createSequentialGroup().addContainerGap().addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE) .addContainerGap())); jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder("Action")); connectButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N connectButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/calendar.png"))); // NOI18N connectButton.setToolTipText("Get the latest device information."); connectButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { connectButtonActionPerformed(evt); } }); deviceButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N deviceButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/device.png"))); // NOI18N deviceButton.setToolTipText("Add device"); deviceButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deviceButtonActionPerformed(evt); } }); modelButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N modelButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/add.png"))); // NOI18N modelButton.setToolTipText("Add model to system mode and recovery mode"); modelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { modelButtonActionPerformed(evt); } }); testCaseButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N testCaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/test.png"))); // NOI18N testCaseButton.setToolTipText("Add test case"); testCaseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { testCaseButtonActionPerformed(evt); } }); knockOffButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N knockOffButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/knockoff.png"))); // NOI18N knockOffButton.setToolTipText("Generate Knock-Off configuration"); knockOffButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { knockOffButtonActionPerformed(evt); } }); knockOffCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N knockOffCheckBox.setText("Knock-Off"); productIdButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N productIdButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/robot.png"))); // NOI18N productIdButton.setToolTipText("Fullfill device information"); productIdButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { productIdButtonActionPerformed(evt); } }); updateModelButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N updateModelButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/fix.png"))); // NOI18N updateModelButton.setToolTipText("Add model to current vid"); updateModelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateModelButtonActionPerformed(evt); } }); conditionCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N conditionCheckBox.setText("Condition"); detailButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N detailButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/info.png"))); // NOI18N detailButton.setToolTipText("Device detail"); detailButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { detailButtonActionPerformed(evt); } }); queryLimitSpinner.setFont(new java.awt.Font("", 0, 12)); // NOI18N queryLimitSpinner.setModel(new javax.swing.SpinnerNumberModel(10, 1, 100, 10)); allCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N allCheckBox.setText("All"); googleButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N googleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/google.png"))); // NOI18N googleButton.setToolTipText("Google"); googleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { googleButtonActionPerformed(evt); } }); baiduButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N baiduButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/baidu.png"))); // NOI18N baiduButton.setToolTipText("Baidu"); baiduButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { baiduButtonActionPerformed(evt); } }); sortButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N sortButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/sort.png"))); // NOI18N sortButton.setToolTipText("Sort models under a vid"); sortButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sortButtonActionPerformed(evt); } }); updateTestCaseButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N updateTestCaseButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/updateTestCase.png"))); // NOI18N updateTestCaseButton.setToolTipText("Update test case"); updateTestCaseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateTestCaseButtonActionPerformed(evt); } }); deviceCountButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N deviceCountButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/calculator.png"))); // NOI18N deviceCountButton.setToolTipText("Device Count"); deviceCountButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deviceCountButtonActionPerformed(evt); } }); addButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/new.png"))); // NOI18N addButton.setToolTipText("Add new device and model"); addButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addButtonActionPerformed(evt); } }); updateButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/update.png"))); // NOI18N updateButton.setToolTipText("Update"); updateButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateButtonActionPerformed(evt); } }); javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13); jPanel13.setLayout(jPanel13Layout); jPanel13Layout .setHorizontalGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(productIdButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(deviceButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(knockOffButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(77, 77, 77) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(testCaseButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(modelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(detailButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(76, 76, 76) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(updateTestCaseButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(updateModelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(queryLimitSpinner)) .addGap(61, 61, 61) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(conditionCheckBox).addComponent(knockOffCheckBox, javax.swing.GroupLayout.Alignment.TRAILING)) .addComponent(allCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(20, 20, 20) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(sortButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(connectButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(addButton, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(updateButton) .addGroup(jPanel13Layout.createSequentialGroup() .addComponent(deviceCountButton).addGap(47, 47, 47) .addComponent(googleButton).addGap(35, 35, 35) .addComponent(baiduButton))) .addGap(69, 69, 69))); jPanel13Layout.setVerticalGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addGap(28, 28, 28).addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(detailButton).addComponent(connectButton) .addComponent(queryLimitSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(allCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(productIdButton, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(deviceCountButton).addComponent(googleButton)) .addComponent(baiduButton)).addGap(18, 18, 18) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(deviceButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(modelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(updateModelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(addButton).addComponent(conditionCheckBox)).addGap(18, 18, 18) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(testCaseButton).addComponent(knockOffButton) .addComponent(knockOffCheckBox)) .addComponent(updateTestCaseButton).addComponent(sortButton))) .addComponent(updateButton)) .addGap(0, 0, Short.MAX_VALUE))); jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder("Knock-Off")); resolutionLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N resolutionLabel.setText("Resolution:"); resolutionComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N resolutionComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "320x480", "480x800", "480x854", "540x960", "720x1184", "720x1280", "800x1280", "1080x1776", "1080x1920", "1440x2392" })); resolutionComboBox.setSelectedIndex(5); partitionLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N partitionLabel.setText("Partition:"); partitionTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14); jPanel14.setLayout(jPanel14Layout); jPanel14Layout.setHorizontalGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(resolutionLabel).addComponent(partitionLabel)) .addGap(18, 18, 18) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup() .addComponent(resolutionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addComponent(partitionTextField)) .addContainerGap())); jPanel14Layout.setVerticalGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup() .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(resolutionLabel).addComponent(resolutionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(partitionLabel).addComponent(partitionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))); jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Model")); modelLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N modelLabel.setText("Model:"); modelTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N modelTextField.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { checkModelExistence(); } public void removeUpdate(DocumentEvent e) { checkModelExistence(); } public void insertUpdate(DocumentEvent e) { checkModelExistence(); } }); vidLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N vidLabel.setText("VID:"); vidTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N vidTextField.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { checkModelExistence(); } public void removeUpdate(DocumentEvent e) { checkModelExistence(); } public void insertUpdate(DocumentEvent e) { checkModelExistence(); } }); existCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N existCheckBox.setText("Global"); existCheckBox.setToolTipText("Model exist?"); existCheckBox.setEnabled(false); existCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { existCheckBoxActionPerformed(evt); } }); existInVidCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N existInVidCheckBox.setText("VID"); existInVidCheckBox.setEnabled(false); existInVidCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { existInVidCheckBoxActionPerformed(evt); } }); conditionComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N conditionComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Board", "Brand", "Cpu", "Device", "Hardware", "Manufacturer", "Adb_Device", "Display_ID" })); conditionComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { conditionComboBoxActionPerformed(evt); } }); conditionTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N conditionTextField.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { conditionTextFieldFocusGained(evt); } }); jLabel3.setFont(new java.awt.Font("", 0, 12)); // NOI18N jLabel3.setText("VID2:"); vid2TextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N condition2ComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N condition2ComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Board", "Brand", "Cpu", "Device", "Hardware", "Manufacturer", "Adb_Device", "Display_ID" })); condition2ComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { condition2ComboBoxActionPerformed(evt); } }); condition2TextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap().addComponent(vidLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(vidTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(vid2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(modelLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(modelTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(existCheckBox).addComponent(existInVidCheckBox)) .addGap(18, 18, 18) .addComponent(conditionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(conditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(condition2ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(condition2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addComponent(existCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(existInVidCheckBox)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() .addContainerGap(18, Short.MAX_VALUE) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(vidLabel) .addComponent(vidTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(modelLabel) .addComponent(modelTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3).addComponent(vid2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(conditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(conditionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(condition2ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(condition2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap())); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap(19, Short.MAX_VALUE) .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); deviceTable.setFont(new java.awt.Font("", 0, 12)); // NOI18N deviceTable.setModel(new DeviceTableModel(new ArrayList<AndroidDeviceRanking>())); initRowSelectionEvent(); jScrollPane1.setViewportView(deviceTable); jLabel1.setFont(new java.awt.Font("", 0, 12)); // NOI18N jLabel1.setText("Days:"); daysSpinner.setFont(new java.awt.Font("", 0, 12)); // NOI18N daysSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10, 1)); deviceRankingButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N deviceRankingButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/trend.png"))); // NOI18N deviceRankingButton.setToolTipText("Unrecognized devices trend"); deviceRankingButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deviceRankingButtonActionPerformed(evt); } }); detailCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N detailCheckBox.setText("Detail"); detailCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { detailCheckBoxActionPerformed(evt); } }); errorRecognitionButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N errorRecognitionButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/error.png"))); // NOI18N errorRecognitionButton.setToolTipText("Query incorrect recognized devices"); errorRecognitionButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { errorRecognitionButtonActionPerformed(evt); } }); queryTextField.setFont(new java.awt.Font("", 0, 14)); // NOI18N queryTextField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { queryTextFieldActionPerformed(evt); } }); queryButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N queryButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/search.png"))); // NOI18N queryButton.setToolTipText("Query by model"); queryButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { queryButtonActionPerformed(evt); } }); whiteListButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N whiteListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/list.png"))); // NOI18N whiteListButton.setToolTipText("White List"); whiteListButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { whiteListButtonActionPerformed(evt); } }); rootSpritButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/root.png"))); // NOI18N rootSpritButton.setToolTipText("Mobile root spirit device ranking list"); rootSpritButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rootSpritButtonActionPerformed(evt); } }); filterButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/filter.png"))); // NOI18N filterButton.setToolTipText("Pattern Filter"); filterButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { filterButtonActionPerformed(evt); } }); matchButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/match.png"))); // NOI18N matchButton.setToolTipText("Check if model pattern matches"); matchButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { matchButtonActionPerformed(evt); } }); existenceFilterButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/brand-new.png"))); // NOI18N existenceFilterButton.setToolTipText("Brand new devices filter"); existenceFilterButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { existenceFilterButtonActionPerformed(evt); } }); excludeFilterButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/exclude.png"))); // NOI18N excludeFilterButton.setToolTipText("Exclude filter"); excludeFilterButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { excludeFilterButtonActionPerformed(evt); } }); queryFilterButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/query.png"))); // NOI18N queryFilterButton.setToolTipText("Query filter"); queryFilterButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { queryFilterButtonActionPerformed(evt); } }); removeDeviceButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/remove.png"))); // NOI18N removeDeviceButton.setToolTipText("Remove row"); removeDeviceButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeDeviceButtonActionPerformed(evt); } }); othersDevicesButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/others.png"))); // NOI18N othersDevicesButton.setToolTipText("Others"); othersDevicesButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { othersDevicesButtonActionPerformed(evt); } }); javax.swing.GroupLayout queryPanelLayout = new javax.swing.GroupLayout(queryPanel); queryPanel.setLayout(queryPanelLayout); queryPanelLayout.setHorizontalGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(queryPanelLayout.createSequentialGroup().addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(queryPanelLayout.createSequentialGroup().addComponent(filterButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(othersDevicesButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(matchButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(existenceFilterButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(excludeFilterButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(queryFilterButton).addGap(112, 112, 112) .addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(queryPanelLayout.createSequentialGroup().addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(daysSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(detailCheckBox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(deviceRankingButton, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(queryTextField)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(queryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(queryPanelLayout.createSequentialGroup().addComponent(rootSpritButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(whiteListButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(errorRecognitionButton)) .addGroup(queryPanelLayout.createSequentialGroup().addComponent(queryButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(removeDeviceButton))) .addGap(20, 20, 20))); queryPanelLayout.setVerticalGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(queryPanelLayout.createSequentialGroup().addContainerGap().addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(queryPanelLayout.createSequentialGroup().addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(errorRecognitionButton, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(whiteListButton, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(rootSpritButton, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(deviceRankingButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(queryFilterButton, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(excludeFilterButton, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(existenceFilterButton, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(queryPanelLayout.createSequentialGroup().addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(filterButton) .addGroup(queryPanelLayout.createSequentialGroup().addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(daysSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(detailCheckBox)) .addComponent(othersDevicesButton).addComponent(matchButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(queryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(queryButton) .addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(queryTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(removeDeviceButton))) .addContainerGap())); deviceDetailTable.setFont(new java.awt.Font("", 0, 12)); // NOI18N deviceDetailTable.setModel(new DeviceDetailTableModel(new ArrayList<AndroidDevice>())); deviceDetailTable.setCellSelectionEnabled(true); jScrollPane2.setViewportView(deviceDetailTable); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout .setHorizontalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING)); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(29, 29, 29))); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(queryPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 903, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap())); jPanel1Layout .setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(queryPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 580, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jTabbedPane1.addTab("Recognition Tool", jPanel1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addContainerGap().addComponent(jTabbedPane1).addContainerGap())); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1)); pack(); }
From source file:forge.gui.ImportDialog.java
@SuppressWarnings("serial") public ImportDialog(final String forcedSrcDir, final Runnable onDialogClose) { this.forcedSrcDir = forcedSrcDir; _topPanel = new FPanel(new MigLayout("insets dialog, gap 0, center, wrap, fill")); _topPanel.setOpaque(false);//from ww w . jav a2s . c om _topPanel.setBackgroundTexture(FSkin.getIcon(FSkinProp.BG_TEXTURE)); isMigration = !StringUtils.isEmpty(forcedSrcDir); // header _topPanel.add(new FLabel.Builder().text((isMigration ? "Migrate" : "Import") + " profile data").fontSize(15) .build(), "center"); // add some help text if this is for the initial data migration if (isMigration) { final FPanel blurbPanel = new FPanel(new MigLayout("insets panel, gap 10, fill")); blurbPanel.setOpaque(false); final JPanel blurbPanelInterior = new JPanel( new MigLayout("insets dialog, gap 10, center, wrap, fill")); blurbPanelInterior.setOpaque(false); blurbPanelInterior.add(new FLabel.Builder().text("<html><b>What's this?</b></html>").build(), "growx, w 50:50:"); blurbPanelInterior.add(new FLabel.Builder() .text("<html>Over the last several years, people have had to jump through a lot of hoops to" + " update to the most recent version. We hope to reduce this workload to a point where a new" + " user will find that it is fairly painless to update. In order to make this happen, Forge" + " has changed where it stores your data so that it is outside of the program installation directory." + " This way, when you upgrade, you will no longer need to import your data every time to get things" + " working. There are other benefits to having user data separate from program data, too, and it" + " lays the groundwork for some cool new features.</html>") .build(), "growx, w 50:50:"); blurbPanelInterior.add( new FLabel.Builder().text("<html><b>So where's my data going?</b></html>").build(), "growx, w 50:50:"); blurbPanelInterior.add(new FLabel.Builder().text( "<html>Forge will now store your data in the same place as other applications on your system." + " Specifically, your personal data, like decks, quest progress, and program preferences will be" + " stored in <b>" + ForgeConstants.USER_DIR + "</b> and all downloaded content, such as card pictures," + " skins, and quest world prices will be under <b>" + ForgeConstants.CACHE_DIR + "</b>. If, for whatever" + " reason, you need to set different paths, cancel out of this dialog, exit Forge, and find the <b>" + ForgeConstants.PROFILE_TEMPLATE_FILE + "</b> file in the program installation directory. Copy or rename" + " it to <b>" + ForgeConstants.PROFILE_FILE + "</b> and edit the paths inside it. Then restart Forge and use" + " this dialog to move your data to the paths that you set. Keep in mind that if you install a future" + " version of Forge into a different directory, you'll need to copy this file over so Forge will know" + " where to find your data.</html>") .build(), "growx, w 50:50:"); blurbPanelInterior.add(new FLabel.Builder().text( "<html><b>Remember, your data won't be available until you complete this step!</b></html>") .build(), "growx, w 50:50:"); final FScrollPane blurbScroller = new FScrollPane(blurbPanelInterior, true, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); blurbPanel.add(blurbScroller, "hmin 150, growy, growx, center, gap 0 0 5 5"); _topPanel.add(blurbPanel, "gap 10 10 20 0, growy, growx, w 50:50:"); } // import source widgets final JPanel importSourcePanel = new JPanel(new MigLayout("insets 0, gap 10")); importSourcePanel.setOpaque(false); importSourcePanel.add(new FLabel.Builder().text("Import from:").build()); _txfSrc = new FTextField.Builder().readonly().build(); importSourcePanel.add(_txfSrc, "pushx, growx"); _btnChooseDir = new FLabel.ButtonBuilder().text("Choose directory...").enabled(!isMigration).build(); final JFileChooser _fileChooser = new JFileChooser(); _fileChooser.setMultiSelectionEnabled(false); _fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); _btnChooseDir.setCommand(new UiCommand() { @Override public void run() { // bring up a file open dialog and, if the OK button is selected, apply the filename // to the import source text field if (JFileChooser.APPROVE_OPTION == _fileChooser.showOpenDialog(JOptionPane.getRootFrame())) { final File f = _fileChooser.getSelectedFile(); if (!f.canRead()) { FOptionPane.showErrorDialog("Cannot access selected directory (Permission denied)."); } else { _txfSrc.setText(f.getAbsolutePath()); } } } }); importSourcePanel.add(_btnChooseDir, "h pref+8!, w pref+12!"); // add change handler to the import source text field that starts up a // new analyzer. it also interacts with the current active analyzer, // if any, to make sure it cancels out before the new one is initiated _txfSrc.getDocument().addDocumentListener(new DocumentListener() { boolean _analyzerActive; // access synchronized on _onAnalyzerDone String prevText; private final Runnable _onAnalyzerDone = new Runnable() { @Override public synchronized void run() { _analyzerActive = false; notify(); } }; @Override public void removeUpdate(final DocumentEvent e) { } @Override public void changedUpdate(final DocumentEvent e) { } @Override public void insertUpdate(final DocumentEvent e) { // text field is read-only, so the only time this will get updated // is when _btnChooseDir does it final String text = _txfSrc.getText(); if (text.equals(prevText)) { // only restart the analyzer if the directory has changed return; } prevText = text; // cancel any active analyzer _cancel = true; if (!text.isEmpty()) { // ensure we don't get two instances of this function running at the same time _btnChooseDir.setEnabled(false); // re-disable the start button. it will be enabled if the previous analyzer has // already successfully finished _btnStart.setEnabled(false); // we have to wait in a background thread since we can't block in the GUI thread final SwingWorker<Void, Void> analyzerStarter = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { // wait for active analyzer (if any) to quit synchronized (_onAnalyzerDone) { while (_analyzerActive) { _onAnalyzerDone.wait(); } } return null; } // executes in gui event loop thread @Override protected void done() { _cancel = false; synchronized (_onAnalyzerDone) { // this will populate the panel with data selection widgets final _AnalyzerUpdater analyzer = new _AnalyzerUpdater(text, _onAnalyzerDone, isMigration); analyzer.run(); _analyzerActive = true; } if (!isMigration) { // only enable the directory choosing button if this is not a migration dialog // since in that case we're permanently locked to the starting directory _btnChooseDir.setEnabled(true); } } }; analyzerStarter.execute(); } } }); _topPanel.add(importSourcePanel, "gaptop 20, pushx, growx"); // prepare import selection panel (will be cleared and filled in later by an analyzer) _selectionPanel = new JPanel(); _selectionPanel.setOpaque(false); _topPanel.add(_selectionPanel, "growx, growy, gaptop 10"); // action button widgets final Runnable cleanup = new Runnable() { @Override public void run() { SOverlayUtils.hideOverlay(); } }; _btnStart = new FButton("Start import"); _btnStart.setEnabled(false); _btnCancel = new FButton("Cancel"); _btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { _cancel = true; cleanup.run(); if (null != onDialogClose) { onDialogClose.run(); } } }); final JPanel southPanel = new JPanel(new MigLayout("ax center")); southPanel.setOpaque(false); southPanel.add(_btnStart, "center, w pref+144!, h pref+12!"); southPanel.add(_btnCancel, "center, w pref+144!, h pref+12!, gap 72"); _topPanel.add(southPanel, "growx"); }
From source file:net.sf.jabref.openoffice.StyleSelectDialog.java
private void init(String inSelection) { this.initSelection = inSelection; ButtonGroup bg = new ButtonGroup(); bg.add(useDefaultAuthoryear);/*from w w w .java 2 s .c om*/ bg.add(useDefaultNumerical); bg.add(chooseDirectly); bg.add(setDirectory); if (Globals.prefs.getBoolean(JabRefPreferences.OO_USE_DEFAULT_AUTHORYEAR_STYLE)) { useDefaultAuthoryear.setSelected(true); } else if (Globals.prefs.getBoolean(JabRefPreferences.OO_USE_DEFAULT_NUMERICAL_STYLE)) { useDefaultNumerical.setSelected(true); } else { if (Globals.prefs.getBoolean(JabRefPreferences.OO_CHOOSE_STYLE_DIRECTLY)) { chooseDirectly.setSelected(true); } else { setDirectory.setSelected(true); } } directFile.setText(Globals.prefs.get(JabRefPreferences.OO_DIRECT_FILE)); styleDir.setText(Globals.prefs.get(JabRefPreferences.OO_STYLE_DIRECTORY)); directFile.setEditable(false); styleDir.setEditable(false); popup.add(edit); BrowseAction dfBrowse = BrowseAction.buildForFile(directFile, directFile); browseDirectFile.addActionListener(dfBrowse); BrowseAction sdBrowse = BrowseAction.buildForDir(styleDir, setDirectory); browseStyleDir.addActionListener(sdBrowse); showDefaultAuthoryearStyle.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { displayDefaultStyle(true); } }); showDefaultNumericalStyle.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { displayDefaultStyle(false); } }); // Add action listener to "Edit" menu item, which is supposed to open the style file in an external editor: edit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { int i = table.getSelectedRow(); if (i == -1) { return; } ExternalFileType type = ExternalFileTypes.getInstance().getExternalFileTypeByExt("jstyle"); String link = tableModel.getElementAt(i).getFile().getPath(); try { if (type == null) { JabRefDesktop.openExternalFileUnknown(frame, new BibEntry(), new MetaData(), link, new UnknownExternalFileType("jstyle")); } else { JabRefDesktop.openExternalFileAnyFormat(new MetaData(), link, type); } } catch (IOException e) { LOGGER.warn("Problem open style file editor", e); } } }); diag = new JDialog(frame, Localization.lang("Styles"), true); styles = new BasicEventList<>(); EventList<OOBibStyle> sortedStyles = new SortedList<>(styles); // Create a preview panel for previewing styles: preview = new PreviewPanel(null, new MetaData(), ""); // Use the test entry from the Preview settings tab in Preferences: preview.setEntry(prevEntry); tableModel = (DefaultEventTableModel<OOBibStyle>) GlazedListsSwing .eventTableModelWithThreadProxyList(sortedStyles, new StyleTableFormat()); table = new JTable(tableModel); TableColumnModel cm = table.getColumnModel(); cm.getColumn(0).setPreferredWidth(100); cm.getColumn(1).setPreferredWidth(200); cm.getColumn(2).setPreferredWidth(80); selectionModel = (DefaultEventSelectionModel<OOBibStyle>) GlazedListsSwing .eventSelectionModelWithThreadProxyList(sortedStyles); table.setSelectionModel(selectionModel); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent mouseEvent) { if (mouseEvent.isPopupTrigger()) { tablePopup(mouseEvent); } } @Override public void mouseReleased(MouseEvent mouseEvent) { if (mouseEvent.isPopupTrigger()) { tablePopup(mouseEvent); } } }); selectionModel.getSelected().addListEventListener(new EntrySelectionListener()); styleDir.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent documentEvent) { readStyles(); setDirectory.setSelected(true); } @Override public void removeUpdate(DocumentEvent documentEvent) { readStyles(); setDirectory.setSelected(true); } @Override public void changedUpdate(DocumentEvent documentEvent) { readStyles(); setDirectory.setSelected(true); } }); directFile.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent documentEvent) { chooseDirectly.setSelected(true); } @Override public void removeUpdate(DocumentEvent documentEvent) { chooseDirectly.setSelected(true); } @Override public void changedUpdate(DocumentEvent documentEvent) { chooseDirectly.setSelected(true); } }); contentPane.setTopComponent(new JScrollPane(table)); contentPane.setBottomComponent(preview); readStyles(); DefaultFormBuilder b = new DefaultFormBuilder( new FormLayout("fill:pref,4dlu,fill:150dlu,4dlu,fill:pref", "")); b.append(useDefaultAuthoryear, 3); b.append(showDefaultAuthoryearStyle); b.nextLine(); b.append(useDefaultNumerical, 3); b.append(showDefaultNumericalStyle); b.nextLine(); b.append(chooseDirectly); b.append(directFile); b.append(browseDirectFile); b.nextLine(); b.append(setDirectory); b.append(styleDir); b.append(browseStyleDir); b.nextLine(); DefaultFormBuilder b2 = new DefaultFormBuilder( new FormLayout("fill:1dlu:grow", "fill:pref, fill:pref, fill:270dlu:grow")); b2.nextLine(); b2.append(new JLabel("<html>" + Localization.lang("This is the list of available styles. Select the one you want to use.") + "</html>")); b2.nextLine(); b2.append(contentPane); b.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); b2.getPanel().setBorder(BorderFactory.createEmptyBorder(15, 5, 5, 5)); diag.add(b.getPanel(), BorderLayout.NORTH); diag.add(b2.getPanel(), BorderLayout.CENTER); AbstractAction okListener = new AbstractAction() { @Override public void actionPerformed(ActionEvent event) { if (!useDefaultAuthoryear.isSelected() && !useDefaultNumerical.isSelected()) { if (chooseDirectly.isSelected()) { File f = new File(directFile.getText()); if (!f.exists()) { JOptionPane.showMessageDialog(diag, Localization.lang( "You must select either a valid style file, or use a default style."), Localization.lang("Style selection"), JOptionPane.ERROR_MESSAGE); return; } } else { if ((table.getRowCount() == 0) || (table.getSelectedRowCount() == 0)) { JOptionPane.showMessageDialog(diag, Localization.lang( "You must select either a valid style file, or use a default style."), Localization.lang("Style selection"), JOptionPane.ERROR_MESSAGE); return; } } } okPressed = true; storeSettings(); diag.dispose(); } }; ok.addActionListener(okListener); Action cancelListener = new AbstractAction() { @Override public void actionPerformed(ActionEvent event) { diag.dispose(); } }; cancel.addActionListener(cancelListener); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGlue(); bb.addButton(ok); bb.addButton(cancel); bb.addGlue(); bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); diag.add(bb.getPanel(), BorderLayout.SOUTH); ActionMap am = bb.getPanel().getActionMap(); InputMap im = bb.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close"); am.put("close", cancelListener); im.put(KeyStroke.getKeyStroke("ENTER"), "enterOk"); am.put("enterOk", okListener); diag.pack(); diag.setLocationRelativeTo(frame); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { contentPane.setDividerLocation(contentPane.getSize().height - 150); } }); }
From source file:cl.uai.webcursos.emarking.desktop.OptionsDialog.java
/** * Create the dialog./*from ww w. j a va 2 s. c o m*/ */ public OptionsDialog(Moodle _moodle) { addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { cancelled = true; } }); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setIconImage(Toolkit.getDefaultToolkit().getImage(OptionsDialog.class .getResource("/cl/uai/webcursos/emarking/desktop/resources/glyphicons_439_wrench.png"))); setTitle(EmarkingDesktop.lang.getString("emarkingoptions")); setModal(true); setBounds(100, 100, 707, 444); this.moodle = _moodle; this.moodle.loadProperties(); getContentPane().setLayout(new BorderLayout()); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { okButton = new JButton(EmarkingDesktop.lang.getString("ok")); okButton.setEnabled(false); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS); if (!validator.isValid(moodleurl.getText())) { throw new Exception(EmarkingDesktop.lang.getString("invalidmoodleurl") + " " + moodleurl.getText()); } File f = new File(filename.getText()); if (!f.exists() || f.isDirectory() || (!f.getPath().endsWith(".pdf") && !f.getPath().endsWith(".zip"))) { throw new Exception(EmarkingDesktop.lang.getString("invalidpdffile") + " " + filename.getText()); } if (omrtemplate.getText().trim().length() > 0) { File omrf = new File(omrtemplate.getText()); if (!omrf.exists() || omrf.isDirectory() || (!omrf.getPath().endsWith(".xtmpl"))) { throw new Exception(EmarkingDesktop.lang.getString("invalidomrfile") + " " + omrtemplate.getText()); } } moodle.setLastfile(filename.getText()); moodle.getQrExtractor().setDoubleside(chckbxDoubleSide.isSelected()); moodle.setMaxthreads(Integer.parseInt(getMaxThreads().getSelectedItem().toString())); moodle.setResolution(Integer.parseInt(getResolution().getSelectedItem().toString())); moodle.setMaxzipsize(getMaxZipSize().getSelectedItem().toString()); moodle.setOMRTemplate(omrtemplate.getText()); moodle.setThreshold(Integer.parseInt(spinnerOMRthreshold.getValue().toString())); moodle.setDensity(Integer.parseInt(spinnerOMRdensity.getValue().toString())); moodle.setShapeSize(Integer.parseInt(spinnerOMRshapeSize.getValue().toString())); moodle.setAnonymousPercentage( Integer.parseInt(spinnerAnonymousPercentage.getValue().toString())); moodle.setAnonymousPercentageCustomPage( Integer.parseInt(spinnerAnonymousPercentageCustomPage.getValue().toString())); moodle.setFakeStudents(chckbxMarkersTraining.isSelected()); moodle.saveProperties(); cancelled = false; setVisible(false); } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(panel, EmarkingDesktop.lang.getString("invaliddatainform")); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton(EmarkingDesktop.lang.getString("cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelled = true; setVisible(false); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); getContentPane().add(tabbedPane, BorderLayout.CENTER); panel = new JPanel(); tabbedPane.addTab(EmarkingDesktop.lang.getString("general"), null, panel, null); panel.setLayout(null); JPanel panel_2 = new JPanel(); panel_2.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_2.setBounds(10, 11, 665, 131); panel.add(panel_2); panel_2.setLayout(null); JLabel lblPassword = new JLabel(EmarkingDesktop.lang.getString("password")); lblPassword.setBounds(10, 99, 109, 14); panel_2.add(lblPassword); lblPassword.setHorizontalAlignment(SwingConstants.RIGHT); password = new JPasswordField(); password.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { testConnection(); } }); password.setBounds(129, 96, 329, 20); panel_2.add(password); this.password.setText(this.moodle.getPassword()); btnTestConnection = new JButton(EmarkingDesktop.lang.getString("connect")); btnTestConnection.setEnabled(false); btnTestConnection.setBounds(468, 93, 172, 27); panel_2.add(btnTestConnection); username = new JTextField(); username.setBounds(129, 65, 329, 20); panel_2.add(username); username.setColumns(10); this.username.setText(this.moodle.getUsername()); moodleurl = new JTextField(); moodleurl.setBounds(129, 34, 329, 20); panel_2.add(moodleurl); moodleurl.setColumns(10); moodleurl.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { warn(); } @Override public void insertUpdate(DocumentEvent e) { warn(); } @Override public void changedUpdate(DocumentEvent e) { warn(); } private void warn() { UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS); if (!validator.isValid(moodleurl.getText()) || !moodleurl.getText().endsWith("/")) { moodleurl.setForeground(Color.RED); btnTestConnection.setEnabled(false); } else { moodleurl.setForeground(Color.BLACK); btnTestConnection.setEnabled(true); } } }); // Initializing values from moodle configuration this.moodleurl.setText(this.moodle.getUrl()); JLabel lblMoodleUrl = new JLabel(EmarkingDesktop.lang.getString("moodleurl")); lblMoodleUrl.setBounds(10, 37, 109, 14); panel_2.add(lblMoodleUrl); lblMoodleUrl.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblUsername = new JLabel(EmarkingDesktop.lang.getString("username")); lblUsername.setBounds(10, 68, 109, 14); panel_2.add(lblUsername); lblUsername.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblMoodleSettings = new JLabel(EmarkingDesktop.lang.getString("moodlesettings")); lblMoodleSettings.setBounds(10, 11, 230, 14); panel_2.add(lblMoodleSettings); btnTestConnection.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { testConnection(); } }); JPanel panel_3 = new JPanel(); panel_3.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_3.setBounds(10, 159, 666, 174); panel.add(panel_3); panel_3.setLayout(null); JLabel lblPdfFile = new JLabel(EmarkingDesktop.lang.getString("pdffile")); lblPdfFile.setBounds(0, 39, 119, 14); panel_3.add(lblPdfFile); lblPdfFile.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblScanned = new JLabel(EmarkingDesktop.lang.getString("scanned")); lblScanned.setBounds(0, 64, 119, 14); panel_3.add(lblScanned); lblScanned.setHorizontalAlignment(SwingConstants.RIGHT); chckbxDoubleSide = new JCheckBox(EmarkingDesktop.lang.getString("doubleside")); chckbxDoubleSide.setEnabled(false); chckbxDoubleSide.setBounds(125, 60, 333, 23); panel_3.add(chckbxDoubleSide); chckbxDoubleSide.setToolTipText(EmarkingDesktop.lang.getString("doublesidetooltip")); this.chckbxDoubleSide.setSelected(this.moodle.getQrExtractor().isDoubleside()); filename = new JTextField(); filename.setEnabled(false); filename.setBounds(129, 36, 329, 20); panel_3.add(filename); filename.setColumns(10); filename.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { warn(); } @Override public void insertUpdate(DocumentEvent e) { warn(); } @Override public void changedUpdate(DocumentEvent e) { warn(); } private void warn() { validateFileForProcessing(!btnTestConnection.isEnabled()); } }); this.filename.setText(this.moodle.getLastfile()); btnOpenPdfFile = new JButton(EmarkingDesktop.lang.getString("openfile")); btnOpenPdfFile.setEnabled(false); btnOpenPdfFile.setBounds(468, 33, 172, 27); panel_3.add(btnOpenPdfFile); JLabel lblPdfFileSettings = new JLabel(EmarkingDesktop.lang.getString("filesettings")); lblPdfFileSettings.setBounds(10, 11, 230, 14); panel_3.add(lblPdfFileSettings); JLabel lblOMRtemplate = new JLabel(EmarkingDesktop.lang.getString("omrfile")); lblOMRtemplate.setHorizontalAlignment(SwingConstants.RIGHT); lblOMRtemplate.setBounds(0, 142, 119, 14); panel_3.add(lblOMRtemplate); omrtemplate = new JTextField(); omrtemplate.setEnabled(false); omrtemplate.setText((String) null); omrtemplate.setColumns(10); omrtemplate.setBounds(129, 139, 329, 20); panel_3.add(omrtemplate); omrtemplate.setText(this.moodle.getOMRTemplate()); btnOpenOMRTemplate = new JButton(EmarkingDesktop.lang.getString("openomrfile")); btnOpenOMRTemplate.setEnabled(false); btnOpenOMRTemplate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle(EmarkingDesktop.lang.getString("openfiletitle")); chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "*.xtmpl"; } @Override public boolean accept(File arg0) { if (arg0.getName().endsWith(".xtmpl") || arg0.isDirectory()) return true; return false; } }); int retval = chooser.showOpenDialog(panel); if (retval == JFileChooser.APPROVE_OPTION) { omrtemplate.setText(chooser.getSelectedFile().getAbsolutePath()); } else { return; } } }); btnOpenOMRTemplate.setBounds(468, 136, 172, 27); panel_3.add(btnOpenOMRTemplate); lblMarkersTraining = new JLabel((String) EmarkingDesktop.lang.getString("markerstraining")); lblMarkersTraining.setHorizontalAlignment(SwingConstants.RIGHT); lblMarkersTraining.setBounds(0, 89, 119, 14); panel_3.add(lblMarkersTraining); chckbxMarkersTraining = new JCheckBox(EmarkingDesktop.lang.getString("markerstrainingfakestudents")); chckbxMarkersTraining.setBounds(125, 87, 333, 23); panel_3.add(chckbxMarkersTraining); btnOpenPdfFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okButton.setEnabled(false); JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle(EmarkingDesktop.lang.getString("openfiletitle")); chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "*.pdf, *.zip"; } @Override public boolean accept(File arg0) { if (arg0.getName().endsWith(".zip") || arg0.getName().endsWith(".pdf") || arg0.isDirectory()) return true; return false; } }); int retval = chooser.showOpenDialog(panel); if (retval == JFileChooser.APPROVE_OPTION) { filename.setText(chooser.getSelectedFile().getAbsolutePath()); okButton.setEnabled(true); } else { return; } } }); JPanel panel_1 = new JPanel(); tabbedPane.addTab(EmarkingDesktop.lang.getString("advanced"), null, panel_1, null); panel_1.setLayout(null); JPanel panel_4 = new JPanel(); panel_4.setLayout(null); panel_4.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_4.setBounds(10, 11, 665, 131); panel_1.add(panel_4); JLabel lblAdvancedOptions = new JLabel(EmarkingDesktop.lang.getString("advancedoptions")); lblAdvancedOptions.setBounds(10, 11, 233, 14); panel_4.add(lblAdvancedOptions); JLabel lblThreads = new JLabel(EmarkingDesktop.lang.getString("maxthreads")); lblThreads.setBounds(10, 38, 130, 14); panel_4.add(lblThreads); lblThreads.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblSomething = new JLabel(EmarkingDesktop.lang.getString("separatezipfiles")); lblSomething.setBounds(10, 73, 130, 14); panel_4.add(lblSomething); lblSomething.setHorizontalAlignment(SwingConstants.RIGHT); JLabel label = new JLabel(EmarkingDesktop.lang.getString("resolution")); label.setBounds(10, 105, 130, 14); panel_4.add(label); label.setHorizontalAlignment(SwingConstants.RIGHT); resolution = new JComboBox<Integer>(); resolution.setBounds(150, 99, 169, 27); panel_4.add(resolution); resolution.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 75, 100, 150, 300, 400, 500, 600 })); resolution.setSelectedIndex(2); this.resolution.setSelectedItem(this.moodle.getQrExtractor().getResolution()); maxZipSize = new JComboBox<String>(); maxZipSize.setBounds(150, 67, 169, 27); panel_4.add(maxZipSize); maxZipSize.setModel(new DefaultComboBoxModel<String>(new String[] { "<dynamic>", "2Mb", "4Mb", "8Mb", "16Mb", "32Mb", "64Mb", "128Mb", "256Mb", "512Mb", "1024Mb" })); maxZipSize.setSelectedIndex(6); this.maxZipSize.setSelectedItem(this.moodle.getMaxZipSizeString()); maxThreads = new JComboBox<Integer>(); maxThreads.setBounds(150, 32, 169, 27); panel_4.add(maxThreads); maxThreads.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 2, 4, 8, 16 })); maxThreads.setSelectedIndex(1); this.maxThreads.setSelectedItem(this.moodle.getQrExtractor().getMaxThreads()); JPanel panel_5 = new JPanel(); panel_5.setLayout(null); panel_5.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_5.setBounds(10, 153, 665, 131); panel_1.add(panel_5); JLabel lblOMRoptions = new JLabel(EmarkingDesktop.lang.getString("omroptions")); lblOMRoptions.setBounds(10, 11, 233, 14); panel_5.add(lblOMRoptions); JLabel lblOMRthreshold = new JLabel(EmarkingDesktop.lang.getString("omrthreshold")); lblOMRthreshold.setHorizontalAlignment(SwingConstants.RIGHT); lblOMRthreshold.setBounds(10, 32, 130, 14); panel_5.add(lblOMRthreshold); JLabel lblShapeSize = new JLabel(EmarkingDesktop.lang.getString("omrshapesize")); lblShapeSize.setHorizontalAlignment(SwingConstants.RIGHT); lblShapeSize.setBounds(10, 99, 130, 14); panel_5.add(lblShapeSize); JLabel lblDensity = new JLabel(EmarkingDesktop.lang.getString("omrdensity")); lblDensity.setHorizontalAlignment(SwingConstants.RIGHT); lblDensity.setBounds(10, 70, 130, 14); panel_5.add(lblDensity); spinnerOMRthreshold = new JSpinner(); spinnerOMRthreshold.setBounds(150, 32, 169, 20); panel_5.add(spinnerOMRthreshold); spinnerOMRthreshold.setValue(this.moodle.getOMRthreshold()); spinnerOMRdensity = new JSpinner(); spinnerOMRdensity.setBounds(150, 67, 169, 20); panel_5.add(spinnerOMRdensity); spinnerOMRdensity.setValue(this.moodle.getOMRdensity()); spinnerOMRshapeSize = new JSpinner(); spinnerOMRshapeSize.setBounds(150, 99, 169, 20); panel_5.add(spinnerOMRshapeSize); spinnerOMRshapeSize.setValue(this.moodle.getOMRshapeSize()); JLabel lblAnonymousPercentage = new JLabel( "<html>" + EmarkingDesktop.lang.getString("anonymouspercentage") + "</html>"); lblAnonymousPercentage.setHorizontalAlignment(SwingConstants.RIGHT); lblAnonymousPercentage.setBounds(329, 32, 130, 27); panel_5.add(lblAnonymousPercentage); spinnerAnonymousPercentage = new JSpinner(); spinnerAnonymousPercentage.setBounds(469, 32, 169, 20); panel_5.add(spinnerAnonymousPercentage); spinnerAnonymousPercentage.setValue(this.moodle.getAnonymousPercentage()); JLabel lblAnonymousPercentageCustomPage = new JLabel( "<html>" + EmarkingDesktop.lang.getString("anonymouspercentagecustompage") + "</html>"); lblAnonymousPercentageCustomPage.setHorizontalAlignment(SwingConstants.RIGHT); lblAnonymousPercentageCustomPage.setBounds(329, 70, 130, 27); panel_5.add(lblAnonymousPercentageCustomPage); spinnerAnonymousPercentageCustomPage = new JSpinner(); spinnerAnonymousPercentageCustomPage.setBounds(469, 70, 169, 20); panel_5.add(spinnerAnonymousPercentageCustomPage); spinnerAnonymousPercentageCustomPage.setValue(this.moodle.getAnonymousPercentageCustomPage()); JLabel lblCustomPage = new JLabel( "<html>" + EmarkingDesktop.lang.getString("anonymouscustompage") + "</html>"); lblCustomPage.setHorizontalAlignment(SwingConstants.RIGHT); lblCustomPage.setBounds(329, 99, 130, 27); panel_5.add(lblCustomPage); spinnerCustomPage = new JSpinner(); spinnerCustomPage.setBounds(469, 99, 169, 20); panel_5.add(spinnerCustomPage); spinnerCustomPage.setValue(this.moodle.getAnonymousCustomPage()); }
From source file:com.u2apple.tool.ui.MainFrame.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./* w w w. j a v a 2s .co m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); productIdLabel = new javax.swing.JLabel(); productIdTextField = new javax.swing.JTextField(); brandLabel = new javax.swing.JLabel(); brandTextField = new javax.swing.JTextField(); productLabel = new javax.swing.JLabel(); productTextField = new javax.swing.JTextField(); aliasLabel = new javax.swing.JLabel(); aliasTextField = new javax.swing.JTextField(); typeComboBox = new javax.swing.JComboBox(); jLabel2 = new javax.swing.JLabel(); enBrandLabel = new javax.swing.JLabel(); enBrandTextField = new javax.swing.JTextField(); enProductLabel = new javax.swing.JLabel(); enProductTextField = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); enAliasTextField = new javax.swing.JTextField(); jPanel12 = new javax.swing.JPanel(); jScrollPane4 = new javax.swing.JScrollPane(); resultTextArea = new javax.swing.JTextArea(); jPanel13 = new javax.swing.JPanel(); connectButton = new javax.swing.JButton(); deviceButton = new javax.swing.JButton(); modelButton = new javax.swing.JButton(); testCaseButton = new javax.swing.JButton(); knockOffButton = new javax.swing.JButton(); knockOffCheckBox = new javax.swing.JCheckBox(); productIdButton = new javax.swing.JButton(); updateModelButton = new javax.swing.JButton(); conditionCheckBox = new javax.swing.JCheckBox(); detailButton = new javax.swing.JButton(); queryLimitSpinner = new javax.swing.JSpinner(); allCheckBox = new javax.swing.JCheckBox(); googleButton = new javax.swing.JButton(); baiduButton = new javax.swing.JButton(); sortButton = new javax.swing.JButton(); updateTestCaseButton = new javax.swing.JButton(); deviceCountButton = new javax.swing.JButton(); addButton = new javax.swing.JButton(); updateButton = new javax.swing.JButton(); flushButton = new javax.swing.JButton(); jPanel14 = new javax.swing.JPanel(); resolutionLabel = new javax.swing.JLabel(); resolutionComboBox = new javax.swing.JComboBox(); partitionLabel = new javax.swing.JLabel(); partitionTextField = new javax.swing.JTextField(); jPanel6 = new javax.swing.JPanel(); modelLabel = new javax.swing.JLabel(); modelTextField = new javax.swing.JTextField(); vidLabel = new javax.swing.JLabel(); vidTextField = new javax.swing.JTextField(); conditionComboBox = new javax.swing.JComboBox(); conditionTextField = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); vid2TextField = new javax.swing.JTextField(); condition2ComboBox = new javax.swing.JComboBox(); condition2TextField = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); deviceTable = new javax.swing.JTable(); queryPanel = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); daysSpinner = new javax.swing.JSpinner(); deviceRankingButton = new javax.swing.JButton(); errorRecognitionButton = new javax.swing.JButton(); queryTextField = new javax.swing.JTextField(); queryButton = new javax.swing.JButton(); rootSpritButton = new javax.swing.JButton(); filterButton = new javax.swing.JButton(); unnormalDeviceFilterButton = new javax.swing.JButton(); newDeviceFilterButton = new javax.swing.JButton(); excludeFilterButton = new javax.swing.JButton(); queryFilterButton = new javax.swing.JButton(); removeDeviceButton = new javax.swing.JButton(); othersDevicesButton = new javax.swing.JButton(); fakeDetectionButton = new javax.swing.JButton(); shuameMobileButton = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); deviceDetailTable = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Recognition Tool"); jPanel1.setPreferredSize(new java.awt.Dimension(1900, 971)); jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Device")); jPanel5.setFont(new java.awt.Font("", 0, 12)); // NOI18N productIdLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N productIdLabel.setText("Product ID:"); productIdTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N productIdTextField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { productIdTextFieldActionPerformed(evt); } }); productIdTextField.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { productIdTextFieldPropertyChange(evt); } }); productIdTextField.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { } public void removeUpdate(DocumentEvent e) { String productId = productIdTextField.getText(); boolean exists = deviceDao.productIdExists(productId); if (exists) { productIdTextField.setBackground(Color.GREEN); } else { productIdTextField.setBackground(Color.WHITE); } } public void insertUpdate(DocumentEvent e) { String productId = productIdTextField.getText(); boolean exists = deviceDao.productIdExists(productId); if (exists) { productIdTextField.setBackground(Color.GREEN); } else { productIdTextField.setBackground(Color.WHITE); } } }); brandLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N brandLabel.setText("Brand:"); brandTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N productLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N productLabel.setText("Product:"); productTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N aliasLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N aliasLabel.setText("Alias:"); aliasTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N typeComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N typeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Phone&Pad", "Box", "Watch" })); jLabel2.setFont(new java.awt.Font("", 0, 12)); // NOI18N jLabel2.setText("Type:"); enBrandLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N enBrandLabel.setText("EN Brand:"); enBrandTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N enBrandTextField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { enBrandTextFieldActionPerformed(evt); } }); enProductLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N enProductLabel.setText("EN Product:"); enProductTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N jLabel4.setFont(new java.awt.Font("", 0, 12)); // NOI18N jLabel4.setText("EN Alias:"); enAliasTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(enBrandLabel).addComponent(productIdLabel).addComponent(brandLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(brandTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE) .addComponent(productIdTextField).addComponent(enBrandTextField)) .addGap(18, 18, 18) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel5Layout.createSequentialGroup().addGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(productLabel).addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(typeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(productTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel5Layout.createSequentialGroup().addComponent(enProductLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(enProductTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(23, 23, 23) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(aliasLabel).addComponent(jLabel4)) .addGap(18, 18, 18).addGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(aliasTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE) .addComponent(enAliasTextField)))); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(productIdLabel) .addComponent(productIdTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2).addComponent(typeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(productLabel) .addComponent(productTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(brandLabel) .addComponent(brandTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(aliasLabel).addComponent(aliasTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(enBrandLabel) .addComponent(enBrandTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(enProductLabel) .addComponent(enProductTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4).addComponent(enAliasTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())); jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder("Result")); resultTextArea.setColumns(20); resultTextArea.setFont(new java.awt.Font("", 0, 13)); // NOI18N resultTextArea.setRows(5); jScrollPane4.setViewportView(resultTextArea); javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12); jPanel12.setLayout(jPanel12Layout); jPanel12Layout .setHorizontalGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 864, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(35, 35, 35))); jPanel12Layout .setVerticalGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(19, 19, 19))); jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder("Action")); jPanel13.setFont(new java.awt.Font("", 0, 12)); // NOI18N connectButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N connectButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/New Filled-32.png"))); // NOI18N connectButton.setToolTipText("Get the latest device information."); connectButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { connectButtonActionPerformed(evt); } }); deviceButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N deviceButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Android-32.png"))); // NOI18N deviceButton.setToolTipText("Add device"); deviceButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deviceButtonActionPerformed(evt); } }); modelButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N modelButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Ruler Filled-32.png"))); // NOI18N modelButton.setToolTipText("Add model to system mode and recovery mode"); modelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { modelButtonActionPerformed(evt); } }); testCaseButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N testCaseButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Checked Filled-32.png"))); // NOI18N testCaseButton.setToolTipText("Add test case"); testCaseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { testCaseButtonActionPerformed(evt); } }); knockOffButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N knockOffButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Biotech Filled-32.png"))); // NOI18N knockOffButton.setToolTipText("Generate Knock-Off configuration"); knockOffButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { knockOffButtonActionPerformed(evt); } }); knockOffCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N knockOffCheckBox.setText("Knock-Off"); productIdButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N productIdButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/RFID Signal-32.png"))); // NOI18N productIdButton.setToolTipText("Fullfill device information"); productIdButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { productIdButtonActionPerformed(evt); } }); updateModelButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N updateModelButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Ruler-32.png"))); // NOI18N updateModelButton.setToolTipText("Add model to current vid"); updateModelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateModelButtonActionPerformed(evt); } }); conditionCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N conditionCheckBox.setText("Condition"); detailButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N detailButton.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/u2apple/tool/icon/View Details Filled-32.png"))); // NOI18N detailButton.setToolTipText("Device detail"); detailButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { detailButtonActionPerformed(evt); } }); queryLimitSpinner.setFont(new java.awt.Font("", 0, 12)); // NOI18N queryLimitSpinner.setModel(new javax.swing.SpinnerNumberModel(10, 1, 100, 10)); allCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N allCheckBox.setText("All"); googleButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N googleButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Google Logo-32.png"))); // NOI18N googleButton.setToolTipText("Google"); googleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { googleButtonActionPerformed(evt); } }); baiduButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N baiduButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/B-32.png"))); // NOI18N baiduButton.setToolTipText("Baidu"); baiduButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { baiduButtonActionPerformed(evt); } }); sortButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N sortButton.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/u2apple/tool/icon/Descending Sorting-32.png"))); // NOI18N sortButton.setToolTipText("Sort models under a vid"); sortButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sortButtonActionPerformed(evt); } }); updateTestCaseButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N updateTestCaseButton.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/u2apple/tool/icon/Checkmark Filled-32.png"))); // NOI18N updateTestCaseButton.setToolTipText("Update test case"); updateTestCaseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateTestCaseButtonActionPerformed(evt); } }); deviceCountButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N deviceCountButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Sigma-32.png"))); // NOI18N deviceCountButton.setToolTipText("Device Count"); deviceCountButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deviceCountButtonActionPerformed(evt); } }); addButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Plus Math-32.png"))); // NOI18N addButton.setToolTipText("Add new device and model"); addButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addButtonActionPerformed(evt); } }); updateButton.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/u2apple/tool/icon/Available Updates-32.png"))); // NOI18N updateButton.setToolTipText("Update"); updateButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateButtonActionPerformed(evt); } }); flushButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Save-32.png"))); // NOI18N flushButton.setToolTipText("Flush devices to file"); flushButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { flushButtonActionPerformed(evt); } }); javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13); jPanel13.setLayout(jPanel13Layout); jPanel13Layout .setHorizontalGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addContainerGap().addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(productIdButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(deviceButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( knockOffButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup( jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup() .addComponent(detailButton).addGap(18, 18, 18) .addComponent(queryLimitSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(allCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(connectButton) .addGap(18, 18, 18).addComponent(deviceCountButton) .addGap(18, 18, 18).addComponent(googleButton) .addGap(18, 18, 18).addComponent(baiduButton)) .addGroup(jPanel13Layout.createSequentialGroup() .addGroup(jPanel13Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel13Layout.createSequentialGroup() .addComponent(testCaseButton) .addGap(18, 18, 18) .addComponent(updateTestCaseButton) .addGap(18, 18, 18) .addComponent(knockOffCheckBox) .addGap(18, 18, 18).addComponent( sortButton, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel13Layout.createSequentialGroup() .addComponent(modelButton) .addGap(18, 18, 18) .addComponent(updateModelButton) .addGap(18, 18, 18) .addComponent(conditionCheckBox) .addGap(18, 18, 18) .addComponent(addButton))) .addGap(18, 18, 18).addComponent(updateButton) .addGap(18, 18, 18).addComponent(flushButton))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel13Layout.setVerticalGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(detailButton).addComponent(connectButton) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(queryLimitSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(allCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(productIdButton, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(deviceCountButton).addComponent(googleButton)) .addComponent(baiduButton)) .addGap(18, 18, 18) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(deviceButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(modelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(updateModelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(addButton).addComponent(conditionCheckBox)) .addComponent(updateButton)).addGap(18, 18, 18) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(testCaseButton).addComponent(knockOffButton) .addComponent(updateTestCaseButton).addComponent(sortButton) .addComponent(knockOffCheckBox))) .addComponent(flushButton)))); jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder("Knock-Off")); resolutionLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N resolutionLabel.setText("Resolution:"); resolutionComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N resolutionComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "320x480", "480x800", "480x854", "540x960", "720x1184", "720x1280", "800x1280", "1080x1776", "1080x1920", "1440x2392" })); resolutionComboBox.setSelectedIndex(5); partitionLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N partitionLabel.setText("Partition:"); partitionTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14); jPanel14.setLayout(jPanel14Layout); jPanel14Layout.setHorizontalGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(resolutionLabel).addComponent(partitionLabel)) .addGap(18, 18, 18) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(resolutionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(partitionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 779, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(24, 24, 24))); jPanel14Layout.setVerticalGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup() .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(resolutionLabel).addComponent(resolutionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(partitionLabel).addComponent(partitionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Model")); jPanel6.setFont(new java.awt.Font("", 0, 12)); // NOI18N modelLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N modelLabel.setText("Model:"); modelTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N modelTextField.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { checkModelExistence(); } public void removeUpdate(DocumentEvent e) { checkModelExistence(); } public void insertUpdate(DocumentEvent e) { checkModelExistence(); } }); vidLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N vidLabel.setText("VID:"); vidTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N vidTextField.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { checkModelExistence(); } public void removeUpdate(DocumentEvent e) { checkModelExistence(); } public void insertUpdate(DocumentEvent e) { checkModelExistence(); } }); conditionComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N conditionComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Board", "Brand", "Cpu", "Device", "Hardware", "Manufacturer", "Adb_Device", "Display_ID", "Product_Name" })); conditionComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { conditionComboBoxActionPerformed(evt); } }); conditionTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N conditionTextField.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { conditionTextFieldFocusGained(evt); } }); jLabel3.setFont(new java.awt.Font("", 0, 12)); // NOI18N jLabel3.setText("VID2:"); vid2TextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N condition2ComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N condition2ComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Board", "Brand", "Cpu", "Device", "Hardware", "Manufacturer", "Adb_Device", "Display_ID", "Product_Name" })); condition2ComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { condition2ComboBoxActionPerformed(evt); } }); condition2TextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(modelLabel) .addComponent(vidLabel, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(18, 18, 18) .addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel6Layout.createSequentialGroup() .addComponent(vidTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(vid2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(modelTextField)) .addGap(54, 54, 54) .addGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(conditionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(condition2ComboBox, 0, 1, Short.MAX_VALUE)) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addGap(4, 4, 4).addComponent( conditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel6Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(condition2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(vidLabel) .addComponent(vidTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3) .addComponent(vid2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(conditionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(conditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(condition2ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(condition2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(modelLabel).addComponent(modelTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout .setHorizontalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jPanel13, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel14, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 899, Short.MAX_VALUE) .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, 899, Short.MAX_VALUE)) .addContainerGap(88, Short.MAX_VALUE))); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); deviceTable.setFont(new java.awt.Font("", 0, 12)); // NOI18N deviceTable.setModel(new DeviceTableModel(new ArrayList<AndroidDeviceRanking>())); initRowSelectionEvent(); jScrollPane1.setViewportView(deviceTable); jLabel1.setFont(new java.awt.Font("", 0, 12)); // NOI18N jLabel1.setText("Days:"); daysSpinner.setFont(new java.awt.Font("", 0, 12)); // NOI18N daysSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 0, 10, 1)); deviceRankingButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N deviceRankingButton.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/u2apple/tool/icon/Question Mark Filled-32.png"))); // NOI18N deviceRankingButton.setToolTipText("Unrecognized devices trend"); deviceRankingButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deviceRankingButtonActionPerformed(evt); } }); errorRecognitionButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N errorRecognitionButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Bug Filled-32.png"))); // NOI18N errorRecognitionButton.setToolTipText("Error detection"); errorRecognitionButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { errorRecognitionButtonActionPerformed(evt); } }); queryTextField.setFont(new java.awt.Font("", 0, 14)); // NOI18N queryTextField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { queryTextFieldActionPerformed(evt); } }); queryButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N queryButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Search Filled-32.png"))); // NOI18N queryButton.setToolTipText("Query by model"); queryButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { queryButtonActionPerformed(evt); } }); rootSpritButton.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/u2apple/tool/icon/Restriction Shield Filled-32.png"))); // NOI18N rootSpritButton.setToolTipText("Mobile root spirit device ranking list"); rootSpritButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rootSpritButtonActionPerformed(evt); } }); filterButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Like-32.png"))); // NOI18N filterButton.setToolTipText("Pattern Filter"); filterButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { filterButtonActionPerformed(evt); } }); unnormalDeviceFilterButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Define Location-32.png"))); // NOI18N unnormalDeviceFilterButton.setToolTipText("Unnormal device filter"); unnormalDeviceFilterButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { unnormalDeviceFilterButtonActionPerformed(evt); } }); newDeviceFilterButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/New-32.png"))); // NOI18N newDeviceFilterButton.setToolTipText("Brand new devices filter"); newDeviceFilterButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newDeviceFilterButtonActionPerformed(evt); } }); excludeFilterButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Not Equal-32.png"))); // NOI18N excludeFilterButton.setToolTipText("Exclude filter"); excludeFilterButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { excludeFilterButtonActionPerformed(evt); } }); queryFilterButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Filter-32.png"))); // NOI18N queryFilterButton.setToolTipText("Query filter"); queryFilterButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { queryFilterButtonActionPerformed(evt); } }); removeDeviceButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Delete-32.png"))); // NOI18N removeDeviceButton.setToolTipText("Remove row"); removeDeviceButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeDeviceButtonActionPerformed(evt); } }); othersDevicesButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/More-32.png"))); // NOI18N othersDevicesButton.setToolTipText("Others"); othersDevicesButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { othersDevicesButtonActionPerformed(evt); } }); fakeDetectionButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Copy-32.png"))); // NOI18N fakeDetectionButton.setToolTipText("Fake detection"); fakeDetectionButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fakeDetectionButtonActionPerformed(evt); } }); shuameMobileButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/tool/icon/Question Mark-32.png"))); // NOI18N shuameMobileButton.setToolTipText("List unidentified devices of Shuame mobile"); shuameMobileButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { shuameMobileButtonActionPerformed(evt); } }); javax.swing.GroupLayout queryPanelLayout = new javax.swing.GroupLayout(queryPanel); queryPanel.setLayout(queryPanelLayout); queryPanelLayout.setHorizontalGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(queryPanelLayout.createSequentialGroup().addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(queryPanelLayout.createSequentialGroup().addComponent(filterButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(othersDevicesButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(unnormalDeviceFilterButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(newDeviceFilterButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(excludeFilterButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(queryFilterButton).addGap(18, 18, 18).addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(daysSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(deviceRankingButton, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(shuameMobileButton)) .addComponent(queryTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 679, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(queryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(queryPanelLayout.createSequentialGroup().addComponent(queryButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(removeDeviceButton)) .addGroup(queryPanelLayout.createSequentialGroup().addComponent(rootSpritButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(errorRecognitionButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(fakeDetectionButton))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); queryPanelLayout.setVerticalGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(queryPanelLayout.createSequentialGroup().addContainerGap().addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(queryPanelLayout.createSequentialGroup().addComponent(errorRecognitionButton) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(queryPanelLayout.createSequentialGroup().addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fakeDetectionButton).addComponent(filterButton) .addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(daysSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addComponent(othersDevicesButton).addComponent(unnormalDeviceFilterButton) .addComponent(newDeviceFilterButton).addComponent(excludeFilterButton) .addComponent(queryFilterButton) .addComponent(deviceRankingButton, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(rootSpritButton).addComponent(shuameMobileButton)).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE))) .addGroup(queryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(queryButton) .addGroup(queryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(queryTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(removeDeviceButton))) .addContainerGap())); deviceDetailTable.setFont(new java.awt.Font("", 0, 12)); // NOI18N deviceDetailTable.setModel(new DeviceDetailTableModel(new ArrayList<AndroidDevice>())); deviceDetailTable.setCellSelectionEnabled(true); jScrollPane2.setViewportView(deviceDetailTable); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 1839, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 1, Short.MAX_VALUE))); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 219, Short.MAX_VALUE) .addContainerGap())); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(queryPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 903, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18))))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(0, 0, 0) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(queryPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(4, 4, 4).addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 1856, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))); pack(); }