Browse Source

Merge remote-tracking branch 'origin/dev' into dev

master
richie 9 years ago
parent
commit
aa539fdc49
  1. 40
      designer_base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  2. 78
      designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java

40
designer_base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -1,15 +1,15 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import java.util.ArrayList;
import java.util.List;
import javax.swing.tree.TreePath;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.text.Position;
import javax.swing.tree.TreePath;
import java.util.ArrayList;
import java.util.List;
/* /*
* 显示Env下的reportlets目录下面的所有cpt文件 * 显示Env下的reportlets目录下面的所有cpt文件
*/ */
@ -66,4 +66,34 @@ public class TemplateFileTree extends EnvFileTree {
return selectedPathList.toArray(new String[0]); return selectedPathList.toArray(new String[0]);
} }
public TreePath getNextMatch(String prefix, int startingRow,
Position.Bias bias) {
int max = getRowCount();
if (prefix == null) {
throw new IllegalArgumentException();
}
if (startingRow < 0 || startingRow >= max) {
throw new IllegalArgumentException();
}
prefix = prefix.toUpperCase();
// start search from the next/previous element froom the
// selected element
int increment = (bias == Position.Bias.Forward) ? 1 : -1;
int row = startingRow;
do {
TreePath path = getPathForRow(row);
String text = convertValueToText(
path.getLastPathComponent(), isRowSelected(row),
isExpanded(row), true, row, false);
if (text.toUpperCase().startsWith(prefix)) {
return path;
}
row = (row + increment + max) % max;
} while (row != startingRow);
return null;
}
} }

78
designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java

@ -3,18 +3,22 @@
*/ */
package com.fr.design.designer.properties; package com.fr.design.designer.properties;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import com.fr.design.beans.GroupModel; import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.FitLayoutDirectionEditor; import com.fr.design.mainframe.widget.editors.FitLayoutDirectionEditor;
import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor; import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor;
import com.fr.design.mainframe.widget.editors.PropertyCellEditor; import com.fr.design.mainframe.widget.editors.PropertyCellEditor;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
/** /**
* 自适应布局自身的属性表 * 自适应布局自身的属性表
* 主要为布局内组件间隔合并水平和竖直间隔原样缩放为web端保持当前设计的款高比例 * 主要为布局内组件间隔合并水平和竖直间隔原样缩放为web端保持当前设计的款高比例
@ -28,6 +32,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
private DefaultTableCellRenderer renderer; private DefaultTableCellRenderer renderer;
private FitLayoutDirectionEditor stateEditor; private FitLayoutDirectionEditor stateEditor;
private FitStateRenderer stateRenderer; private FitStateRenderer stateRenderer;
private PropertyCellEditor reLayoutEditor;
private CheckBoxCellRenderer reLayoutrenderer;
private WFitLayout layout; private WFitLayout layout;
private XWFitLayout xfl; private XWFitLayout xfl;
@ -38,6 +44,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
editor = new PropertyCellEditor(new IntegerPropertyEditor()); editor = new PropertyCellEditor(new IntegerPropertyEditor());
stateEditor = new FitLayoutDirectionEditor(); stateEditor = new FitLayoutDirectionEditor();
stateRenderer = new FitStateRenderer(); stateRenderer = new FitStateRenderer();
reLayoutrenderer = new CheckBoxCellRenderer();
reLayoutEditor = new PropertyCellEditor(new BooleanEditor());
} }
/** /**
@ -50,7 +58,7 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
@Override @Override
public int getRowCount() { public int getRowCount() {
return 2; return 3;
} }
@Override @Override
@ -58,8 +66,11 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
switch (row) { switch (row) {
case 0: case 0:
return renderer; return renderer;
default: case 1:
return stateRenderer; return stateRenderer;
default:
return reLayoutrenderer;
} }
} }
@ -68,8 +79,10 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
switch (row) { switch (row) {
case 0: case 0:
return editor; return editor;
default: case 1:
return stateEditor; return stateEditor;
default:
return reLayoutEditor;
} }
} }
@ -79,22 +92,32 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
switch (row) { switch (row) {
case 0: case 0:
return Inter.getLocText("FR-Designer_Component_Interval"); return Inter.getLocText("FR-Designer_Component_Interval");
default : case 1 :
return Inter.getLocText("FR-Designer_Component_Scale"); return Inter.getLocText("FR-Designer_Component_Scale");
default:
return Inter.getLocText("FR-Designer-App_ReLayout");
} }
} else { } else {
switch (row) { switch (row) {
case 0: case 0:
return layout.getCompInterval(); return layout.getCompInterval();
default : case 1 :
return layout.getCompState(); return layout.getCompState();
default:
return layout.getAppRelayout();
} }
} }
} }
@Override @Override
public boolean setValue(Object value, int row, int column) { public boolean setValue(Object value, int row, int column) {
int state = (Integer) value; int state = 0;
boolean appRelayoutState = true;
if(value instanceof Integer) {
state = (Integer)value;
} else if (value instanceof Boolean) {
appRelayoutState = (boolean) value;
}
if (column == 0 || state < 0) { if (column == 0 || state < 0) {
return false; return false;
} else { } else {
@ -105,6 +128,9 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
}else if (row == 1) { }else if (row == 1) {
layout.setCompState(state); layout.setCompState(state);
return true; return true;
} else if (row == 2) {
layout.setAppRelayout(appRelayoutState);
return true;
} }
return false; return false;
} }
@ -130,4 +156,32 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
return true; return true;
} }
private class CheckBoxCellRenderer extends UICheckBox implements TableCellRenderer {
public CheckBoxCellRenderer() {
super();
setOpaque(true);
}
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (value instanceof Boolean) {
setSelected(((Boolean) value).booleanValue());
setEnabled(table.isCellEditable(row, column));
if (isSelected) {
setBackground(table.getSelectionBackground());
setForeground(table.getSelectionForeground());
} else {
setForeground(table.getForeground());
setBackground(table.getBackground());
}
} else {
return null;
}
return this;
}
}
} }
Loading…
Cancel
Save