Skip to content

Commit

Permalink
Minor code cleanup
Browse files Browse the repository at this point in the history
See merge request main/Sumatra!1782

sumatra-commit: 85a86ce684747b15b3802ba38a9557d8b40241bd
  • Loading branch information
g3force authored and TIGERs GitLab committed Nov 21, 2023
1 parent 54fbfd0 commit 5e27fef
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ public void onDeleteLayout()
}


@Override
public void onRefreshLayoutItems()
{
refreshLayoutItems();
}


@Override
public void onLoadLayout(final String filename)
{
Expand All @@ -144,7 +137,7 @@ public void onLoadLayout(final String filename)
public void onExit()
{
GlobalShortcuts.removeAllForFrame(getMainFrame());

// ### Persist user settings
final Properties appProps = SumatraModel.getInstance().getUserSettings();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,50 +13,44 @@

/**
* MainFrame observer
*
*
* @author AndreR
*/
public interface IMainFrameObserver
{

/**
*
*/
*
*/
void onSaveLayout();


/**
*
*/
*
*/
void onDeleteLayout();


/**
*
*/
*
*/
void onExit();


/**
*
*
*/
default void onAbout()
{
}


/**
* @param filename
*/
void onLoadLayout(String filename);


/**
*
*/
void onRefreshLayoutItems();




/**
* @param info
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

package edu.tigers.sumatra.components;

import java.awt.Component;

import javax.swing.JScrollPane;
import java.awt.Component;


/**
Expand All @@ -18,36 +17,15 @@
public class BetterScrollPane extends JScrollPane
{
private static final int SCROLL_INCREMENT = 16;


public BetterScrollPane()
{
super();
changeDefaults();
}




public BetterScrollPane(Component component)
{
super(component);
changeDefaults();
}


public BetterScrollPane(int var1, int var2)
{
super(var1, var2);
changeDefaults();
}


public BetterScrollPane(Component component, int var2, int var3)
{
super(component, var2, var3);
changeDefaults();
}




private void changeDefaults()
{
this.getVerticalScrollBar().setUnitIncrement(SCROLL_INCREMENT); // change vertical scroll speed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
*/
package edu.tigers.sumatra.components;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.Serial;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
Expand All @@ -14,15 +22,6 @@
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


/**
Expand All @@ -34,6 +33,7 @@
*/
public class EnumCheckBoxPanel<T extends Enum<T>> extends BasePanel<EnumCheckBoxPanel.IEnumPanelObserver<T>>
{
@Serial
private static final long serialVersionUID = 5263861341015714105L;
private static final Logger log = LogManager.getLogger(EnumCheckBoxPanel.class);

Expand Down Expand Up @@ -99,7 +99,7 @@ private void createBoxes(final int orientation)
setLayout(new BoxLayout(this, orientation));

List<T> sortedEntries = Arrays.stream(enumClass.getEnumConstants())
.sorted(Comparator.comparing(Enum::toString)).collect(Collectors.toList());
.sorted(Comparator.comparing(Enum::toString)).toList();
for (T type : sortedEntries)
{
JCheckBox checkBox = new JCheckBox(getBoxLabel(type));
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ private void updateReplayTime()
updateEndTime();
if (playing)
{
replayCurTime += ((System.nanoTime() - replayLastTime) * speed);
replayCurTime += Math.round((System.nanoTime() - replayLastTime) * speed);
if (replayCurTime < 0)
{
replayCurTime = 0;
Expand Down

0 comments on commit 5e27fef

Please sign in to comment.