1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-11 11:55:03 -05:00
filebot/source/net/sourceforge/tuned/ui/notification/Factor.java
Reinhard Pointner 0c674849d8 * refactored and simplified transfer api
* use more GlazedLists stuff (EventList, AutoCompleteSupport) and remove obsolete classes (SimpleListModel, TextCompletion)
* don't use SearchResultCache in EpisodeListClient (was only done for better ui interactions)
* removed caching from ResourceManager
* some improvements based on FindBugs warnings
* use args4j for improved argument parsing
* updated ant build script
* more general MessageBus/Handler (use Object as message type instead of string)
* ChecksumComputationService is not a singleton anymore
* TemporaryFolder is always recreated if it is deleted by the user, or another instance shutting down
* Notifications flicker less when one window is removed and the others are layouted
* lots of other refactoring
2008-07-30 22:37:01 +00:00

128 lines
1.5 KiB
Java

package net.sourceforge.tuned.ui.notification;
import javax.swing.SwingConstants;
class Factor implements SwingConstants {
public final double fx;
public final double fy;
public Factor(double fx, double fy) {
this.fx = fx;
this.fy = fy;
}
static Factor getOrientationFactor(int orientation) {
double fx = 0;
double fy = 0;
switch (orientation) {
case NORTH_WEST:
fx = 0;
fy = 0;
break;
case NORTH:
fx = 0.5;
fy = 0;
break;
case NORTH_EAST:
fx = 1;
fy = 0;
break;
case WEST:
fx = 0;
fy = 0.5;
break;
case EAST:
fx = 1;
fy = 0.5;
break;
case SOUTH_WEST:
fx = 0;
fy = 1;
break;
case SOUTH:
fx = 0.5;
fy = 1;
break;
case SOUTH_EAST:
fx = 1;
fy = 1;
break;
case CENTER:
fx = 0.5;
fy = 0.5;
}
return new Factor(fx, fy);
}
static Factor getDirectionFactor(int direction) {
double fx = 0;
double fy = 0;
switch (direction) {
case NORTH_WEST:
fx = -1;
fy = -1;
break;
case NORTH:
fx = 0;
fy = -1;
break;
case NORTH_EAST:
fx = 1;
fy = -1;
break;
case WEST:
fx = -1;
fy = 0;
break;
case EAST:
fx = 1;
fy = 0;
break;
case SOUTH_WEST:
fx = -1;
fy = 1;
break;
case SOUTH:
fx = 0;
fy = 1;
break;
case SOUTH_EAST:
fx = 1;
fy = 1;
break;
case CENTER:
fx = 0;
fy = 0;
}
return new Factor(fx, fy);
}
}