forked from fanruan/design
Browse Source
* commit '82ee6ddab09276b771a98fa301f92267f07b90c7': CHART-14664 宽度定长 CHART-12123 图表预定义配色 REPORT-34994 移动端表格折叠树接口(单元格属性设置接口)-设计器部分 ,表单报表块也需要这个配置 REPORT-34994 移动端表格折叠树接口(单元格属性设置接口)-设计器部分persist/11.0
superman
4 years ago
12 changed files with 379 additions and 64 deletions
@ -0,0 +1,23 @@
|
||||
package com.fr.design.cell; |
||||
|
||||
import com.fr.design.designer.TargetComponent; |
||||
import com.fr.design.dialog.BasicPane; |
||||
|
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* @author zack |
||||
* @version 10.0 |
||||
* Created by zack on 2020/7/14 |
||||
*/ |
||||
public abstract class AbstractCellElementPropertyPane extends BasicPane implements CellElementPropertyComponent { |
||||
@Override |
||||
public JPanel toPanel() { |
||||
return this; |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(TargetComponent tc) { |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,34 @@
|
||||
package com.fr.design.cell; |
||||
|
||||
import com.fr.design.designer.TargetComponent; |
||||
|
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* 单元格属性配置面板接口 |
||||
* @author zack |
||||
* @version 10.0 |
||||
* Created by zack on 2020/7/14 |
||||
*/ |
||||
public interface CellElementPropertyComponent { |
||||
|
||||
/** |
||||
* 判断当前编辑的对象是否显示当前实现 |
||||
* @param tc |
||||
* @return |
||||
*/ |
||||
boolean accept(TargetComponent tc); |
||||
|
||||
/** |
||||
* 加载数据 |
||||
* @param tc |
||||
*/ |
||||
void populate(TargetComponent tc); |
||||
|
||||
/** |
||||
* 返回当前属性面板,默认返回this |
||||
* @return |
||||
*/ |
||||
JPanel toPanel(); |
||||
|
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.design.cell.CellElementPropertyComponent; |
||||
|
||||
/** |
||||
* 单元格设置(属性)扩展接口 |
||||
* @author zack |
||||
* @version 10.0 |
||||
* Created by zack on 2020/7/14 |
||||
*/ |
||||
public interface CellPropertyPaneProvider extends PropertyItemPaneProvider { |
||||
|
||||
/** |
||||
* 构造单元格属性面板,面板实现需要使用单例模式实现 |
||||
* @return 面板类 |
||||
*/ |
||||
CellElementPropertyComponent getSingletonCelPropertyPane(); |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.fun.CellPropertyPaneProvider; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
/** |
||||
* Created by zhouping on 2015/11/11. |
||||
*/ |
||||
@API(level = CellPropertyPaneProvider.CURRENT_LEVEL) |
||||
public abstract class AbstractCellPropertyPaneProvider extends AbstractPropertyItemPaneProvider implements CellPropertyPaneProvider { |
||||
|
||||
public int currentAPILevel() { |
||||
return CellPropertyPaneProvider.CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,142 @@
|
||||
package com.fr.design.module; |
||||
|
||||
import com.fr.base.ChartColorMatching; |
||||
import com.fr.base.ChartPreStyleConfig; |
||||
import com.fr.base.Utils; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.JListControlPane; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.controlpane.ShortCut4JControlPane; |
||||
import com.fr.design.gui.ilist.ModNameActionListener; |
||||
import com.fr.design.menu.ShortCut; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.stable.Nameable; |
||||
|
||||
import javax.swing.event.ListSelectionEvent; |
||||
import javax.swing.event.ListSelectionListener; |
||||
import java.util.ArrayList; |
||||
import java.util.Iterator; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-07-08 |
||||
*/ |
||||
public class ChartPreStyleListPane extends JListControlPane { |
||||
|
||||
ChartPreStyleManagerPane chartPreStyleManagerPane; |
||||
|
||||
public ChartPreStyleListPane(ChartPreStyleManagerPane chartPreStyleManagerPane) { |
||||
super(); |
||||
this.chartPreStyleManagerPane = chartPreStyleManagerPane; |
||||
initListener(); |
||||
} |
||||
|
||||
/** |
||||
* 创建有名字的creator |
||||
* |
||||
* @return 有名字的creator数组 |
||||
*/ |
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
return new NameableCreator[]{ |
||||
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_PreStyle_Duplicate"), |
||||
ChartColorMatching.class, ChartPreStylePane.class) |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_PreStyle"); |
||||
} |
||||
|
||||
@Override |
||||
public BasicBeanPane createPaneByCreators(NameableCreator creator) { |
||||
return new ChartPreStylePane() { |
||||
@Override |
||||
protected void refreshWhenStyleChange(ChartColorMatching preStyle) { |
||||
super.refreshWhenStyleChange(preStyle); |
||||
chartPreStyleManagerPane.refreshDefaultColorBox(); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
|
||||
protected ShortCut4JControlPane[] createShortcuts() { |
||||
return new ShortCut4JControlPane[]{ |
||||
shortCutFactory.addItemShortCut(), |
||||
createRemoveItemShortCut(), |
||||
shortCutFactory.copyItemShortCut(), |
||||
shortCutFactory.moveUpItemShortCut(), |
||||
shortCutFactory.moveDownItemShortCut(), |
||||
shortCutFactory.sortItemShortCut() |
||||
}; |
||||
} |
||||
|
||||
private ShortCut4JControlPane createRemoveItemShortCut() { |
||||
ShortCut4JControlPane shortCut4JControlPane = shortCutFactory.removeItemShortCut(); |
||||
//替换删除按钮的check事件。
|
||||
ShortCut shortCut = shortCut4JControlPane.getShortCut(); |
||||
shortCut4JControlPane = new MoreThanOneShortCut(shortCut); |
||||
return shortCut4JControlPane; |
||||
} |
||||
|
||||
public void initListener() { |
||||
nameableList.addListSelectionListener(new ListSelectionListener() { |
||||
@Override |
||||
public void valueChanged(ListSelectionEvent e) { |
||||
chartPreStyleManagerPane.refreshDefaultColorBox(); |
||||
} |
||||
}); |
||||
nameableList.addModNameActionListener(new ModNameActionListener() { |
||||
@Override |
||||
public void nameModed(int index, String oldName, String newName) { |
||||
chartPreStyleManagerPane.refreshDefaultColorBox(oldName, newName); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public void populateBean() { |
||||
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance().mirror(); |
||||
ArrayList list = new ArrayList(); |
||||
|
||||
Iterator keys = config.names(); |
||||
while (keys.hasNext()) { |
||||
Object key = keys.next(); |
||||
ChartColorMatching value = (ChartColorMatching) config.getPreStyle(key); |
||||
|
||||
list.add(new NameObject(Utils.objectToString(key), value)); |
||||
} |
||||
|
||||
Nameable[] values = (Nameable[]) list.toArray(new Nameable[list.size()]); |
||||
populate(values); |
||||
|
||||
if (config.containsName(config.getCurrentStyle())) { |
||||
this.setSelectedName(config.getCurrentStyle()); |
||||
} |
||||
} |
||||
|
||||
public void updateBean() { |
||||
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); |
||||
|
||||
Nameable[] values = update(); |
||||
config.clearAllPreStyle(); |
||||
|
||||
for (Nameable value : values) { |
||||
config.putPreStyle(value.getName(), ((NameObject) value).getObject()); |
||||
} |
||||
} |
||||
|
||||
private class MoreThanOneShortCut extends ShortCut4JControlPane { |
||||
public MoreThanOneShortCut(ShortCut shortCut) { |
||||
this.shortCut = shortCut; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void checkEnable() { |
||||
this.shortCut.setEnabled(nameableList.getModel().getSize() > 1); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue