|
|
@ -16,9 +16,13 @@ import com.fr.form.ui.CardSwitchButton; |
|
|
|
import com.fr.form.ui.container.cardlayout.WCardTagLayout; |
|
|
|
import com.fr.form.ui.container.cardlayout.WCardTagLayout; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
|
|
|
|
import com.fr.general.cardtag.DefaultTemplateStyle; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
import javax.swing.Icon; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
|
|
|
import java.awt.Graphics; |
|
|
|
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
|
|
|
|
|
|
|
public class XCardAddButton extends XButton{ |
|
|
|
public class XCardAddButton extends XButton{ |
|
|
@ -80,6 +84,7 @@ public class XCardAddButton extends XButton{ |
|
|
|
* @param e 点击事件 |
|
|
|
* @param e 点击事件 |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){ |
|
|
|
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){ |
|
|
|
FormDesigner designer = editingMouseListener.getDesigner(); |
|
|
|
FormDesigner designer = editingMouseListener.getDesigner(); |
|
|
|
designer.fireTargetModified(); |
|
|
|
designer.fireTargetModified(); |
|
|
@ -120,6 +125,7 @@ public class XCardAddButton extends XButton{ |
|
|
|
this.cardLayout = borderLayout.getCardPart(); |
|
|
|
this.cardLayout = borderLayout.getCardPart(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void paintComponent(Graphics g) { |
|
|
|
public void paintComponent(Graphics g) { |
|
|
|
super.paintComponent(g); |
|
|
|
super.paintComponent(g); |
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
@ -148,8 +154,14 @@ public class XCardAddButton extends XButton{ |
|
|
|
|
|
|
|
|
|
|
|
String cardLayoutName = cardLayout.toData().getWidgetName(); |
|
|
|
String cardLayoutName = cardLayout.toData().getWidgetName(); |
|
|
|
CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName); |
|
|
|
CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName); |
|
|
|
|
|
|
|
WCardTagLayout layout = (WCardTagLayout) this.tagLayout.toData(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!ComparatorUtils.equals(layout.getTemplateStyle().getStyle(), DefaultTemplateStyle.DEFAULT_TEMPLATE_STYLE)){ |
|
|
|
|
|
|
|
titleButton.setInitialBackground(layout.getTemplateStyle().getTabDefaultBackground()); |
|
|
|
|
|
|
|
titleButton.setCustomStyle(true); |
|
|
|
|
|
|
|
} |
|
|
|
//设置标题
|
|
|
|
//设置标题
|
|
|
|
titleButton.setText(getTabTitleName()); |
|
|
|
titleButton.setText(getTabTitleName(layout)); |
|
|
|
XCardSwitchButton showButton = new XCardSwitchButton(titleButton, dimension, cardLayout, tagLayout); |
|
|
|
XCardSwitchButton showButton = new XCardSwitchButton(titleButton, dimension, cardLayout, tagLayout); |
|
|
|
titleButton.setShowButton(true); |
|
|
|
titleButton.setShowButton(true); |
|
|
|
showButton.setBackupParent(tagLayout); |
|
|
|
showButton.setBackupParent(tagLayout); |
|
|
@ -168,8 +180,7 @@ public class XCardAddButton extends XButton{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//新增时去tabFitLayout名字中最大的Index+1,防止重名
|
|
|
|
//新增时去tabFitLayout名字中最大的Index+1,防止重名
|
|
|
|
private String getTabTitleName(){ |
|
|
|
private String getTabTitleName(WCardTagLayout layout){ |
|
|
|
WCardTagLayout layout = (WCardTagLayout) this.tagLayout.toData(); |
|
|
|
|
|
|
|
int size = layout.getWidgetCount(); |
|
|
|
int size = layout.getWidgetCount(); |
|
|
|
String prefix = Inter.getLocText("FR-Designer_Title"); |
|
|
|
String prefix = Inter.getLocText("FR-Designer_Title"); |
|
|
|
String newTextName = prefix + size; |
|
|
|
String newTextName = prefix + size; |
|
|
|