superman
8 years ago
7 changed files with 190 additions and 5 deletions
@ -0,0 +1,12 @@
|
||||
package com.fr.design.designer.properties; |
||||
|
||||
import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; |
||||
|
||||
/** |
||||
* Created by zhouping on 2016/8/1. |
||||
*/ |
||||
public class AbsoluteStateRenderer extends EncoderCellRenderer { |
||||
public AbsoluteStateRenderer() { |
||||
super(new AbsoluteStateWrapper()); |
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.fr.design.designer.properties; |
||||
|
||||
import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems; |
||||
|
||||
/** |
||||
* Created by zhouping on 2016/8/1. |
||||
*/ |
||||
public class AbsoluteStateWrapper extends ItemWrapper{ |
||||
public AbsoluteStateWrapper() { |
||||
super(new FRAbsoluteConstraintsItems()); |
||||
} |
||||
} |
@ -0,0 +1,94 @@
|
||||
package com.fr.design.designer.properties; |
||||
|
||||
import com.fr.design.beans.GroupModel; |
||||
import com.fr.design.designer.creator.XWAbsoluteLayout; |
||||
import com.fr.design.mainframe.widget.editors.AbsoluteLayoutDirectionEditor; |
||||
import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor; |
||||
import com.fr.design.mainframe.widget.editors.PropertyCellEditor; |
||||
import com.fr.form.ui.container.WAbsoluteLayout; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.table.DefaultTableCellRenderer; |
||||
import javax.swing.table.TableCellEditor; |
||||
import javax.swing.table.TableCellRenderer; |
||||
|
||||
/** |
||||
* Created by zhouping on 2016/8/1. |
||||
*/ |
||||
public class FRAbsoluteLayoutPropertiesGroupModel implements GroupModel { |
||||
|
||||
private PropertyCellEditor editor; |
||||
private DefaultTableCellRenderer renderer; |
||||
private AbsoluteLayoutDirectionEditor stateEditor; |
||||
private AbsoluteStateRenderer stateRenderer; |
||||
private WAbsoluteLayout layout; |
||||
private XWAbsoluteLayout xwAbsoluteLayout; |
||||
|
||||
public FRAbsoluteLayoutPropertiesGroupModel(XWAbsoluteLayout xwAbsoluteLayout){ |
||||
this.xwAbsoluteLayout = xwAbsoluteLayout; |
||||
this.layout = xwAbsoluteLayout.toData(); |
||||
renderer = new DefaultTableCellRenderer(); |
||||
editor = new PropertyCellEditor(new IntegerPropertyEditor()); |
||||
stateEditor = new AbsoluteLayoutDirectionEditor(); |
||||
stateRenderer = new AbsoluteStateRenderer(); |
||||
} |
||||
|
||||
/** |
||||
* 布局管理器自己的属性 |
||||
*/ |
||||
@Override |
||||
public String getGroupName() { |
||||
return Inter.getLocText("FR-Designer-Widget_Area_Scaling"); |
||||
} |
||||
|
||||
@Override |
||||
public int getRowCount() { |
||||
return 1; |
||||
} |
||||
|
||||
@Override |
||||
public TableCellRenderer getRenderer(int row) { |
||||
return stateRenderer; |
||||
} |
||||
|
||||
@Override |
||||
public TableCellEditor getEditor(int row) { |
||||
return stateEditor; |
||||
} |
||||
|
||||
@Override |
||||
public Object getValue(int row, int column) { |
||||
if (column == 0) { |
||||
return Inter.getLocText("FR-Designer-Widget_Scaling_Mode"); |
||||
} else { |
||||
return layout.getCompState(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean setValue(Object value, int row, int column) { |
||||
int state = 0; |
||||
if(value instanceof Integer) { |
||||
state = (Integer)value; |
||||
} |
||||
if (column == 0 || state < 0) { |
||||
return false; |
||||
} else { |
||||
if (row == 0) { |
||||
layout.setCompState(state); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 是否可编辑 |
||||
* @param row 行 |
||||
* @return 否 |
||||
*/ |
||||
@Override |
||||
public boolean isEditable(int row) { |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fr.design.designer.properties.items; |
||||
|
||||
import com.fr.form.ui.container.WAbsoluteLayout; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Created by zhouping on 2016/8/1. |
||||
*/ |
||||
public class FRAbsoluteConstraintsItems implements ItemProvider{ |
||||
|
||||
public static final Item[] ITEMS = new Item[] { |
||||
new Item(Inter.getLocText("FR-Designer_Widget_Scaling_Mode_Fit"), WAbsoluteLayout.STATE_FIT), |
||||
new Item(Inter.getLocText("FR-Designer_Widget_Scaling_Mode_Fixed"), WAbsoluteLayout.STATE_FIXED) |
||||
}; |
||||
|
||||
public Item[] getItems() { |
||||
return ITEMS; |
||||
} |
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.fr.design.mainframe.widget.editors; |
||||
|
||||
import com.fr.design.designer.properties.EnumerationEditor; |
||||
import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems; |
||||
|
||||
/** |
||||
* Created by zhouping on 2016/8/1. |
||||
*/ |
||||
public class AbsoluteLayoutDirectionEditor extends EnumerationEditor { |
||||
public AbsoluteLayoutDirectionEditor() { |
||||
super(new FRAbsoluteConstraintsItems()); |
||||
} |
||||
} |
Loading…
Reference in new issue