-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Tamir Krispis <tamir.krispis@niceactimize.com>
- Loading branch information
1 parent
86da929
commit f3cde8f
Showing
80 changed files
with
1,650 additions
and
1,161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 16 additions & 16 deletions
32
...c/src/main/java/com/keepaste/logic/actionlisteners/dialogkeep/AddParamActionListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,62 @@ | ||
/** | ||
* Keepaste - The keep and paste program (http://www.keepaste.com) | ||
* Copyright (C) 2023 Tamir Krispis | ||
* | ||
* <p> | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* <p> | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* <p> | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.keepaste.logic.actionlisteners.dialogkeep; | ||
|
||
import com.keepaste.gui.DialogKeep; | ||
import com.keepaste.logic.views.KeepParametersTableModel; | ||
import lombok.extern.log4j.Log4j2; | ||
import javax.swing.JTable; | ||
import java.awt.event.ActionEvent; | ||
|
||
/** | ||
* This class is an ActionListener for adding a parameter to a Keep on the {@link com.keepaste.gui.DialogKeep}. | ||
* This class is an ActionListener for adding a parameter to a Keep on the {@code com.keepaste.gui.DialogKeep}. | ||
*/ | ||
@Log4j2 | ||
public class AddParamActionListener extends BaseDialogKeepActionListener { | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param table the {@link JTable} to show the parameters | ||
* @param dialogKeep a {@code DialogKeep} | ||
*/ | ||
public AddParamActionListener(final JTable table) { | ||
super(table); | ||
public AddParamActionListener(final DialogKeep dialogKeep) { | ||
super(dialogKeep); | ||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
// Adding a new parameter to the parameters table on the dialog | ||
log.debug("DialogKeep - Adding new keep parameter on the Dialog Command"); | ||
var table = getTable(); | ||
KeepParametersTableModel model = (KeepParametersTableModel) table.getModel(); | ||
var tableParams = dialogKeep.tableParams; | ||
KeepParametersTableModel model = (KeepParametersTableModel) tableParams.getModel(); | ||
model.addRow(model.getRowCount(), "", ""); | ||
// Scroll to the added row | ||
int row = model.getRowCount() - 1; | ||
table.scrollRectToVisible(table.getCellRect(row, 0, true)); | ||
tableParams.scrollRectToVisible(tableParams.getCellRect(row, 0, true)); | ||
|
||
// Request focus on the added row's first cell | ||
table.requestFocus(); | ||
table.changeSelection(row, 0, false, false); | ||
table.editCellAt(row, 0); | ||
table.getEditorComponent().requestFocus(); | ||
tableParams.requestFocus(); | ||
tableParams.changeSelection(row, 0, false, false); | ||
tableParams.editCellAt(row, 0); | ||
tableParams.getEditorComponent().requestFocus(); | ||
|
||
// updating the table to show the new row | ||
getTable().updateUI(); | ||
tableParams.updateUI(); | ||
log.debug("DialogKeep - Added new keep parameter on the Dialog Command"); | ||
} | ||
} |
Oops, something went wrong.