|
|
@ -11,8 +11,11 @@ import com.fr.design.designer.creator.cardlayout.XWCardLayout; |
|
|
|
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; |
|
|
|
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; |
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
|
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
|
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
|
|
|
|
import com.fr.design.event.UIObserver; |
|
|
|
|
|
|
|
import com.fr.design.event.UIObserverListener; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
|
|
|
|
import com.fr.design.gui.ispinner.UISpinner; |
|
|
|
import com.fr.design.gui.ispinner.UISpinner; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.mainframe.FormDesigner; |
|
|
|
import com.fr.design.mainframe.FormDesigner; |
|
|
@ -81,7 +84,8 @@ public class WidgetBoundPane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
|
|
|
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
|
|
|
if (jTemplate.isJWorkBook() || !((JForm)jTemplate).isSelectRootPane()) { |
|
|
|
if (jTemplate.isJWorkBook() || !((JForm)jTemplate).isSelectRootPane()) { |
|
|
|
ratioLockedButton = new AspectRatioLockedButton(width, height, creator); |
|
|
|
ratioLockedButton = new AspectRatioLockedButton(width, height); |
|
|
|
|
|
|
|
ratioLockedButton.setGlobalName(i18nText("Fine-Design_Form_Coords_And_Size")); |
|
|
|
ratioLockedButton.setLockEnabled(false); |
|
|
|
ratioLockedButton.setLockEnabled(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -121,7 +125,7 @@ public class WidgetBoundPane extends BasicPane { |
|
|
|
limitHeight(wabs, h, bounds, rec); |
|
|
|
limitHeight(wabs, h, bounds, rec); |
|
|
|
} |
|
|
|
} |
|
|
|
if (ratioLockedButton != null) { |
|
|
|
if (ratioLockedButton != null) { |
|
|
|
ratioLockedButton.setLocked(creator.toData().isAspectRatioLocked()); |
|
|
|
ratioLockedButton.update(creator); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -191,21 +195,24 @@ public class WidgetBoundPane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected static class AspectRatioLockedButton extends UIButton { |
|
|
|
protected static class AspectRatioLockedButton extends JButton implements UIObserver, GlobalNameObserver { |
|
|
|
|
|
|
|
|
|
|
|
private final Icon enabledLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_lock_enabled.png"); |
|
|
|
private final Icon enabledLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_lock_enabled.png"); |
|
|
|
private final Icon disabledLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_lock_disabled.png"); |
|
|
|
private final Icon disabledLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_lock_disabled.png"); |
|
|
|
private final Icon enabledUnLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_unlock_enabled.png"); |
|
|
|
private final Icon enabledUnLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_unlock_enabled.png"); |
|
|
|
private final Icon disabledUnLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_unlock_disabled.png"); |
|
|
|
private final Icon disabledUnLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_unlock_disabled.png"); |
|
|
|
|
|
|
|
|
|
|
|
private UISpinner mWidthSpinner; |
|
|
|
private UIObserverListener uiObserverListener; |
|
|
|
private UISpinner mHeightSpinner; |
|
|
|
private GlobalNameListener globalNameListener; |
|
|
|
private XCreator mCreator; |
|
|
|
private String globalName = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final UISpinner mWidthSpinner; |
|
|
|
|
|
|
|
private final UISpinner mHeightSpinner; |
|
|
|
|
|
|
|
|
|
|
|
protected double width4Backup = 0; |
|
|
|
protected double width4Backup = 0; |
|
|
|
protected double height4Backup = 0; |
|
|
|
protected double height4Backup = 0; |
|
|
|
|
|
|
|
|
|
|
|
public AspectRatioLockedButton(UISpinner widthSpinner, UISpinner heightSpinner, XCreator creator) { |
|
|
|
public AspectRatioLockedButton(UISpinner widthSpinner, UISpinner heightSpinner) { |
|
|
|
setUI(new BasicButtonUI()); |
|
|
|
setUI(new BasicButtonUI()); |
|
|
|
setBorderPainted(false); |
|
|
|
setBorderPainted(false); |
|
|
|
setBorder(null); |
|
|
|
setBorder(null); |
|
|
@ -214,25 +221,25 @@ public class WidgetBoundPane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
this.mWidthSpinner = widthSpinner; |
|
|
|
this.mWidthSpinner = widthSpinner; |
|
|
|
this.mHeightSpinner = heightSpinner; |
|
|
|
this.mHeightSpinner = heightSpinner; |
|
|
|
this.mCreator = creator; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addActionListener(new ActionListener() { |
|
|
|
addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
setSelected(!isSelected()); |
|
|
|
// 改变图标icon
|
|
|
|
} |
|
|
|
setLocked(!isLocked()); |
|
|
|
}); |
|
|
|
|
|
|
|
addChangeListener(new ChangeListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
|
|
|
|
mCreator.toData().setAspectRatioLocked(isLocked()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setToolTipText(isLockEnabled() ? null : i18nText("Fine-Design_Form_Widget_Lock_Aspect_Ratio_Button_ToolTip")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isLocked() && isLockEnabled()) { |
|
|
|
if (isLocked() && isLockEnabled()) { |
|
|
|
width4Backup = mWidthSpinner.getValue(); |
|
|
|
width4Backup = mWidthSpinner.getValue(); |
|
|
|
height4Backup = mHeightSpinner.getValue(); |
|
|
|
height4Backup = mHeightSpinner.getValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (globalNameListener != null) { |
|
|
|
|
|
|
|
globalNameListener.setGlobalName(globalName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uiObserverListener != null) { |
|
|
|
|
|
|
|
uiObserverListener.doChange(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -285,15 +292,44 @@ public class WidgetBoundPane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
public void setLockEnabled(boolean enabled) { |
|
|
|
public void setLockEnabled(boolean enabled) { |
|
|
|
this.setEnabled(enabled); |
|
|
|
this.setEnabled(enabled); |
|
|
|
|
|
|
|
setToolTipText(isLockEnabled() ? null : i18nText("Fine-Design_Form_Widget_Lock_Aspect_Ratio_Button_ToolTip")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void populate(XCreator creator) { |
|
|
|
public void populate(XCreator creator) { |
|
|
|
Rectangle bounds = new Rectangle(creator.getBounds()); |
|
|
|
Rectangle bounds = new Rectangle(creator.getBounds()); |
|
|
|
mCreator = creator; |
|
|
|
|
|
|
|
width4Backup = bounds.width; |
|
|
|
width4Backup = bounds.width; |
|
|
|
height4Backup = bounds.height; |
|
|
|
height4Backup = bounds.height; |
|
|
|
Widget widget = creator.toData(); |
|
|
|
Widget widget = creator.toData(); |
|
|
|
setLocked(widget.isAspectRatioLocked()); |
|
|
|
setLocked(widget.isAspectRatioLocked()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void update(XCreator creator) { |
|
|
|
|
|
|
|
creator.toData().setAspectRatioLocked(this.isLocked()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void registerChangeListener(UIObserverListener listener) { |
|
|
|
|
|
|
|
uiObserverListener = listener; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean shouldResponseChangeListener() { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void registerNameListener(GlobalNameListener listener) { |
|
|
|
|
|
|
|
this.globalNameListener = listener; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean shouldResponseNameListener() { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void setGlobalName(String name) { |
|
|
|
|
|
|
|
this.globalName = name; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|