Reformat to code style.
This commit is contained in:
@@ -8,10 +8,10 @@ description = 'Master Password GUI'
|
||||
mainClassName = 'com.lyndir.masterpassword.gui.GUI'
|
||||
|
||||
dependencies {
|
||||
compile project(':masterpassword-model')
|
||||
compile project( ':masterpassword-model' )
|
||||
|
||||
compile group: 'ch.qos.logback', name: 'logback-classic', version:'1.1.2'
|
||||
compile group: 'com.yuvimasory', name: 'orange-extensions', version:'1.3.0'
|
||||
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
|
||||
compile group: 'com.yuvimasory', name: 'orange-extensions', version: '1.3.0'
|
||||
}
|
||||
|
||||
run {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<!-- PROJECT METADATA -->
|
||||
@@ -116,8 +117,10 @@
|
||||
<keypass>${env.PASSWORD}</keypass>
|
||||
<alias>masterpassword-desktop</alias>
|
||||
<arguments>
|
||||
<argument>-sigalg</argument><argument>MD5withRSA</argument>
|
||||
<argument>-digestalg</argument><argument>SHA1</argument>
|
||||
<argument>-sigalg</argument>
|
||||
<argument>MD5withRSA</argument>
|
||||
<argument>-digestalg</argument>
|
||||
<argument>SHA1</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@@ -16,7 +16,6 @@
|
||||
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
|
||||
//==============================================================================
|
||||
|
||||
|
||||
package com.lyndir.masterpassword.gui;
|
||||
|
||||
import com.google.common.base.*;
|
||||
@@ -45,8 +44,8 @@ public class GUI implements UnlockFrame.SignInCallback {
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
private static final Logger logger = Logger.get( GUI.class );
|
||||
|
||||
private final UnlockFrame unlockFrame = new UnlockFrame( this );
|
||||
private PasswordFrame<?, ?> passwordFrame;
|
||||
private final UnlockFrame unlockFrame = new UnlockFrame( this );
|
||||
private PasswordFrame<?, ?> passwordFrame;
|
||||
|
||||
public static void main(final String... args) {
|
||||
if (Config.get().checkForUpdates())
|
||||
@@ -54,7 +53,7 @@ public class GUI implements UnlockFrame.SignInCallback {
|
||||
|
||||
// Try and set the system look & feel, if available.
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
|
||||
}
|
||||
catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException ignored) {
|
||||
}
|
||||
@@ -67,7 +66,8 @@ public class GUI implements UnlockFrame.SignInCallback {
|
||||
|
||||
else // No special platform handling.
|
||||
new GUI().open();
|
||||
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
|
||||
}
|
||||
catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
|
||||
throw logger.bug( e );
|
||||
}
|
||||
}
|
||||
@@ -77,14 +77,14 @@ public class GUI implements UnlockFrame.SignInCallback {
|
||||
Enumeration<URL> manifestURLs = Thread.currentThread().getContextClassLoader().getResources( JarFile.MANIFEST_NAME );
|
||||
while (manifestURLs.hasMoreElements()) {
|
||||
InputStream manifestStream = manifestURLs.nextElement().openStream();
|
||||
Attributes attributes = new Manifest( manifestStream ).getMainAttributes();
|
||||
Attributes attributes = new Manifest( manifestStream ).getMainAttributes();
|
||||
if (!GUI.class.getCanonicalName().equals( attributes.getValue( Attributes.Name.MAIN_CLASS ) ))
|
||||
continue;
|
||||
|
||||
String manifestRevision = attributes.getValue( Attributes.Name.IMPLEMENTATION_VERSION );
|
||||
String upstreamRevisionURL = "https://masterpasswordapp.com/masterpassword-gui.jar.rev";
|
||||
CharSource upstream = Resources.asCharSource( URI.create( upstreamRevisionURL ).toURL(), Charsets.UTF_8 );
|
||||
String upstreamRevision = upstream.readFirstLine();
|
||||
String manifestRevision = attributes.getValue( Attributes.Name.IMPLEMENTATION_VERSION );
|
||||
String upstreamRevisionURL = "https://masterpasswordapp.com/masterpassword-gui.jar.rev";
|
||||
CharSource upstream = Resources.asCharSource( URI.create( upstreamRevisionURL ).toURL(), Charsets.UTF_8 );
|
||||
String upstreamRevision = upstream.readFirstLine();
|
||||
if ((manifestRevision != null) && (upstreamRevision != null) && !manifestRevision.equalsIgnoreCase( upstreamRevision )) {
|
||||
logger.inf( "Local Revision: <%s>", manifestRevision );
|
||||
logger.inf( "Upstream Revision: <%s>", upstreamRevision );
|
||||
|
@@ -50,10 +50,10 @@ import org.jetbrains.annotations.NonNls;
|
||||
@SuppressWarnings("HardcodedFileSeparator")
|
||||
public abstract class Res {
|
||||
|
||||
private static final int AVATAR_COUNT = 19;
|
||||
private static final int AVATAR_COUNT = 19;
|
||||
private static final Map<Window, ScheduledExecutorService> executorByWindow = new WeakHashMap<>();
|
||||
private static final Logger logger = Logger.get( Res.class );
|
||||
private static final Colors colors = new Colors();
|
||||
private static final Logger logger = Logger.get( Res.class );
|
||||
private static final Colors colors = new Colors();
|
||||
|
||||
public static Future<?> execute(final Window host, final Runnable job) {
|
||||
return schedule( host, job, 0, TimeUnit.MILLISECONDS );
|
||||
@@ -203,8 +203,8 @@ public abstract class Res {
|
||||
|
||||
private static Font font(@NonNls final String fontResourceName) {
|
||||
Map<String, SoftReference<Font>> fontsByResourceName = Maps.newHashMap();
|
||||
SoftReference<Font> fontRef = fontsByResourceName.get( fontResourceName );
|
||||
Font font = (fontRef == null)? null: fontRef.get();
|
||||
SoftReference<Font> fontRef = fontsByResourceName.get( fontResourceName );
|
||||
Font font = (fontRef == null)? null: fontRef.get();
|
||||
if (font == null)
|
||||
try {
|
||||
fontsByResourceName.put( fontResourceName, new SoftReference<>(
|
||||
@@ -223,8 +223,8 @@ public abstract class Res {
|
||||
|
||||
private static final class RetinaIcon extends ImageIcon {
|
||||
|
||||
private static final Pattern scalePattern = Pattern.compile( ".*@(\\d+)x.[^.]+$" );
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Pattern scalePattern = Pattern.compile( ".*@(\\d+)x.[^.]+$" );
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final float scale;
|
||||
|
||||
@@ -265,10 +265,10 @@ public abstract class Res {
|
||||
public synchronized void paintIcon(final Component c, final Graphics g, final int x, final int y) {
|
||||
ImageObserver observer = ifNotNullElse( getImageObserver(), c );
|
||||
|
||||
Image image = getImage();
|
||||
int width = image.getWidth( observer );
|
||||
int height = image.getHeight( observer );
|
||||
Graphics2D g2d = (Graphics2D) g.create( x, y, width, height );
|
||||
Image image = getImage();
|
||||
int width = image.getWidth( observer );
|
||||
int height = image.getHeight( observer );
|
||||
Graphics2D g2d = (Graphics2D) g.create( x, y, width, height );
|
||||
|
||||
g2d.scale( 1 / scale, 1 / scale );
|
||||
g2d.drawImage( image, 0, 0, observer );
|
||||
|
@@ -17,7 +17,6 @@
|
||||
//==============================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @author lhunath, 15-02-04
|
||||
*/
|
||||
|
||||
|
@@ -17,7 +17,6 @@
|
||||
//==============================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @author lhunath, 15-02-04
|
||||
*/
|
||||
|
||||
|
@@ -117,8 +117,8 @@ public abstract class Components {
|
||||
}
|
||||
|
||||
public static Component stud() {
|
||||
Dimension studDimension = new Dimension( 8, 8 );
|
||||
Box.Filler rigidArea = new Box.Filler( studDimension, studDimension, studDimension );
|
||||
Dimension studDimension = new Dimension( 8, 8 );
|
||||
Box.Filler rigidArea = new Box.Filler( studDimension, studDimension, studDimension );
|
||||
rigidArea.setAlignmentX( Component.LEFT_ALIGNMENT );
|
||||
rigidArea.setAlignmentY( Component.BOTTOM_ALIGNMENT );
|
||||
rigidArea.setBackground( Color.red );
|
||||
|
@@ -17,7 +17,6 @@
|
||||
//==============================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @author lhunath, 15-02-04
|
||||
*/
|
||||
|
||||
|
@@ -81,7 +81,7 @@ public class IncognitoAuthenticationPanel extends AuthenticationPanel<IncognitoU
|
||||
|
||||
@Override
|
||||
public PasswordFrame<IncognitoUser, ?> newPasswordFrame() {
|
||||
return new PasswordFrame<IncognitoUser, IncognitoSite>(getSelectedUser()) {
|
||||
return new PasswordFrame<IncognitoUser, IncognitoSite>( getSelectedUser() ) {
|
||||
@Override
|
||||
protected IncognitoSite createSite(final IncognitoUser user, final String siteName, final UnsignedInteger siteCounter,
|
||||
final MPResultType resultType,
|
||||
|
@@ -43,12 +43,12 @@ import javax.swing.plaf.metal.MetalComboBoxEditor;
|
||||
public class ModelAuthenticationPanel extends AuthenticationPanel<MPFileUser> implements ItemListener, ActionListener, DocumentListener {
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
private static final Logger logger = Logger.get( ModelAuthenticationPanel.class );
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger logger = Logger.get( ModelAuthenticationPanel.class );
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final JComboBox<MPFileUser> userField;
|
||||
private final JLabel masterPasswordLabel;
|
||||
private final JPasswordField masterPasswordField;
|
||||
private final JLabel masterPasswordLabel;
|
||||
private final JPasswordField masterPasswordField;
|
||||
|
||||
public ModelAuthenticationPanel(final UnlockFrame unlockFrame) {
|
||||
super( unlockFrame );
|
||||
@@ -170,9 +170,10 @@ public class ModelAuthenticationPanel extends AuthenticationPanel<MPFileUser> im
|
||||
return;
|
||||
|
||||
if (JOptionPane.showConfirmDialog( ModelAuthenticationPanel.this, //
|
||||
strf( "Are you sure you want to delete the user and sites remembered for:\n%s.",
|
||||
deleteUser.getFullName() ), //
|
||||
"Delete User", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE ) == JOptionPane.CANCEL_OPTION)
|
||||
strf( "Are you sure you want to delete the user and sites remembered for:\n%s.",
|
||||
deleteUser.getFullName() ), //
|
||||
"Delete User", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE )
|
||||
== JOptionPane.CANCEL_OPTION)
|
||||
return;
|
||||
|
||||
MPFileUserManager.get().deleteUser( deleteUser );
|
||||
@@ -205,9 +206,10 @@ public class ModelAuthenticationPanel extends AuthenticationPanel<MPFileUser> im
|
||||
|
||||
@Override
|
||||
public PasswordFrame<MPFileUser, MPFileSite> newPasswordFrame() {
|
||||
return new PasswordFrame<MPFileUser, MPFileSite>(getSelectedUser()) {
|
||||
return new PasswordFrame<MPFileUser, MPFileSite>( getSelectedUser() ) {
|
||||
@Override
|
||||
protected MPFileSite createSite(final MPFileUser user, final String siteName, final UnsignedInteger siteCounter, final MPResultType resultType,
|
||||
protected MPFileSite createSite(final MPFileUser user, final String siteName, final UnsignedInteger siteCounter,
|
||||
final MPResultType resultType,
|
||||
final MPMasterKey.Version algorithmVersion) {
|
||||
return new MPFileSite( user, siteName, siteCounter, resultType, algorithmVersion );
|
||||
}
|
||||
|
@@ -44,10 +44,10 @@ public class UnlockFrame extends JFrame {
|
||||
private final JLabel identiconLabel;
|
||||
private final JButton signInButton;
|
||||
private final JPanel authenticationContainer;
|
||||
private AuthenticationPanel<?> authenticationPanel;
|
||||
private AuthenticationPanel<?> authenticationPanel;
|
||||
private Future<?> identiconFuture;
|
||||
private boolean incognito;
|
||||
private MPUser<?> user;
|
||||
private MPUser<?> user;
|
||||
|
||||
public UnlockFrame(final SignInCallback signInCallback) {
|
||||
super( "Unlock Master Password" );
|
||||
@@ -170,7 +170,7 @@ public class UnlockFrame extends JFrame {
|
||||
SwingUtilities.invokeLater( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String fullName = (user == null)? "": user.getFullName();
|
||||
String fullName = (user == null)? "": user.getFullName();
|
||||
char[] masterPassword = authenticationPanel.getMasterPassword();
|
||||
|
||||
if (fullName.isEmpty() || (masterPassword.length == 0)) {
|
||||
@@ -187,9 +187,9 @@ public class UnlockFrame extends JFrame {
|
||||
}
|
||||
}, 300, TimeUnit.MILLISECONDS );
|
||||
|
||||
String fullName = (user == null)? "": user.getFullName();
|
||||
char[] masterPassword = authenticationPanel.getMasterPassword();
|
||||
boolean enabled = !fullName.isEmpty() && (masterPassword.length > 0);
|
||||
String fullName = (user == null)? "": user.getFullName();
|
||||
char[] masterPassword = authenticationPanel.getMasterPassword();
|
||||
boolean enabled = !fullName.isEmpty() && (masterPassword.length > 0);
|
||||
signInButton.setEnabled( enabled );
|
||||
|
||||
return enabled;
|
||||
|
Reference in New Issue
Block a user