Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i_395 scoring properties settings now on main page #910

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/edu/csus/ecs/pc2/ui/ContestInformationPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,9 @@ private JPanel getJudgingSettingsPane() {
judgeSettingsPane = new JPanel();

judgeSettingsPane.setAlignmentX(LEFT_ALIGNMENT);
judgeSettingsPane.setMaximumSize(new Dimension(800, 400));
judgeSettingsPane.setMinimumSize(new Dimension(800, 400));
judgeSettingsPane.setPreferredSize(new Dimension(800,350));
judgeSettingsPane.setMaximumSize(new Dimension(800, 425));
judgeSettingsPane.setMinimumSize(new Dimension(800, 425));
judgeSettingsPane.setPreferredSize(new Dimension(800,375));

if (showPaneOutlines) {

Expand Down Expand Up @@ -1328,7 +1328,7 @@ public void actionPerformed(java.awt.event.ActionEvent e) {
*/
private JTextField getJudgesDefaultAnswerTextField() {
if (judgesDefaultAnswerTextField == null) {
judgesDefaultAnswerTextField = new JTextField(40);
judgesDefaultAnswerTextField = new JTextField(50);
judgesDefaultAnswerTextField.setText("");
// judgesDefaultAnswerTextField.setSize(new Dimension(280, 29));
// judgesDefaultAnswerTextField.setLocation(new Point(208, 214));
Expand Down
24 changes: 24 additions & 0 deletions src/edu/csus/ecs/pc2/ui/MCLB.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,31 @@ public void run() {
public void autoSizeAllColumns() {
autoSizeAllColumns(this);
}
/**
* Sets column size
* @param columnNum index of a column from left to right (0-indexed)
* @param length in pixels
*/
public void setColumnSize(int columnNum,int length) {
final MCLB theBox = this;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
theBox.getColumnInfo(columnNum).setWidth(length);
}
});
}

public void setResizable (boolean resizable) {
final MCLB theBox = this;

SwingUtilities.invokeLater(new Runnable() {
public void run() {
for (int i = 0; i < theBox.getColumnCount(); i++) {
theBox.getColumnInfo(i).setResizable(resizable);
}
}
});
}
/**
* Set sorter for column in listbox.
*
Expand Down
19 changes: 12 additions & 7 deletions src/edu/csus/ecs/pc2/ui/ScoringPropertiesPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class ScoringPropertiesPane extends JPanel {

private JButton cancelButton;

private int lengthOfColumns;

public ScoringPropertiesPane(JButton updateButtona,JButton cancelButtona) {
super();
updateButton = updateButtona;
Expand All @@ -45,14 +47,16 @@ public ScoringPropertiesPane(JButton updateButtona,JButton cancelButtona) {

private void initialize() {
this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(275, 185));
this.setPreferredSize(new Dimension(350, 200));
this.add(getPropertyListBox(), BorderLayout.CENTER);
this.lengthOfColumns = 167;


}

protected void updateProperties(Properties properties) {
propertyUpdater.updateProperties(properties);
propertyListBox.removeAllRows(); //WHYY??
propertyListBox.removeAllRows();

}

Expand All @@ -69,8 +73,10 @@ private MCLB getPropertyListBox() {
HeapSorter sorter = new HeapSorter();
propertyListBox.setColumnSorter(1, sorter, 1);

propertyListBox.autoSizeAllColumns();

propertyListBox.setColumnSize(0,this.lengthOfColumns);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using "this." here to refer to the member lengthOfColumns?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I pickup that habit in Python. Java implicitly adds preprends that i think so as you suggest, there is no need for that here.

propertyListBox.setColumnSize(1,this.lengthOfColumns);
propertyListBox.setResizable(false);

propertyListBox.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent e) {
enableButtons();
Expand Down Expand Up @@ -115,7 +121,8 @@ protected void refreshProperties() {
propertyListBox.addRow(objects);
}

propertyListBox.autoSizeAllColumns();
propertyListBox.setColumnSize(0,this.lengthOfColumns);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. Why are you using "this." ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I pickup that habit in Python. Java implicitly adds preprends that i think so as you suggest, there is no need for that here.

propertyListBox.setColumnSize(1,this.lengthOfColumns);

enableButtons();
}
Expand All @@ -140,10 +147,8 @@ public Properties getProperties() {
private JTextField createJTextField(String text, boolean passwordField) {
JTextField textField = new JTextField();
textField.setText(text);

textField.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent e) {
propertyListBox.autoSizeAllColumns();
enableButtons();
}
});
Expand Down