mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* TablesPanel - Fixed that restoring of divider positions did not work properly.
This commit is contained in:
parent
50d6a84ad9
commit
84f67f1fcd
1 changed files with 26 additions and 7 deletions
|
@ -40,6 +40,8 @@ import java.awt.HeadlessException;
|
|||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
|
@ -51,6 +53,10 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JComponent;
|
||||
|
@ -59,6 +65,7 @@ import javax.swing.JInternalFrame;
|
|||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
|
@ -82,6 +89,7 @@ import mage.view.MatchView;
|
|||
import mage.view.TableView;
|
||||
import mage.view.UsersView;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.plugins.card.dl.beans.PropertyChangeSupport;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -104,7 +112,10 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
private Session session;
|
||||
private List<String> messages;
|
||||
private int currentMessage;
|
||||
|
||||
|
||||
private static final ScheduledExecutorService timeoutExecutor = Executors.newScheduledThreadPool(1);
|
||||
private ScheduledFuture<?> setDividerLocation;
|
||||
|
||||
/** Creates new form TablesPanel */
|
||||
public TablesPanel() {
|
||||
|
||||
|
@ -198,8 +209,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
};
|
||||
|
||||
Action closedTableAction;
|
||||
|
||||
Action closedTableAction;
|
||||
closedTableAction = new AbstractAction()
|
||||
{
|
||||
@Override
|
||||
|
@ -229,8 +239,8 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// adds action buttons to the table panel (don't delete this)
|
||||
new ButtonColumn(tableTables, openTableAction, TableTableModel.ACTION_COLUMN);
|
||||
new ButtonColumn(tableCompleted, closedTableAction, MatchesTableModel.ACTION_COLUMN);
|
||||
|
@ -269,6 +279,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, JComponent> getUIComponents() {
|
||||
Map<String, JComponent> components = new HashMap<>();
|
||||
|
||||
|
@ -368,7 +379,15 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
reloadMessages();
|
||||
|
||||
MageFrame.getUI().addButton(MageComponents.NEW_GAME_BUTTON, btnNewTable);
|
||||
this.restoreDividerLocations();
|
||||
|
||||
// divider locations have to be set with delay else values set are overwritten with system defaults
|
||||
setDividerLocation = timeoutExecutor.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
restoreDividerLocations();
|
||||
}
|
||||
}, 300, TimeUnit.MILLISECONDS);
|
||||
|
||||
}
|
||||
|
||||
protected void reloadMessages() {
|
||||
|
@ -680,7 +699,7 @@ private void chkShowCompletedActionPerformed(java.awt.event.ActionEvent evt) {//
|
|||
private javax.swing.JTable tableCompleted;
|
||||
private javax.swing.JTable tableTables;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
|
||||
}
|
||||
|
||||
class TableTableModel extends AbstractTableModel {
|
||||
|
|
Loading…
Reference in a new issue