Author: mmichaud
Date: 2009-04-03 08:27:23 -0700 (Fri, 03 Apr 2009)
New Revision: 16458
Modified:
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/GuiTunableInterceptor.java
Log:
Modified:
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/GuiTunableInterceptor.java
===================================================================
---
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/GuiTunableInterceptor.java
2009-04-03 15:27:18 UTC (rev 16457)
+++
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/GuiTunableInterceptor.java
2009-04-03 15:27:23 UTC (rev 16458)
@@ -37,7 +37,7 @@
}
public void handle(){
- for(Guihandler h: lh)h.handle();
+ for(Guihandler h: lh)h.notifyDependents();//h.handle();
}
public boolean createUI(Object... proxyObjs) {
@@ -53,9 +53,9 @@
return true;
if ( !panelMap.containsKey( lh ) ) {
- final String MAIN = "";
+ final String MAIN = " ";
Map<String, JPanel> panels = new
HashMap<String,JPanel>();
- panels.put(MAIN,createJPanel(MAIN,null));
+ panels.put(MAIN,createJPanel(MAIN,null,null));
// construct the gui
for (Guihandler gh : lh) {
@@ -72,15 +72,30 @@
}
}
+ Map<String,Param> groupalignement = new
HashMap<String,Param>();
+ String[] group = gh.getTunable().group();
+ Param[] alignments =
gh.getTunable().alignment();
+
+ if(group.length==alignments.length){
+ for(int i = 0; i < group.length;
i++)groupalignement.put(group[i], alignments[i]);
+ }
+ if(group.length>alignments.length){
+ for(int i = 0; i < alignments.length;
i++)groupalignement.put(group[i], alignments[i]);
+ for(int
i=alignments.length;i<group.length;i++)groupalignement.put(group[i],
Param.vertical);
+ }
+ if(alignments.length>group.length){
+ for(int i = 0; i < group.length;
i++)groupalignement.put(group[i], alignments[i]);
+ }
+
+
+
// find the proper group to put the handler
panel in
- String[] group = gh.getTunable().group();
String lastGroup = MAIN;
for ( String g : group ) {
if ( !panels.containsKey(g) ) {
-
panels.put(g,createJPanel(g,gh));
+
panels.put(g,createJPanel(g,gh,groupalignement.get(g)));
panels.get(lastGroup).add(
panels.get(g), gh.getTunable().xorKey() );
}
-
lastGroup = g;
}
@@ -106,7 +121,7 @@
buttons[0]);
if ( n == JOptionPane.OK_OPTION ){
- for ( Guihandler h : lh ) h.handle();
+ for ( Guihandler h : lh
)h.notifyDependents();// h.handle();
return true;
}
else
@@ -124,9 +139,9 @@
}
- private JPanel createJPanel(String title, Guihandler gh) {
+ private JPanel createJPanel(String title, Guihandler gh,Param
alignment) {
if ( gh == null )
- return getSimplePanel(title);
+ return getSimplePanel(title,alignment);
// See if we need to create an XOR panel
if ( gh.getTunable().xorChildren() ) {
@@ -145,16 +160,32 @@
}
// We're not collapsable, so return a normal jpanel
- return getSimplePanel(title);
+ return getSimplePanel(title,alignment);
}
}
- private JPanel getSimplePanel(String title) {
+ private JPanel getSimplePanel(String title,Param alignment) {
JPanel ret = new JPanel();
TitledBorder titleborder =
BorderFactory.createTitledBorder(title);
titleborder.setTitleColor(Color.BLUE);
- ret.setBorder(titleborder);
-// ret.setBorder(BorderFactory.createTitledBorder(title));
- ret.setLayout(new BoxLayout(ret,BoxLayout.PAGE_AXIS));
+ if(title!="" && title!=" "){
+ if(alignment==Param.vertical || alignment==null){
+ ret.setBorder(titleborder);
+ ret.setLayout(new
BoxLayout(ret,BoxLayout.PAGE_AXIS));
+ }
+ else if(alignment==Param.horizontal){
+ ret.setBorder(titleborder);
+ ret.setLayout(new
BoxLayout(ret,BoxLayout.LINE_AXIS));
+ }
+ }
+ else {
+ if(alignment==Param.vertical || alignment==null){
+ ret.setLayout(new
BoxLayout(ret,BoxLayout.PAGE_AXIS));
+ }
+ else if(alignment==Param.horizontal){
+
+ ret.setLayout(new
BoxLayout(ret,BoxLayout.LINE_AXIS));
+ }
+ }
return ret;
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en
-~----------~----~----~----~------~----~------~--~---