|
|
@ -3,7 +3,6 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package com.fr.design.mainframe.bbs; |
|
|
|
package com.fr.design.mainframe.bbs; |
|
|
|
|
|
|
|
|
|
|
|
import com.fine.theme.utils.FineUIScale; |
|
|
|
|
|
|
|
import com.fr.base.FRContext; |
|
|
|
import com.fr.base.FRContext; |
|
|
|
import com.fr.concurrent.NamedThreadFactory; |
|
|
|
import com.fr.concurrent.NamedThreadFactory; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
@ -29,6 +28,8 @@ import java.util.Date; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static com.fine.theme.utils.FineUIScale.scale; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author neil |
|
|
|
* @author neil |
|
|
@ -63,12 +64,11 @@ public class UserInfoPane extends BasicPane { |
|
|
|
* 构造函数 |
|
|
|
* 构造函数 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private UserInfoPane() { |
|
|
|
private UserInfoPane() { |
|
|
|
this.setPreferredSize(FineUIScale.scale(new Dimension(UIManager.getInt("North.userinfoLabel.width"), UIManager.getInt("North.userinfoLabel.height")))); |
|
|
|
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
|
|
|
|
|
|
|
|
this.userInfoLabel = new UserInfoLabel(this); |
|
|
|
this.userInfoLabel = new UserInfoLabel(this); |
|
|
|
Insets insets = UIManager.getInsets("North.userinfoLabel.borderMargins"); |
|
|
|
Insets insets = UIManager.getInsets("North.userinfoLabel.borderMargins"); |
|
|
|
Insets scaledInsets = FineUIScale.scale(insets); |
|
|
|
Insets scaledInsets = scale(insets); |
|
|
|
this.userInfoLabel.setBorder(BorderFactory.createEmptyBorder(scaledInsets.top, scaledInsets.left, scaledInsets.bottom, scaledInsets.right)); |
|
|
|
this.userInfoLabel.setBorder(BorderFactory.createEmptyBorder(scaledInsets.top, scaledInsets.left, scaledInsets.bottom, scaledInsets.right)); |
|
|
|
|
|
|
|
|
|
|
|
this.markUnSignIn(); |
|
|
|
this.markUnSignIn(); |
|
|
@ -105,6 +105,7 @@ public class UserInfoPane extends BasicPane { |
|
|
|
public void markUnSignIn() { |
|
|
|
public void markUnSignIn() { |
|
|
|
this.userInfoLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Login_Onclick")); |
|
|
|
this.userInfoLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Login_Onclick")); |
|
|
|
this.userInfoLabel.resetUserName(); |
|
|
|
this.userInfoLabel.resetUserName(); |
|
|
|
|
|
|
|
fitSize(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -115,6 +116,18 @@ public class UserInfoPane extends BasicPane { |
|
|
|
public void markSignIn(String userName) { |
|
|
|
public void markSignIn(String userName) { |
|
|
|
this.userInfoLabel.setText(userName); |
|
|
|
this.userInfoLabel.setText(userName); |
|
|
|
this.userInfoLabel.setUserName(userName); |
|
|
|
this.userInfoLabel.setUserName(userName); |
|
|
|
|
|
|
|
fitSize(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void fitSize() { |
|
|
|
|
|
|
|
int height = UIManager.getInt("North.userinfoLabel.height"); |
|
|
|
|
|
|
|
int maxWidth = UIManager.getInt("North.userinfoLabel.maxWidth"); |
|
|
|
|
|
|
|
int minWidth = UIManager.getInt("North.userinfoLabel.minWidth"); |
|
|
|
|
|
|
|
int labelWidth = userInfoLabel.getPreferredSize().width; |
|
|
|
|
|
|
|
// 自适应尺寸,并限制最大最小尺寸
|
|
|
|
|
|
|
|
int preferWidth = Math.min(Math.max(minWidth, labelWidth), maxWidth); |
|
|
|
|
|
|
|
Dimension fitDimension = scale(new Dimension(preferWidth, height)); |
|
|
|
|
|
|
|
setPreferredSize(fitDimension); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -199,6 +212,4 @@ public class UserInfoPane extends BasicPane { |
|
|
|
}); |
|
|
|
}); |
|
|
|
executorService.shutdown(); |
|
|
|
executorService.shutdown(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|