|
|
@ -1,12 +1,14 @@ |
|
|
|
package com.fr.design.mainframe; |
|
|
|
package com.fr.design.mainframe; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.JScrollPane; |
|
|
|
|
|
|
|
import javax.swing.SwingConstants; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
|
|
|
|
import com.fr.design.fun.WidgetCustomAttrProvider; |
|
|
|
import com.fr.design.gui.frpane.UITabbedPane; |
|
|
|
import com.fr.design.gui.frpane.UITabbedPane; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
@ -24,6 +26,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper |
|
|
|
|
|
|
|
|
|
|
|
private WidgetPropertyTable propertyTable; |
|
|
|
private WidgetPropertyTable propertyTable; |
|
|
|
private EventPropertyTable eventTable; |
|
|
|
private EventPropertyTable eventTable; |
|
|
|
|
|
|
|
private List<AbstractPropertyTable> customPropertyTables; |
|
|
|
|
|
|
|
private FormDesigner designer; |
|
|
|
|
|
|
|
|
|
|
|
public static WidgetPropertyPane getInstance() { |
|
|
|
public static WidgetPropertyPane getInstance() { |
|
|
|
if (HOLDER.singleton == null) { |
|
|
|
if (HOLDER.singleton == null) { |
|
|
@ -33,14 +37,14 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static WidgetPropertyPane getInstance(FormDesigner formEditor) { |
|
|
|
public static WidgetPropertyPane getInstance(FormDesigner formEditor) { |
|
|
|
HOLDER.singleton.setEditingFormDesigner(formEditor); |
|
|
|
HOLDER.singleton.setEditingFormDesigner(formEditor); |
|
|
|
HOLDER.singleton.refreshDockingView(); |
|
|
|
HOLDER.singleton.refreshDockingView(); |
|
|
|
return HOLDER.singleton; |
|
|
|
return HOLDER.singleton; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class HOLDER { |
|
|
|
private static class HOLDER { |
|
|
|
private static WidgetPropertyPane singleton = new WidgetPropertyPane(); |
|
|
|
private static WidgetPropertyPane singleton = new WidgetPropertyPane(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private WidgetPropertyPane() { |
|
|
|
private WidgetPropertyPane() { |
|
|
@ -58,13 +62,14 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void refreshDockingView() { |
|
|
|
public void refreshDockingView() { |
|
|
|
FormDesigner designer = this.getEditingFormDesigner(); |
|
|
|
designer = this.getEditingFormDesigner(); |
|
|
|
removeAll(); |
|
|
|
removeAll(); |
|
|
|
if(designer == null){ |
|
|
|
if (designer == null) { |
|
|
|
clearDockingView(); |
|
|
|
clearDockingView(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
customPropertyTables = new ArrayList<AbstractPropertyTable>(); |
|
|
|
propertyTable = new WidgetPropertyTable(designer); |
|
|
|
propertyTable = new WidgetPropertyTable(designer); |
|
|
|
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); |
|
|
|
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); |
|
|
|
propertyTable.setBorder(null); |
|
|
|
propertyTable.setBorder(null); |
|
|
@ -76,79 +81,97 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper |
|
|
|
UIScrollPane esp = new UIScrollPane(eventTable); |
|
|
|
UIScrollPane esp = new UIScrollPane(eventTable); |
|
|
|
esp.setBorder(null); |
|
|
|
esp.setBorder(null); |
|
|
|
// JTabbedPane tabbedPane = new JTabbedPane();
|
|
|
|
// JTabbedPane tabbedPane = new JTabbedPane();
|
|
|
|
UITabbedPane tabbedPane = new UITabbedPane(); |
|
|
|
UITabbedPane tabbedPane = new UITabbedPane(); |
|
|
|
tabbedPane.setOpaque(true); |
|
|
|
tabbedPane.setOpaque(true); |
|
|
|
tabbedPane.setBorder(null); |
|
|
|
tabbedPane.setBorder(null); |
|
|
|
tabbedPane.setTabPlacement(SwingConstants.BOTTOM); |
|
|
|
tabbedPane.setTabPlacement(SwingConstants.BOTTOM); |
|
|
|
tabbedPane.addTab(Inter.getLocText("Form-Properties"), psp); |
|
|
|
tabbedPane.addTab(Inter.getLocText("Form-Properties"), psp); |
|
|
|
tabbedPane.addTab(Inter.getLocText("Form-Events"), esp); |
|
|
|
tabbedPane.addTab(Inter.getLocText("Form-Events"), esp); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WidgetCustomAttrProvider[] customAttrProviders = ExtraDesignClassManager.getInstance().getWidgetCustomAttrProviders(); |
|
|
|
|
|
|
|
for (WidgetCustomAttrProvider customAttrProvider : customAttrProviders) { |
|
|
|
|
|
|
|
AbstractPropertyTable propertyTable = customAttrProvider.createWidgetCustomAttrTable(); |
|
|
|
|
|
|
|
customPropertyTables.add(propertyTable); |
|
|
|
|
|
|
|
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); |
|
|
|
|
|
|
|
UIScrollPane uiScrollPane = new UIScrollPane(propertyTable); |
|
|
|
|
|
|
|
uiScrollPane.setBorder(null); |
|
|
|
|
|
|
|
tabbedPane.addTab(customAttrProvider.setTableTitle(), uiScrollPane); |
|
|
|
|
|
|
|
} |
|
|
|
add(tabbedPane, BorderLayout.CENTER); |
|
|
|
add(tabbedPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
propertyTable.initPropertyGroups(null); |
|
|
|
propertyTable.initPropertyGroups(null); |
|
|
|
eventTable.refresh(); |
|
|
|
eventTable.refresh(); |
|
|
|
|
|
|
|
if (customPropertyTables.size() > 0) { |
|
|
|
|
|
|
|
for (AbstractPropertyTable propertyTable : customPropertyTables) { |
|
|
|
|
|
|
|
propertyTable.initPropertyGroups(designer); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setEditingFormDesigner(BaseFormDesigner editor) { |
|
|
|
public void setEditingFormDesigner(BaseFormDesigner editor) { |
|
|
|
FormDesigner fd = (FormDesigner)editor; |
|
|
|
FormDesigner fd = (FormDesigner) editor; |
|
|
|
super.setEditingFormDesigner(fd); |
|
|
|
super.setEditingFormDesigner(fd); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void clearDockingView() { |
|
|
|
public void clearDockingView() { |
|
|
|
propertyTable = null; |
|
|
|
propertyTable = null; |
|
|
|
eventTable = null; |
|
|
|
eventTable = null; |
|
|
|
|
|
|
|
if (customPropertyTables != null) { |
|
|
|
|
|
|
|
customPropertyTables.clear(); |
|
|
|
|
|
|
|
} |
|
|
|
JScrollPane psp = new JScrollPane(); |
|
|
|
JScrollPane psp = new JScrollPane(); |
|
|
|
psp.setBorder(null); |
|
|
|
psp.setBorder(null); |
|
|
|
this.add(psp, BorderLayout.CENTER); |
|
|
|
this.add(psp, BorderLayout.CENTER); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class WidgetPropertyDesignerAdapter implements DesignerEditListener { |
|
|
|
public class WidgetPropertyDesignerAdapter implements DesignerEditListener { |
|
|
|
AbstractPropertyTable propertyTable; |
|
|
|
AbstractPropertyTable propertyTable; |
|
|
|
|
|
|
|
|
|
|
|
public WidgetPropertyDesignerAdapter(AbstractPropertyTable propertyTable) { |
|
|
|
public WidgetPropertyDesignerAdapter(AbstractPropertyTable propertyTable) { |
|
|
|
this.propertyTable = propertyTable; |
|
|
|
this.propertyTable = propertyTable; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void fireCreatorModified(DesignerEvent evt) { |
|
|
|
public void fireCreatorModified(DesignerEvent evt) { |
|
|
|
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED |
|
|
|
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED |
|
|
|
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED |
|
|
|
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED |
|
|
|
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { |
|
|
|
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { |
|
|
|
propertyTable.initPropertyGroups(null); |
|
|
|
propertyTable.initPropertyGroups(designer); |
|
|
|
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { |
|
|
|
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean equals(Object o) { |
|
|
|
public boolean equals(Object o) { |
|
|
|
return o instanceof WidgetPropertyDesignerAdapter; |
|
|
|
return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).propertyTable == this.propertyTable; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class EventPropertyDesignerAdapter implements DesignerEditListener { |
|
|
|
public class EventPropertyDesignerAdapter implements DesignerEditListener { |
|
|
|
EventPropertyTable propertyTable; |
|
|
|
EventPropertyTable propertyTable; |
|
|
|
|
|
|
|
|
|
|
|
public EventPropertyDesignerAdapter(EventPropertyTable eventTable) { |
|
|
|
public EventPropertyDesignerAdapter(EventPropertyTable eventTable) { |
|
|
|
this.propertyTable = eventTable; |
|
|
|
this.propertyTable = eventTable; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void fireCreatorModified(DesignerEvent evt) { |
|
|
|
public void fireCreatorModified(DesignerEvent evt) { |
|
|
|
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED |
|
|
|
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED |
|
|
|
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED |
|
|
|
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED |
|
|
|
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { |
|
|
|
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { |
|
|
|
propertyTable.refresh(); |
|
|
|
propertyTable.refresh(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean equals(Object o) { |
|
|
|
public boolean equals(Object o) { |
|
|
|
return o instanceof EventPropertyDesignerAdapter; |
|
|
|
return o instanceof EventPropertyDesignerAdapter; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Location preferredLocation() { |
|
|
|
public Location preferredLocation() { |
|
|
|
return Location.WEST_BELOW; |
|
|
|
return Location.WEST_BELOW; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |