mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-13 21:29:31 +00:00
tidying
This commit is contained in:
parent
a9ce1d8d73
commit
25d2ccf950
|
@ -124,50 +124,37 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
||||||
{
|
{
|
||||||
int totalBlocks = disk.getTotalBlocks ();
|
int totalBlocks = disk.getTotalBlocks ();
|
||||||
|
|
||||||
switch (totalBlocks)
|
Dimension newGridLayout = switch (totalBlocks)
|
||||||
{
|
{
|
||||||
case 280:
|
case 280 -> new Dimension (8, 35);
|
||||||
gridLayout = new Dimension (8, 35);
|
case 455 -> new Dimension (13, 35);
|
||||||
break;
|
case 560 -> new Dimension (16, 35);
|
||||||
|
case 704 -> new Dimension (16, 44);
|
||||||
case 455:
|
case 768 -> new Dimension (16, 48);
|
||||||
gridLayout = new Dimension (13, 35);
|
case 800 -> new Dimension (8, 100);
|
||||||
break;
|
case 1600 ->
|
||||||
|
{
|
||||||
case 560:
|
|
||||||
gridLayout = new Dimension (16, 35);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 704:
|
|
||||||
gridLayout = new Dimension (16, 44);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 768:
|
|
||||||
gridLayout = new Dimension (16, 48);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1600:
|
|
||||||
if (disk.getBlocksPerTrack () == 32)
|
if (disk.getBlocksPerTrack () == 32)
|
||||||
gridLayout = new Dimension (disk.getBlocksPerTrack (), disk.getTotalTracks ());
|
yield new Dimension (32, 50);
|
||||||
else
|
else
|
||||||
gridLayout = new Dimension (16, 100);
|
yield new Dimension (16, 100);
|
||||||
break;
|
}
|
||||||
|
case 2048 -> new Dimension (8, 256);
|
||||||
case 2048:
|
case 3200 -> new Dimension (16, 200);
|
||||||
gridLayout = new Dimension (8, 256);
|
default ->
|
||||||
break;
|
{
|
||||||
|
|
||||||
default:
|
|
||||||
int[] sizes = { 32, 20, 16, 8 };
|
int[] sizes = { 32, 20, 16, 8 };
|
||||||
for (int size : sizes)
|
for (int size : sizes)
|
||||||
if ((totalBlocks % size) == 0)
|
if ((totalBlocks % size) == 0)
|
||||||
{
|
yield new Dimension (size, totalBlocks / size);
|
||||||
gridLayout = new Dimension (size, totalBlocks / size);
|
yield null;
|
||||||
break;
|
}
|
||||||
}
|
};
|
||||||
if (gridLayout == null)
|
|
||||||
System.out.println ("Unusable total blocks : " + totalBlocks);
|
if (newGridLayout == null)
|
||||||
}
|
System.out.println ("Unusable total blocks : " + totalBlocks);
|
||||||
|
else
|
||||||
|
gridLayout = newGridLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -328,7 +315,6 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
||||||
{
|
{
|
||||||
Enumeration<TreeNode> children = node.breadthFirstEnumeration ();
|
Enumeration<TreeNode> children = node.breadthFirstEnumeration ();
|
||||||
if (children != null)
|
if (children != null)
|
||||||
{
|
|
||||||
while (children.hasMoreElements ())
|
while (children.hasMoreElements ())
|
||||||
{
|
{
|
||||||
DefaultMutableTreeNode childNode =
|
DefaultMutableTreeNode childNode =
|
||||||
|
@ -336,16 +322,15 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
||||||
if (childNode.getUserObject ().toString ().indexOf (name) > 0)
|
if (childNode.getUserObject ().toString ().indexOf (name) > 0)
|
||||||
return childNode;
|
return childNode;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These routines just hand back the information that was created above, and
|
* These routines just hand back the information that was created above, and
|
||||||
* added to by the subclass.
|
* added to by the subclass.
|
||||||
*/
|
*/
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public SectorType getSectorType (int block)
|
public SectorType getSectorType (int block)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
|
|
@ -135,9 +135,10 @@ public class NuFX
|
||||||
// System.out.printf ("Files require: %d blocks%n", totalBlocks);
|
// System.out.printf ("Files require: %d blocks%n", totalBlocks);
|
||||||
|
|
||||||
// choose Volume Name
|
// choose Volume Name
|
||||||
String volumeName = "Disk.Browser";
|
String volumeName = "DiskBrowser";
|
||||||
int nameOffset = 0;
|
int nameOffset = 0;
|
||||||
if (paths.size () == 1)
|
|
||||||
|
if (paths.size () == 1) // exactly one directory path
|
||||||
{
|
{
|
||||||
String onlyPath = paths.get (0);
|
String onlyPath = paths.get (0);
|
||||||
int pos = onlyPath.indexOf ('/');
|
int pos = onlyPath.indexOf ('/');
|
||||||
|
@ -145,7 +146,7 @@ public class NuFX
|
||||||
volumeName = onlyPath;
|
volumeName = onlyPath;
|
||||||
else // use first component
|
else // use first component
|
||||||
volumeName = onlyPath.substring (0, pos);
|
volumeName = onlyPath.substring (0, pos);
|
||||||
nameOffset = volumeName.length () + 1;
|
nameOffset = volumeName.length () + 1; // skip volume name in all paths
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int diskSize : diskSizes) // in case we choose a size that is too small
|
for (int diskSize : diskSizes) // in case we choose a size that is too small
|
||||||
|
|
Loading…
Reference in New Issue
Block a user