Before Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 418 B |
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 237 B After Width: | Height: | Size: 369 B |
After Width: | Height: | Size: 237 B |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 185 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 14 KiB |
@ -0,0 +1,69 @@ |
|||||||
|
|
||||||
|
apply plugin: 'java' |
||||||
|
tasks.withType(JavaCompile){ |
||||||
|
options.encoding = 'UTF-8' |
||||||
|
} |
||||||
|
//指定构建的jdk版本 |
||||||
|
sourceCompatibility=1.7 |
||||||
|
//指定生成jar包版本 |
||||||
|
version='8.0' |
||||||
|
//生成jar包重命名 |
||||||
|
jar{ |
||||||
|
baseName='fr-designer-core' |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
def srcDir="." |
||||||
|
def baseDir=".." |
||||||
|
|
||||||
|
//指定源码路径 |
||||||
|
sourceSets{ |
||||||
|
main{ |
||||||
|
java{ |
||||||
|
srcDirs=["${srcDir}/src"] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
//获取什么分支名 |
||||||
|
FileTree files =fileTree(dir:'./',include:'build.*.gradle') |
||||||
|
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) |
||||||
|
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) |
||||||
|
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) |
||||||
|
|
||||||
|
//声明外部依赖 |
||||||
|
dependencies{ |
||||||
|
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar') |
||||||
|
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar") |
||||||
|
testCompile 'junit:junit:4.12' |
||||||
|
} |
||||||
|
//复制非.java文件到classes文件夹下参与打包 |
||||||
|
task copyFile(type:Copy,dependsOn:compileJava){ |
||||||
|
copy{ |
||||||
|
from ("${srcDir}/src"){ |
||||||
|
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' |
||||||
|
} |
||||||
|
into 'build/classes/main' |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//压缩项目中的js文件 |
||||||
|
task compressJS{ |
||||||
|
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ |
||||||
|
classpath { |
||||||
|
fileset(dir:"../${baseDir}/lib4build",includes:'**/*.jar') |
||||||
|
} |
||||||
|
} |
||||||
|
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ |
||||||
|
fileset (dir:"${srcDir}/src"){ |
||||||
|
include (name:'**/*.js') |
||||||
|
include (name:'**/*.css') |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
jar.dependsOn compressJS |
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,53 @@ |
|||||||
|
package com.fr.aspectj.designerbase; |
||||||
|
|
||||||
|
import com.fr.design.DesignerEnvManager; |
||||||
|
import com.fr.design.actions.help.alphafine.AlphafineConfigManager; |
||||||
|
import com.fr.design.actions.help.alphafine.RemindDialog; |
||||||
|
import com.fr.design.mainframe.DesignerContext; |
||||||
|
|
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by XiaXiang on 2017/5/25. |
||||||
|
*/ |
||||||
|
public aspect AlphaFineReminder { |
||||||
|
pointcut onActionPerformed(ActionEvent e) : |
||||||
|
execution(* actionPerformed(ActionEvent)) && args(e); |
||||||
|
|
||||||
|
before(ActionEvent e) : onActionPerformed(e) { |
||||||
|
String point = thisJoinPoint.toString(); |
||||||
|
if (e != null && e.getSource().toString().contains("javax.swing.Timer")) { |
||||||
|
return; |
||||||
|
} |
||||||
|
if (e != null && e.getSource().getClass().getName().equals("com.fr.design.gui.imenu.UIMenuItem") && point.contains("com.fr.design.actions")) { |
||||||
|
remind(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 判断是否弹出广告框 |
||||||
|
*/ |
||||||
|
private static void remind() { |
||||||
|
AlphafineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphafineConfigManager(); |
||||||
|
|
||||||
|
if (manager.isNeedRemind()) { |
||||||
|
if (manager.getOperateCount() > 4) { |
||||||
|
showReminderDialog(); |
||||||
|
} else { |
||||||
|
manager.setOperateCount(manager.getOperateCount() + 1); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 弹框提醒使用AlphaFine |
||||||
|
*/ |
||||||
|
private static void showReminderDialog() { |
||||||
|
RemindDialog remindDialog = new RemindDialog(DesignerContext.getDesignerFrame()); |
||||||
|
remindDialog.setVisible(true); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.fr.common.inputevent; |
||||||
|
|
||||||
|
import com.fr.stable.OperatingSystem; |
||||||
|
|
||||||
|
import java.awt.event.KeyEvent; |
||||||
|
import java.awt.event.MouseEvent; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by hzzz on 2017/5/26. |
||||||
|
*/ |
||||||
|
public class InputEventBaseOnOS { |
||||||
|
private static final boolean IS_MACOS = OperatingSystem.isMacOS(); |
||||||
|
|
||||||
|
public static boolean isControlDown(MouseEvent e) { |
||||||
|
return IS_MACOS ? e.isMetaDown() : e.isControlDown(); |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean isControlDown(KeyEvent e) { |
||||||
|
return IS_MACOS ? e.isMetaDown() : e.isControlDown(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
package com.fr.design.actions.help.alphafine; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by XiaXiang on 2017/5/27. |
||||||
|
*/ |
||||||
|
public class AlphafineContext { |
||||||
|
private static List<AlphafineListener> fireLoginContextListener = new ArrayList<AlphafineListener>(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 触发AlphaFine弹窗 |
||||||
|
*/ |
||||||
|
public static void fireAlphaFineContextListener() { |
||||||
|
for (AlphafineListener l : fireLoginContextListener) { |
||||||
|
l.showDialog(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 添加一个弹出AlphaFine的监听事件 |
||||||
|
* |
||||||
|
* @param l AlphaFine框弹出监听事件 |
||||||
|
*/ |
||||||
|
public static void addAlphafineContextListener(AlphafineListener l) { |
||||||
|
fireLoginContextListener.add(l); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
package com.fr.design.actions.help.alphafine; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by XiaXiang on 2017/5/27. |
||||||
|
*/ |
||||||
|
public interface AlphafineListener { |
||||||
|
void showDialog(); |
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
package com.fr.design.actions.help.alphafine; |
||||||
|
|
||||||
|
import com.fr.design.DesignerEnvManager; |
||||||
|
import com.fr.design.dialog.UIDialog; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by XiaXiang on 2017/5/26. |
||||||
|
*/ |
||||||
|
public class RemindDialog extends UIDialog { |
||||||
|
private RemindPane remindPane; |
||||||
|
private static final int WIDTH = 600; |
||||||
|
private static final int HEIGHT = 400; |
||||||
|
public RemindDialog(Frame parent) { |
||||||
|
super(parent); |
||||||
|
setUndecorated(true); |
||||||
|
setSize(WIDTH, HEIGHT); |
||||||
|
initComponent(); |
||||||
|
GUICoreUtils.centerWindow(this); |
||||||
|
} |
||||||
|
|
||||||
|
private void initComponent() { |
||||||
|
final AlphafineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphafineConfigManager(); |
||||||
|
remindPane = new RemindPane(manager, this); |
||||||
|
this.add(remindPane); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void checkValid() throws Exception { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public RemindPane getRemindPane() { |
||||||
|
return remindPane; |
||||||
|
} |
||||||
|
|
||||||
|
public void setRemindPane(RemindPane remindPane) { |
||||||
|
this.remindPane = remindPane; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,146 @@ |
|||||||
|
package com.fr.design.actions.help.alphafine; |
||||||
|
|
||||||
|
import com.fr.design.dialog.UIDialog; |
||||||
|
import com.fr.design.gui.ibutton.UIButton; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.general.IOUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.MouseAdapter; |
||||||
|
import java.awt.event.MouseEvent; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by XiaXiang on 2017/5/26. |
||||||
|
*/ |
||||||
|
public class RemindPane extends JPanel { |
||||||
|
|
||||||
|
private UIButton openButton; |
||||||
|
private JPanel backgroundPane; |
||||||
|
private UILabel noRemindLabel; |
||||||
|
private UILabel checkLabel; |
||||||
|
private Icon checkIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/check.png"); |
||||||
|
private Icon unCheckIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/uncheck.png"); |
||||||
|
private Icon closeIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/remind_close.png"); |
||||||
|
private Icon labelIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/remind.png"); |
||||||
|
private Icon openIcon = IOUtils.readIcon("com/fr/design/mainframe/alphafine/images/open.png"); |
||||||
|
|
||||||
|
private static final int WIDTH = 600; |
||||||
|
private static final int HEIGHT = 400; |
||||||
|
private static final int CLOSE = 30; |
||||||
|
|
||||||
|
private static final Rectangle OPEN = new Rectangle(30, 300, 150, 40); |
||||||
|
private static final Rectangle REMIND = new Rectangle(95, 350, 100, 20); |
||||||
|
private static final Rectangle CHECK = new Rectangle(70, 350, 20, 20); |
||||||
|
public static final Font MEDIUM_FONT = new Font("Song_TypeFace", 0, 12); |
||||||
|
public static final Font LARGE_FONT = new Font("Song_TypeFace", 0, 18); |
||||||
|
|
||||||
|
public JComponent closeButton = new JComponent() { |
||||||
|
protected void paintComponent(Graphics g) { |
||||||
|
closeIcon.paintIcon(this, g, 0, 0); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
public RemindPane(AlphafineConfigManager manager, UIDialog remindDialog) { |
||||||
|
this.setPreferredSize(new Dimension(WIDTH, HEIGHT)); |
||||||
|
initUI(manager, remindDialog); |
||||||
|
this.setLayout(getAbsoluteLayout()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 初始化面板 |
||||||
|
* @param manager |
||||||
|
* @param dialog |
||||||
|
*/ |
||||||
|
private void initUI(final AlphafineConfigManager manager, final UIDialog dialog) { |
||||||
|
|
||||||
|
openButton = new UIButton(); |
||||||
|
openButton.setIcon(openIcon); |
||||||
|
openButton.set4ToolbarButton(); |
||||||
|
openButton.addMouseListener(new MouseAdapter() { |
||||||
|
@Override |
||||||
|
public void mousePressed(MouseEvent e) { |
||||||
|
manager.setOperateCount(0); |
||||||
|
dialog.dispose(); |
||||||
|
AlphafineContext.fireAlphaFineContextListener(); |
||||||
|
|
||||||
|
} |
||||||
|
}); |
||||||
|
noRemindLabel = new UILabel(Inter.getLocText("FR-Designer-Alphafine_No_Remind")); |
||||||
|
noRemindLabel.setFont(MEDIUM_FONT); |
||||||
|
noRemindLabel.setForeground(Color.white); |
||||||
|
checkLabel = new UILabel(); |
||||||
|
checkLabel.setIcon(unCheckIcon); |
||||||
|
checkLabel.addMouseListener(new MouseAdapter() { |
||||||
|
private boolean isCheck = false; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void mousePressed(MouseEvent e) { |
||||||
|
if (isCheck) { |
||||||
|
checkLabel.setIcon(unCheckIcon); |
||||||
|
manager.setNeedRemind(true); |
||||||
|
isCheck = false; |
||||||
|
} else { |
||||||
|
checkLabel.setIcon(checkIcon); |
||||||
|
manager.setNeedRemind(false); |
||||||
|
isCheck = true; |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
backgroundPane = new JPanel(new BorderLayout()); |
||||||
|
backgroundPane.add(new UILabel(labelIcon), BorderLayout.CENTER); |
||||||
|
closeButton.addMouseListener(new MouseAdapter() { |
||||||
|
@Override |
||||||
|
public void mousePressed(MouseEvent e) { |
||||||
|
manager.setOperateCount(0); |
||||||
|
dialog.dispose(); |
||||||
|
|
||||||
|
} |
||||||
|
}); |
||||||
|
add(closeButton, 0); |
||||||
|
add(checkLabel, 1); |
||||||
|
add(openButton, 2); |
||||||
|
add(noRemindLabel, 3); |
||||||
|
add(backgroundPane, 4); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 控件排列用绝对布局 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
protected LayoutManager getAbsoluteLayout() { |
||||||
|
return new LayoutManager() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void removeLayoutComponent(Component comp) { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Dimension preferredLayoutSize(Container parent) { |
||||||
|
return parent.getPreferredSize(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Dimension minimumLayoutSize(Container parent) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void layoutContainer(Container parent) { |
||||||
|
int width = parent.getWidth(); |
||||||
|
int height = parent.getHeight(); |
||||||
|
closeButton.setBounds((width - CLOSE), 0, CLOSE, CLOSE); |
||||||
|
openButton.setBounds(OPEN); |
||||||
|
noRemindLabel.setBounds(REMIND); |
||||||
|
checkLabel.setBounds(CHECK); |
||||||
|
backgroundPane.setBounds(0, 0, width, height); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void addLayoutComponent(String name, Component comp) { |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,311 +1,300 @@ |
|||||||
package com.fr.design.gui.ilist; |
package com.fr.design.gui.ilist; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import java.awt.Component; |
import com.fr.stable.StringUtils; |
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
import javax.swing.*; |
||||||
import java.awt.event.KeyAdapter; |
import javax.swing.border.Border; |
||||||
import java.awt.event.KeyEvent; |
import javax.swing.border.EmptyBorder; |
||||||
import java.awt.event.MouseAdapter; |
import java.awt.*; |
||||||
import java.awt.event.MouseEvent; |
import java.awt.event.*; |
||||||
import java.util.ArrayList; |
import java.util.ArrayList; |
||||||
import java.util.Arrays; |
import java.util.Arrays; |
||||||
import java.util.EventListener; |
import java.util.EventListener; |
||||||
import java.util.List; |
import java.util.List; |
||||||
|
|
||||||
import javax.swing.JComponent; |
|
||||||
import javax.swing.JList; |
|
||||||
import javax.swing.ListCellRenderer; |
|
||||||
import javax.swing.ListModel; |
|
||||||
import javax.swing.ListSelectionModel; |
|
||||||
import javax.swing.UIManager; |
|
||||||
import javax.swing.border.Border; |
|
||||||
import javax.swing.border.EmptyBorder; |
|
||||||
|
|
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
|
|
||||||
/** |
/** |
||||||
* CheckBoxs + JList. |
* CheckBoxs + JList. |
||||||
*/ |
*/ |
||||||
public class CheckBoxList extends JComponent { |
public class CheckBoxList extends JComponent { |
||||||
/** |
private final static int X_COORDINATE = 20; |
||||||
* 选择状态----全选和全不选 |
|
||||||
* |
/** |
||||||
* @editor zhou |
* 选择状态----全选和全不选 |
||||||
* @since 2012-4-1下午2:39:10 |
* |
||||||
*/ |
* @editor zhou |
||||||
public static enum SelectedState { |
* @since 2012-4-1下午2:39:10 |
||||||
ALL, NONE |
*/ |
||||||
} |
public static enum SelectedState { |
||||||
|
ALL, NONE |
||||||
private boolean[] selects; |
} |
||||||
private JList jlist; |
|
||||||
private UICheckBox chooseAll; |
private boolean[] selects; |
||||||
|
private JList jlist; |
||||||
public CheckBoxList(Object[] items) { |
private UICheckBox chooseAll; |
||||||
this(items, SelectedState.NONE, StringUtils.EMPTY); |
|
||||||
} |
public CheckBoxList(Object[] items) { |
||||||
|
this(items, SelectedState.NONE, StringUtils.EMPTY); |
||||||
public CheckBoxList(Object[] items, String name) { |
} |
||||||
this(items, SelectedState.NONE, name); |
|
||||||
} |
public CheckBoxList(Object[] items, String name) { |
||||||
|
this(items, SelectedState.NONE, name); |
||||||
/** |
} |
||||||
* Class constructor. |
|
||||||
* |
/** |
||||||
* @param items |
* Class constructor. |
||||||
* Items with which to populate the list. |
* |
||||||
* @param default_state |
* @param items Items with which to populate the list. |
||||||
* default state, true or false |
* @param state default state, true or false |
||||||
*/ |
*/ |
||||||
public CheckBoxList(Object[] items, SelectedState state, String name) { |
public CheckBoxList(Object[] items, SelectedState state, String name) { |
||||||
jlist = new BOXLIST(items); |
jlist = new BOXLIST(items); |
||||||
jlist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
jlist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
||||||
this.selects = new boolean[items.length]; |
this.selects = new boolean[items.length]; |
||||||
boolean default_state = (state == SelectedState.ALL); |
boolean default_state = (state == SelectedState.ALL); |
||||||
Arrays.fill(this.selects, default_state); |
Arrays.fill(this.selects, default_state); |
||||||
|
|
||||||
jlist.setCellRenderer(new CheckListCellRenderer()); |
jlist.setCellRenderer(new CheckListCellRenderer()); |
||||||
jlist.addMouseListener(new MouseAdapter() { |
jlist.addMouseListener(new MouseAdapter() { |
||||||
public void mousePressed(MouseEvent e) { |
public void mousePressed(MouseEvent e) { |
||||||
doCheck(); |
doCheck(); |
||||||
} |
} |
||||||
|
|
||||||
public void mouseReleased(MouseEvent e) { |
public void mouseReleased(MouseEvent e) { |
||||||
doCheck(); |
doCheck(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
jlist.addKeyListener(new KeyAdapter() { |
jlist.addKeyListener(new KeyAdapter() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void keyTyped(KeyEvent e) { |
public void keyTyped(KeyEvent e) { |
||||||
if (e.getKeyChar() == ' ') { |
if (e.getKeyChar() == ' ') { |
||||||
doCheck(); |
doCheck(); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
}); |
}); |
||||||
this.setLayout(new BorderLayout()); |
this.setLayout(new BorderLayout()); |
||||||
chooseAll = new UICheckBox(name, default_state); |
chooseAll = new UICheckBox(name, default_state); |
||||||
chooseAll.addActionListener(new ActionListener() { |
chooseAll.addActionListener(new ActionListener() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void actionPerformed(ActionEvent e) { |
public void actionPerformed(ActionEvent e) { |
||||||
if (chooseAll.isSelected()) { |
if (chooseAll.isSelected()) { |
||||||
setSelected(true); |
setSelected(true); |
||||||
} else { |
} else { |
||||||
setSelected(false); |
setSelected(false); |
||||||
} |
} |
||||||
} |
} |
||||||
}); |
}); |
||||||
this.add(chooseAll, BorderLayout.NORTH); |
this.add(chooseAll, BorderLayout.NORTH); |
||||||
this.add(jlist, BorderLayout.CENTER); |
this.add(jlist, BorderLayout.CENTER); |
||||||
} |
} |
||||||
|
|
||||||
/* |
/* |
||||||
* 用于CellRenderer显示value为text |
* 用于CellRenderer显示value为text |
||||||
*/ |
*/ |
||||||
protected String value2Text(Object value) { |
protected String value2Text(Object value) { |
||||||
return value != null ? value.toString() : StringUtils.EMPTY; |
return value != null ? value.toString() : StringUtils.EMPTY; |
||||||
} |
} |
||||||
|
|
||||||
public void setItems(Object[] os) { |
public void setItems(Object[] os) { |
||||||
if (os == null) { |
if (os == null) { |
||||||
this.setSelected(false); |
this.setSelected(false); |
||||||
} else { |
} else { |
||||||
for (int i = 0, len = os.length; i < len; i++) { |
for (int i = 0, len = os.length; i < len; i++) { |
||||||
Object o = os[i]; |
Object o = os[i]; |
||||||
for (int j = 0, jen = jlist.getModel().getSize(); j < jen; j++) { |
for (int j = 0, jen = jlist.getModel().getSize(); j < jen; j++) { |
||||||
if (o.equals(jlist.getModel().getElementAt(j))) { |
if (o.equals(jlist.getModel().getElementAt(j))) { |
||||||
this.setSelected(j, true); |
this.setSelected(j, true); |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
this.repaint(); |
this.repaint(); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* Is selected |
* Is selected |
||||||
*/ |
*/ |
||||||
public boolean isSelected(int index) { |
public boolean isSelected(int index) { |
||||||
if (selects == null || index >= selects.length) { |
if (selects == null || index >= selects.length) { |
||||||
return false; |
return false; |
||||||
} |
} |
||||||
|
|
||||||
return selects[index]; |
return selects[index]; |
||||||
} |
} |
||||||
|
|
||||||
public void setSelected(int index, boolean isSelected) { |
public void setSelected(int index, boolean isSelected) { |
||||||
if (selects == null || index >= selects.length) { |
if (selects == null || index >= selects.length) { |
||||||
return; |
return; |
||||||
} |
} |
||||||
|
|
||||||
selects[index] = isSelected; |
selects[index] = isSelected; |
||||||
this.repaint(this.getBounds()); |
this.repaint(this.getBounds()); |
||||||
|
|
||||||
this.fireCheckBoxListSelectionChangeListener(); |
this.fireCheckBoxListSelectionChangeListener(); |
||||||
} |
} |
||||||
|
|
||||||
private void setSelected(boolean isSelected) { |
private void setSelected(boolean isSelected) { |
||||||
if (selects == null) { |
if (selects == null) { |
||||||
return; |
return; |
||||||
} |
} |
||||||
for (int i = 0; i < selects.length; i++) { |
for (int i = 0; i < selects.length; i++) { |
||||||
selects[i] = isSelected; |
selects[i] = isSelected; |
||||||
} |
} |
||||||
this.repaint(this.getBounds()); |
this.repaint(this.getBounds()); |
||||||
|
|
||||||
this.fireCheckBoxListSelectionChangeListener(); |
this.fireCheckBoxListSelectionChangeListener(); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* Returns an array of the objects that have been selected. Overrides the |
* Returns an array of the objects that have been selected. Overrides the |
||||||
* JList method. |
* JList method. |
||||||
*/ |
*/ |
||||||
public Object[] getSelectedValues() { |
public Object[] getSelectedValues() { |
||||||
return this.jlist.getSelectedValues(); |
return this.jlist.getSelectedValues(); |
||||||
} |
} |
||||||
|
|
||||||
private class BOXLIST extends JList { |
private class BOXLIST extends JList { |
||||||
public BOXLIST(Object[] items) { |
public BOXLIST(Object[] items) { |
||||||
super(items); |
super(items); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void processMouseEvent(MouseEvent e) { |
protected void processMouseEvent(MouseEvent e) { |
||||||
if (e.getX() < 20) { |
if (e.getX() < X_COORDINATE) { |
||||||
if (e.isControlDown() || e.isAltDown() || e.isShiftDown() || e.isMetaDown()) { |
boolean anyMaskDown = e.isControlDown() || e.isAltDown() || e.isShiftDown() || e.isMetaDown(); |
||||||
int[] indices = getSelectedIndices(); |
if (anyMaskDown) { |
||||||
if (indices.length == 0) { |
int[] indices = getSelectedIndices(); |
||||||
super.processMouseEvent(e); |
if (indices.length == 0) { |
||||||
} |
super.processMouseEvent(e); |
||||||
} else { |
} |
||||||
super.processMouseEvent(e); |
} else { |
||||||
} |
super.processMouseEvent(e); |
||||||
} else { |
} |
||||||
super.processMouseEvent(e); |
} else { |
||||||
} |
super.processMouseEvent(e); |
||||||
int id = e.getID(); |
} |
||||||
switch (id) { |
int id = e.getID(); |
||||||
case MouseEvent.MOUSE_PRESSED: |
switch (id) { |
||||||
break; |
case MouseEvent.MOUSE_PRESSED: |
||||||
case MouseEvent.MOUSE_RELEASED: |
break; |
||||||
break; |
case MouseEvent.MOUSE_RELEASED: |
||||||
case MouseEvent.MOUSE_CLICKED: |
break; |
||||||
doCheck(); |
case MouseEvent.MOUSE_CLICKED: |
||||||
break; |
doCheck(); |
||||||
case MouseEvent.MOUSE_EXITED: |
break; |
||||||
break; |
case MouseEvent.MOUSE_EXITED: |
||||||
case MouseEvent.MOUSE_ENTERED: |
break; |
||||||
break; |
case MouseEvent.MOUSE_ENTERED: |
||||||
} |
break; |
||||||
} |
} |
||||||
|
} |
||||||
@Override |
|
||||||
protected void processMouseMotionEvent(MouseEvent e) { |
@Override |
||||||
if (e.getX() < 20) { |
protected void processMouseMotionEvent(MouseEvent e) { |
||||||
return; |
if (e.getX() < X_COORDINATE) { |
||||||
} |
return; |
||||||
|
} |
||||||
super.processMouseEvent(e); |
|
||||||
} |
super.processMouseEvent(e); |
||||||
|
} |
||||||
@Override |
|
||||||
public Object[] getSelectedValues() { |
@Override |
||||||
List<Object> list = new ArrayList<Object>(selects.length); |
public Object[] getSelectedValues() { |
||||||
for (int i = 0; i < selects.length; i++) { |
List<Object> list = new ArrayList<Object>(selects.length); |
||||||
if (selects[i]) { |
for (int i = 0; i < selects.length; i++) { |
||||||
list.add(this.getModel().getElementAt(i)); |
if (selects[i]) { |
||||||
} |
list.add(this.getModel().getElementAt(i)); |
||||||
} |
} |
||||||
|
} |
||||||
return list.toArray(); |
|
||||||
} |
return list.toArray(); |
||||||
|
} |
||||||
} |
|
||||||
|
} |
||||||
private void doCheck() { |
|
||||||
// p:这里必须改变所有选择checkbox.
|
private void doCheck() { |
||||||
int index = jlist.getSelectedIndex(); |
// p:这里必须改变所有选择checkbox.
|
||||||
boolean sValue = !selects[index]; |
int index = jlist.getSelectedIndex(); |
||||||
|
boolean sValue = !selects[index]; |
||||||
// p:开始设置所有选择的checkbox.
|
|
||||||
int[] indices = jlist.getSelectedIndices(); |
// p:开始设置所有选择的checkbox.
|
||||||
for (int i = 0; i < indices.length; i++) { |
int[] indices = jlist.getSelectedIndices(); |
||||||
setSelected(indices[i], sValue); |
for (int i = 0; i < indices.length; i++) { |
||||||
} |
setSelected(indices[i], sValue); |
||||||
for (boolean selected : selects) { |
} |
||||||
if (!selected) { |
for (boolean selected : selects) { |
||||||
chooseAll.setSelected(false); |
if (!selected) { |
||||||
return; |
chooseAll.setSelected(false); |
||||||
} |
return; |
||||||
} |
} |
||||||
chooseAll.setSelected(true); |
} |
||||||
repaint(); |
chooseAll.setSelected(true); |
||||||
} |
repaint(); |
||||||
|
} |
||||||
private static final Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); |
|
||||||
|
private static final Border NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); |
||||||
private class CheckListCellRenderer extends UICheckBox implements ListCellRenderer { |
|
||||||
|
private class CheckListCellRenderer extends UICheckBox implements ListCellRenderer { |
||||||
public CheckListCellRenderer() { |
|
||||||
this.setOpaque(true); |
public CheckListCellRenderer() { |
||||||
this.setBorder(noFocusBorder); |
this.setOpaque(true); |
||||||
} |
this.setBorder(NO_FOCUS_BORDER); |
||||||
|
} |
||||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
|
||||||
this.setText(value2Text(value)); |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||||
this.setSelected(selects[index]); |
this.setText(value2Text(value)); |
||||||
this.setFont(list.getFont()); |
this.setSelected(selects[index]); |
||||||
|
this.setFont(list.getFont()); |
||||||
if (isSelected) { |
|
||||||
this.setBackground(list.getSelectionBackground()); |
if (isSelected) { |
||||||
this.setForeground(list.getSelectionForeground()); |
this.setBackground(list.getSelectionBackground()); |
||||||
} else { |
this.setForeground(list.getSelectionForeground()); |
||||||
this.setBackground(list.getBackground()); |
} else { |
||||||
this.setForeground(list.getForeground()); |
this.setBackground(list.getBackground()); |
||||||
} |
this.setForeground(list.getForeground()); |
||||||
|
} |
||||||
if (cellHasFocus) { |
|
||||||
this.setBorder(UIManager.getBorder("List.focusCellHighlightBorder")); |
if (cellHasFocus) { |
||||||
} else { |
this.setBorder(UIManager.getBorder("List.focusCellHighlightBorder")); |
||||||
this.setBorder(noFocusBorder); |
} else { |
||||||
} |
this.setBorder(NO_FOCUS_BORDER); |
||||||
|
} |
||||||
return this; |
|
||||||
} |
return this; |
||||||
} |
} |
||||||
|
} |
||||||
public void addCheckBoxListSelectionChangeListener(CheckBoxListSelectionChangeListener l) { |
|
||||||
this.listenerList.add(CheckBoxListSelectionChangeListener.class, l); |
public void addCheckBoxListSelectionChangeListener(CheckBoxListSelectionChangeListener l) { |
||||||
} |
this.listenerList.add(CheckBoxListSelectionChangeListener.class, l); |
||||||
|
} |
||||||
public void removeCheckBoxListSelectionChangeListener(CheckBoxListSelectionChangeListener l) { |
|
||||||
this.listenerList.remove(CheckBoxListSelectionChangeListener.class, l); |
public void removeCheckBoxListSelectionChangeListener(CheckBoxListSelectionChangeListener l) { |
||||||
} |
this.listenerList.remove(CheckBoxListSelectionChangeListener.class, l); |
||||||
|
} |
||||||
public void fireCheckBoxListSelectionChangeListener() { |
|
||||||
// Guaranteed to return a non-null array
|
public void fireCheckBoxListSelectionChangeListener() { |
||||||
Object[] listeners = listenerList.getListenerList(); |
// Guaranteed to return a non-null array
|
||||||
|
Object[] listeners = listenerList.getListenerList(); |
||||||
// Process the listeners last to first, notifying
|
|
||||||
// those that are interested in this event
|
// Process the listeners last to first, notifying
|
||||||
for (int i = listeners.length - 2; i >= 0; i -= 2) { |
// those that are interested in this event
|
||||||
if (listeners[i] == CheckBoxListSelectionChangeListener.class) { |
for (int i = listeners.length - 2; i >= 0; i -= 2) { |
||||||
((CheckBoxListSelectionChangeListener)listeners[i + 1]).selectionChanged(this); |
if (listeners[i] == CheckBoxListSelectionChangeListener.class) { |
||||||
} |
((CheckBoxListSelectionChangeListener) listeners[i + 1]).selectionChanged(this); |
||||||
} |
} |
||||||
|
} |
||||||
} |
|
||||||
|
} |
||||||
public static interface CheckBoxListSelectionChangeListener extends EventListener { |
|
||||||
public void selectionChanged(CheckBoxList target); |
public static interface CheckBoxListSelectionChangeListener extends EventListener { |
||||||
} |
public void selectionChanged(CheckBoxList target); |
||||||
|
} |
||||||
public ListModel getModel() { |
|
||||||
return jlist.getModel(); |
public ListModel getModel() { |
||||||
} |
return jlist.getModel(); |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -0,0 +1,58 @@ |
|||||||
|
package com.fr.design.mainframe.toolbar; |
||||||
|
|
||||||
|
import com.fr.design.actions.UpdateAction; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by XiaXiang on 2017/5/24. |
||||||
|
*/ |
||||||
|
|
||||||
|
/** |
||||||
|
* action对象 |
||||||
|
*/ |
||||||
|
public class UpdateActionModel { |
||||||
|
private String parentName; |
||||||
|
private String actionName; |
||||||
|
private UpdateAction action; |
||||||
|
|
||||||
|
public UpdateActionModel(String parentName, UpdateAction action) { |
||||||
|
this.parentName = parentName; |
||||||
|
this.action = action; |
||||||
|
this.actionName = action.getName(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取上一层级菜单name |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public String getParentName() { |
||||||
|
return parentName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setParentName(String parentName) { |
||||||
|
this.parentName = parentName; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取action |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public UpdateAction getAction() { |
||||||
|
return action; |
||||||
|
} |
||||||
|
|
||||||
|
public void setAction(UpdateAction action) { |
||||||
|
this.action = action; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取actionName |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public String getActionName() { |
||||||
|
return actionName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setActionName(String actionName) { |
||||||
|
this.actionName = actionName; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
|
||||||
|
apply plugin: 'java' |
||||||
|
tasks.withType(JavaCompile){ |
||||||
|
options.encoding = 'UTF-8' |
||||||
|
} |
||||||
|
//指定构建的jdk版本 |
||||||
|
sourceCompatibility=1.7 |
||||||
|
//指定生成jar包版本 |
||||||
|
version='8.0' |
||||||
|
//生成jar包重命名 |
||||||
|
jar{ |
||||||
|
baseName='fr-designer-chart' |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
def srcDir="." |
||||||
|
def baseDir=".." |
||||||
|
|
||||||
|
//指定源码路径 |
||||||
|
sourceSets{ |
||||||
|
main{ |
||||||
|
java{ |
||||||
|
srcDirs=["${srcDir}/src"] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
//获取什么分支名 |
||||||
|
FileTree files =fileTree(dir:'./',include:'build.*.gradle') |
||||||
|
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) |
||||||
|
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) |
||||||
|
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) |
||||||
|
|
||||||
|
//声明外部依赖 |
||||||
|
dependencies{ |
||||||
|
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar') |
||||||
|
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar") |
||||||
|
testCompile 'junit:junit:4.12' |
||||||
|
} |
||||||
|
//复制非.java文件到classes文件夹下参与打包 |
||||||
|
task copyFile(type:Copy,dependsOn:compileJava){ |
||||||
|
copy{ |
||||||
|
from ("${srcDir}/src"){ |
||||||
|
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' |
||||||
|
} |
||||||
|
into 'build/classes/main' |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//压缩项目中的js文件 |
||||||
|
task compressJS{ |
||||||
|
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ |
||||||
|
classpath { |
||||||
|
fileset(dir:"../${baseDir}/lib4build",includes:'**/*.jar') |
||||||
|
} |
||||||
|
} |
||||||
|
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ |
||||||
|
fileset (dir:"${srcDir}/src"){ |
||||||
|
include (name:'**/*.js') |
||||||
|
include (name:'**/*.css') |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
jar.dependsOn compressJS |
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,83 @@ |
|||||||
|
|
||||||
|
apply plugin: 'java' |
||||||
|
tasks.withType(JavaCompile){ |
||||||
|
options.encoding = 'UTF-8' |
||||||
|
} |
||||||
|
//指定构建的jdk版本 |
||||||
|
sourceCompatibility=1.7 |
||||||
|
//指定生成jar包版本 |
||||||
|
version='8.0' |
||||||
|
//生成jar包重命名 |
||||||
|
jar{ |
||||||
|
baseName='fr-designer-report' |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
def srcDir="." |
||||||
|
def baseDir=".." |
||||||
|
|
||||||
|
//指定源码路径 |
||||||
|
sourceSets{ |
||||||
|
main{ |
||||||
|
java{ |
||||||
|
srcDirs=["${srcDir}/src", |
||||||
|
"${srcDir}/../designer/src"] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
//获取什么分支名 |
||||||
|
FileTree files =fileTree(dir:'./',include:'build.*.gradle') |
||||||
|
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) |
||||||
|
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) |
||||||
|
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) |
||||||
|
|
||||||
|
//声明外部依赖 |
||||||
|
dependencies{ |
||||||
|
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar') |
||||||
|
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar") |
||||||
|
testCompile 'junit:junit:4.12' |
||||||
|
} |
||||||
|
//复制非.java文件到classes文件夹下参与打包 |
||||||
|
|
||||||
|
//指明无法编译文件所在路径 |
||||||
|
def dataContent ={def dir -> |
||||||
|
copySpec{ |
||||||
|
from ("${dir}"){ |
||||||
|
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
task copyFile(type:Copy,dependsOn:compileJava){ |
||||||
|
copy{ |
||||||
|
with dataContent.call("${srcDir}/src") |
||||||
|
with dataContent.call("${srcDir}/../designer/src") |
||||||
|
into 'build/classes/main' |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//压缩项目中的js文件 |
||||||
|
task compressJS{ |
||||||
|
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ |
||||||
|
classpath { |
||||||
|
fileset(dir:"../${baseDir}/lib4build",includes:'**/*.jar') |
||||||
|
} |
||||||
|
} |
||||||
|
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ |
||||||
|
fileset (dir:"${srcDir}/src"){ |
||||||
|
include (name:'**/*.js') |
||||||
|
include (name:'**/*.css') |
||||||
|
} |
||||||
|
fileset (dir:"${srcDir}/../designer/src"){ |
||||||
|
include (name:'**/*.js') |
||||||
|
include (name:'**/*.css') |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
jar.dependsOn compressJS |
||||||
|
|
||||||
|
|
||||||
|
|