|
|
@ -8,6 +8,8 @@ import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.CellBorderStyle; |
|
|
|
import com.fr.base.CellBorderStyle; |
|
|
|
import com.fr.base.Style; |
|
|
|
import com.fr.base.Style; |
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
|
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
|
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
import com.fr.design.foldablepane.UIExpandablePane; |
|
|
|
import com.fr.design.foldablepane.UIExpandablePane; |
|
|
|
import com.fr.design.gui.ibutton.UIToggleButton; |
|
|
|
import com.fr.design.gui.ibutton.UIToggleButton; |
|
|
|
import com.fr.design.gui.icombobox.LineComboBox; |
|
|
|
import com.fr.design.gui.icombobox.LineComboBox; |
|
|
@ -16,6 +18,7 @@ import com.fr.design.layout.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.style.color.NewColorSelectBox; |
|
|
|
import com.fr.design.style.color.NewColorSelectBox; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.CoreConstants; |
|
|
|
import com.fr.stable.CoreConstants; |
|
|
@ -24,12 +27,17 @@ import javax.swing.*; |
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
import java.util.HashSet; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author zhou |
|
|
|
* @author zhou |
|
|
|
* @since 2012-5-28下午6:22:04 |
|
|
|
* @since 2012-5-28下午6:22:04 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class BorderPane extends AbstractBasicStylePane { |
|
|
|
public class BorderPane extends AbstractBasicStylePane implements GlobalNameObserver { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton", |
|
|
|
|
|
|
|
"leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"}; |
|
|
|
private boolean insideMode = false; |
|
|
|
private boolean insideMode = false; |
|
|
|
|
|
|
|
|
|
|
|
private UIToggleButton topToggleButton; |
|
|
|
private UIToggleButton topToggleButton; |
|
|
@ -48,6 +56,7 @@ public class BorderPane extends AbstractBasicStylePane { |
|
|
|
private JPanel borderPanel; |
|
|
|
private JPanel borderPanel; |
|
|
|
private JPanel backgroundPanel; |
|
|
|
private JPanel backgroundPanel; |
|
|
|
private BackgroundPane backgroundPane; |
|
|
|
private BackgroundPane backgroundPane; |
|
|
|
|
|
|
|
private GlobalNameListener globalNameListener = null; |
|
|
|
|
|
|
|
|
|
|
|
public BorderPane() { |
|
|
|
public BorderPane() { |
|
|
|
this.initComponents(); |
|
|
|
this.initComponents(); |
|
|
@ -55,7 +64,7 @@ public class BorderPane extends AbstractBasicStylePane { |
|
|
|
|
|
|
|
|
|
|
|
protected void initComponents() { |
|
|
|
protected void initComponents() { |
|
|
|
initButtonsWithIcon(); |
|
|
|
initButtonsWithIcon(); |
|
|
|
this.setLayout(new BorderLayout(0, 6)); |
|
|
|
this.setLayout(new BorderLayout(0, 0)); |
|
|
|
JPanel externalPane = new JPanel(new GridLayout(0, 4)); |
|
|
|
JPanel externalPane = new JPanel(new GridLayout(0, 4)); |
|
|
|
externalPane.add(topToggleButton); |
|
|
|
externalPane.add(topToggleButton); |
|
|
|
externalPane.add(leftToggleButton); |
|
|
|
externalPane.add(leftToggleButton); |
|
|
@ -89,7 +98,7 @@ public class BorderPane extends AbstractBasicStylePane { |
|
|
|
backgroundPane = new BackgroundPane(); |
|
|
|
backgroundPane = new BackgroundPane(); |
|
|
|
backgroundPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Background"), 280, 24, backgroundPane); |
|
|
|
backgroundPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Background"), 280, 24, backgroundPane); |
|
|
|
this.add(backgroundPanel, BorderLayout.CENTER); |
|
|
|
this.add(backgroundPanel, BorderLayout.CENTER); |
|
|
|
|
|
|
|
initAllNames(); |
|
|
|
outerToggleButton.addChangeListener(outerToggleButtonChangeListener); |
|
|
|
outerToggleButton.addChangeListener(outerToggleButtonChangeListener); |
|
|
|
innerToggleButton.addChangeListener(innerToggleButtonChangeListener); |
|
|
|
innerToggleButton.addChangeListener(innerToggleButtonChangeListener); |
|
|
|
} |
|
|
|
} |
|
|
@ -125,6 +134,19 @@ public class BorderPane extends AbstractBasicStylePane { |
|
|
|
this.currentLineColorPane = new NewColorSelectBox(100); |
|
|
|
this.currentLineColorPane = new NewColorSelectBox(100); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initAllNames() { |
|
|
|
|
|
|
|
currentLineCombo.setGlobalName("currentLineCombo"); |
|
|
|
|
|
|
|
currentLineColorPane.setGlobalName("currentLineColorPane"); |
|
|
|
|
|
|
|
outerToggleButton.setGlobalName("outerToggleButton"); |
|
|
|
|
|
|
|
topToggleButton.setGlobalName("topToggleButton"); |
|
|
|
|
|
|
|
leftToggleButton.setGlobalName("leftToggleButton"); |
|
|
|
|
|
|
|
bottomToggleButton.setGlobalName("bottomToggleButton"); |
|
|
|
|
|
|
|
rightToggleButton.setGlobalName("rightToggleButton"); |
|
|
|
|
|
|
|
innerToggleButton.setGlobalName("innerToggleButton"); |
|
|
|
|
|
|
|
horizontalToggleButton.setGlobalName("horizontalToggleButton"); |
|
|
|
|
|
|
|
verticalToggleButton.setGlobalName("verticalToggleButton"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String title4PopupWindow() { |
|
|
|
public String title4PopupWindow() { |
|
|
|
return Inter.getLocText("FR-Designer_Cell"); |
|
|
|
return Inter.getLocText("FR-Designer_Cell"); |
|
|
@ -179,10 +201,13 @@ public class BorderPane extends AbstractBasicStylePane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
CellBorderStyle cellBorderStyle = this.update(); |
|
|
|
CellBorderStyle cellBorderStyle = this.update(); |
|
|
|
|
|
|
|
HashSet<String> borderSet = new HashSet<String>(Arrays.asList(BORDERARRAY)); |
|
|
|
|
|
|
|
if (borderSet.contains(globalNameListener.getGlobalName())) { |
|
|
|
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(), |
|
|
|
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(), |
|
|
|
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); |
|
|
|
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); |
|
|
|
|
|
|
|
} else { |
|
|
|
style = style.deriveBackground(backgroundPane.update()); |
|
|
|
style = style.deriveBackground(backgroundPane.update()); |
|
|
|
|
|
|
|
} |
|
|
|
return style; |
|
|
|
return style; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -204,4 +229,19 @@ public class BorderPane extends AbstractBasicStylePane { |
|
|
|
cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); |
|
|
|
cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); |
|
|
|
return cellBorderStyle; |
|
|
|
return cellBorderStyle; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void registerNameListener(GlobalNameListener listener) { |
|
|
|
|
|
|
|
globalNameListener = listener; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean shouldResponseNameListener() { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void setGlobalName(String name) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |