IDEMPIERE-282 Swing displaying labels for non-displayed parameters
This commit is contained in:
parent
e92b43053f
commit
916b0dc1ec
|
@ -73,7 +73,7 @@ public class ProcessDialog extends CFrame
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 790447068287846414L;
|
||||
private static final long serialVersionUID = 7486479305726277406L;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
|
@ -318,6 +318,7 @@ public class ProcessDialog extends CFrame
|
|||
m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
|
||||
m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
|
||||
parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi);
|
||||
parameterPanel.setWindow(this);
|
||||
centerPanel.removeAll();
|
||||
if (parameterPanel.init()) {
|
||||
// hasfields
|
||||
|
|
|
@ -57,11 +57,11 @@ import org.compiere.util.Msg;
|
|||
public class ProcessModalDialog extends CDialog
|
||||
implements ActionListener
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6613814452809135635L;
|
||||
private static final long serialVersionUID = -1573751323319156081L;
|
||||
|
||||
/**
|
||||
* Dialog to start a process/report
|
||||
|
@ -303,6 +303,7 @@ public class ProcessModalDialog extends CDialog
|
|||
m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
|
||||
m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
|
||||
parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi);
|
||||
parameterPanel.setWindow(this);
|
||||
centerPanel.removeAll();
|
||||
if (parameterPanel.init()) {
|
||||
// hasfields
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.awt.Component;
|
|||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Window;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.beans.VetoableChangeListener;
|
||||
|
@ -63,7 +64,7 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4042260793108029845L;
|
||||
private static final long serialVersionUID = 3871379020889713432L;
|
||||
|
||||
/**
|
||||
* Dynamic generated Parameter panel.
|
||||
|
@ -103,10 +104,12 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
|||
private ArrayList<GridField> m_mFields = new ArrayList<GridField>();
|
||||
private ArrayList<GridField> m_mFields2 = new ArrayList<GridField>();
|
||||
private ArrayList<JLabel> m_separators = new ArrayList<JLabel>();
|
||||
private ArrayList<JLabel> m_labels = new ArrayList<JLabel>();
|
||||
//
|
||||
private BorderLayout mainLayout = new BorderLayout();
|
||||
private CPanel centerPanel = new CPanel();
|
||||
private GridBagLayout centerLayout = new GridBagLayout();
|
||||
private Window m_win = null;
|
||||
|
||||
/**
|
||||
* Static Layout
|
||||
|
@ -129,6 +132,7 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
|||
m_mFields.clear();
|
||||
m_mFields2.clear();
|
||||
m_separators.clear();
|
||||
m_labels.clear();
|
||||
this.removeAll();
|
||||
} // dispose
|
||||
|
||||
|
@ -298,6 +302,7 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
|||
gbc.insets = labelInset;
|
||||
centerPanel.add(label, gbc);
|
||||
}
|
||||
m_labels.add(label);
|
||||
|
||||
// Field Preparation
|
||||
gbc.insets = fieldInset;
|
||||
|
@ -438,6 +443,7 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
|||
**/
|
||||
public void dynamicDisplay() {
|
||||
Component[] comps = centerPanel.getComponents();
|
||||
boolean changedSize = false;
|
||||
for (int i = 0; i < comps.length; i++) {
|
||||
Component comp = comps[i];
|
||||
if (comp instanceof CLabel)
|
||||
|
@ -450,7 +456,9 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
|||
if (m_mFields.get(index).isDisplayed(true)) { // check
|
||||
// context
|
||||
if (!comp.isVisible()) {
|
||||
changedSize = true;
|
||||
comp.setVisible(true); // visibility
|
||||
m_labels.get(index).setVisible(true);
|
||||
if (m_mFields.get(index).getVO().isRange)
|
||||
m_separators.get(index).setText(" - ");
|
||||
}
|
||||
|
@ -460,7 +468,9 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
|||
m_vEditors2.get(index).setReadWrite(rw);
|
||||
} else {
|
||||
if (comp.isVisible()) {
|
||||
changedSize = true;
|
||||
comp.setVisible(false);
|
||||
m_labels.get(index).setVisible(false);
|
||||
if (m_mFields.get(index).getVO().isRange)
|
||||
m_separators.get(index).setText("");
|
||||
}
|
||||
|
@ -468,6 +478,10 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
|||
}
|
||||
}
|
||||
}
|
||||
if (m_win != null && changedSize) {
|
||||
m_win.pack();
|
||||
m_win.setLocationRelativeTo(null);
|
||||
}
|
||||
} // Dynamic Display.
|
||||
|
||||
/**
|
||||
|
@ -633,4 +647,8 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
|||
f.restoreValue();
|
||||
}
|
||||
}
|
||||
|
||||
public void setWindow(Window win) {
|
||||
m_win = win;
|
||||
}
|
||||
} // ProcessParameterPanel
|
||||
|
|
Loading…
Reference in New Issue