📄 annealinglayoutconfigurationdialog.java
字号:
comb_lu_Method.setSelectedItem(config.get(AnnealingLayoutController.KEY_LAYOUT_UPDATE_METHOD));
switchLayoutUpdatePanel();
action_CheckBoxSwitch();
}
/******************************************************************************/
protected boolean isTrue(String boolValue){
if( boolValue != null ){
if( "TRUE".equals(boolValue.toUpperCase()) ){
return true;
}
else if( "FALSE".equals(boolValue.toUpperCase()) ){
return false;
}
}
return false;
}
/******************************************************************************/
/** Called by pressing the cancel button
*
*/
private void action_cancel() {
setVisible(false);
dispose();
canceled = true;
}
/******************************************************************************/
/** Called by pressing the ok button
*
*/
protected void action_ok() {
boolean isOK = true;
ArrayList errList = new ArrayList();
isOK &= assertDouble(tf_initTemperature.getText(), AnnealingLayoutController.KEY_INIT_TEMPERATURE,errList);
isOK &= assertDouble(tf_minTemperature.getText(), AnnealingLayoutController.KEY_MIN_TEMPERATURE,errList);
isOK &= assertDouble(tf_minDistance.getText(), AnnealingLayoutController.KEY_MIN_DISTANCE,errList);
isOK &= assertDouble(tf_tempScaleFactor.getText(), AnnealingLayoutController.KEY_TEMP_SCALE_FACTOR,errList);
isOK &= assertInteger(tf_maxRounds.getText(), AnnealingLayoutController.KEY_MAX_ROUNDS,errList);
isOK &= assertInteger(tf_triesPerCell.getText(), AnnealingLayoutController.KEY_TRIES_PER_CELL,errList);
isOK &= assertDouble(tf_lambdaNodeDistribution.getText(),"Node Distribution",errList);
isOK &= assertDouble(tf_lambdaBorderline.getText(), "Borderline",errList);
isOK &= assertDouble(tf_lambdaEdgeLength.getText(), "Edgelength",errList);
isOK &= assertDouble(tf_lambdaEdgeCrossing.getText(), "Edgecrossing",errList);
isOK &= assertDouble(tf_lambdaEdgeDistribution.getText(),"Node-Edge Distribution",errList);
isOK &= assertDouble(tf_lambdaNodeDistance.getText(), "Node Overlapping",errList);
isOK &= assertInteger(tf_boundsWidth.getText(), "max. width",errList);
isOK &= assertInteger(tf_boundsHeight.getText(), "max. height",errList);
isOK &= assertDouble(tf_lu_initTemperature.getText(), AnnealingLayoutController.KEY_LAYOUT_UPDATE_INIT_TEMPERATURE,errList);
isOK &= assertDouble(tf_lu_minTemperature.getText(), AnnealingLayoutController.KEY_LAYOUT_UPDATE_MIN_TEMPERATURE,errList);
isOK &= assertDouble(tf_lu_minDistance.getText(), AnnealingLayoutController.KEY_LAYOUT_UPDATE_MIN_DISTANCE,errList);
isOK &= assertDouble(tf_lu_tempScaleFactor.getText(), AnnealingLayoutController.KEY_LAYOUT_UPDATE_TEMP_SCALE_FACTOR,errList);
isOK &= assertInteger(tf_lu_maxRounds.getText(), AnnealingLayoutController.KEY_LAYOUT_UPDATE_MAX_ROUNDS,errList);
isOK &= assertInteger(tf_lu_triesPerCell.getText(), AnnealingLayoutController.KEY_LAYOUT_UPDATE_TRIES_PER_CELL,errList);
isOK &= assertDouble(tf_lu_lambdaNodeDistribution.getText(),"Layout Update Node Distribution",errList);
isOK &= assertDouble(tf_lu_lambdaBorderline.getText(), "Layout Update Borderline",errList);
isOK &= assertDouble(tf_lu_lambdaEdgeLength.getText(), "Layout Update Edgelength",errList);
isOK &= assertDouble(tf_lu_lambdaEdgeCrossing.getText(), "Layout Update Edgecrossing",errList);
isOK &= assertDouble(tf_lu_lambdaEdgeDistribution.getText(),"Layout Update Node-Edge Distribution",errList);
isOK &= assertDouble(tf_lu_lambdaNodeDistance.getText(), "Layout Update Node Overlapping",errList);
isOK &= assertInteger(tf_lu_boundsWidth.getText(), "Layout Update max. width",errList);
isOK &= assertInteger(tf_lu_boundsHeight.getText(), "Layout Update max. height",errList);
isOK &= assertDouble(tf_lu_clustering_factor.getText(), AnnealingLayoutController.KEY_LAYOUT_UPDATE_CLUSTERING_FACTOR,errList);
isOK &= assertDouble(tf_lu_clustering_moveScale.getText(),AnnealingLayoutController.KEY_LAYOUT_UPDATE_CLUSTERING_MOVE_SCALE,errList);
if( isOK ){
isOK &= assertDoublePositiveSign(tf_initTemperature.getText(),false,AnnealingLayoutController.KEY_INIT_TEMPERATURE,errList);
isOK &= assertDoublePositiveSign(tf_initTemperature.getText(),false,AnnealingLayoutController.KEY_INIT_TEMPERATURE,errList);
isOK &= assertDoublePositiveSign(tf_minTemperature.getText(),false,AnnealingLayoutController.KEY_MIN_TEMPERATURE,errList);
isOK &= assertDoublePositiveSign(tf_minDistance.getText(),false,AnnealingLayoutController.KEY_MIN_DISTANCE,errList);
isOK &= assertRange(tf_tempScaleFactor.getText(),0.0,1.0,false,false,AnnealingLayoutController.KEY_TEMP_SCALE_FACTOR,errList);
isOK &= assertIntegerPositiveSign(tf_maxRounds.getText(),false,AnnealingLayoutController.KEY_MAX_ROUNDS,errList);
isOK &= assertRange(tf_triesPerCell.getText(),8,99,true,true,AnnealingLayoutController.KEY_TRIES_PER_CELL,errList);
isOK &= assertIntegerPositiveSign(tf_boundsWidth.getText(),false,"max. width",errList);
isOK &= assertIntegerPositiveSign(tf_boundsWidth.getText(),false,"max. height",errList);
isOK &= assertDoublePositiveSign(tf_lambdaNodeDistribution.getText(),false,"Node Distribution",errList);
isOK &= assertDoublePositiveSign(tf_lambdaBorderline.getText() ,false,"Borderline",errList);
isOK &= assertDoublePositiveSign(tf_lambdaEdgeLength.getText() ,false,"Edgelength",errList);
isOK &= assertDoublePositiveSign(tf_lambdaEdgeCrossing.getText() ,false,"Edgecrossing",errList);
isOK &= assertDoublePositiveSign(tf_lambdaEdgeDistribution.getText(),false,"Node-Edge Distribution",errList);
isOK &= assertDoublePositiveSign(tf_lambdaNodeDistance.getText() ,false,"Node Overlapping",errList);
isOK &= assertDoublePositiveSign(tf_lu_initTemperature.getText(),false,AnnealingLayoutController.KEY_LAYOUT_UPDATE_INIT_TEMPERATURE,errList);
isOK &= assertDoublePositiveSign(tf_lu_initTemperature.getText(),false,AnnealingLayoutController.KEY_LAYOUT_UPDATE_INIT_TEMPERATURE,errList);
isOK &= assertDoublePositiveSign(tf_lu_minTemperature.getText(),false,AnnealingLayoutController.KEY_LAYOUT_UPDATE_MIN_TEMPERATURE,errList);
isOK &= assertDoublePositiveSign(tf_lu_minDistance.getText(),false,AnnealingLayoutController.KEY_LAYOUT_UPDATE_MIN_DISTANCE,errList);
isOK &= assertRange(tf_lu_tempScaleFactor.getText(),0.0,1.0,false,false,AnnealingLayoutController.KEY_LAYOUT_UPDATE_TEMP_SCALE_FACTOR,errList);
isOK &= assertIntegerPositiveSign(tf_lu_maxRounds.getText(),false,AnnealingLayoutController.KEY_LAYOUT_UPDATE_MAX_ROUNDS,errList);
isOK &= assertRange(tf_lu_triesPerCell.getText(),8,99,true,true,AnnealingLayoutController.KEY_LAYOUT_UPDATE_TRIES_PER_CELL,errList);
isOK &= assertIntegerPositiveSign(tf_lu_boundsWidth.getText(),false,"Layout Update max. width",errList);
isOK &= assertIntegerPositiveSign(tf_lu_boundsWidth.getText(),false,"Layout Update max. height",errList);
isOK &= assertDoublePositiveSign(tf_lu_lambdaNodeDistribution.getText(),false,"Layout Update Node Distribution",errList);
isOK &= assertDoublePositiveSign(tf_lu_lambdaBorderline.getText() ,false,"Layout Update Borderline",errList);
isOK &= assertDoublePositiveSign(tf_lu_lambdaEdgeLength.getText() ,false,"Layout Update Edgelength",errList);
isOK &= assertDoublePositiveSign(tf_lu_lambdaEdgeCrossing.getText() ,false,"Layout Update Edgecrossing",errList);
isOK &= assertDoublePositiveSign(tf_lu_lambdaEdgeDistribution.getText(),false,"Layout Update Node-Edge Distribution",errList);
isOK &= assertDoublePositiveSign(tf_lu_lambdaNodeDistance.getText() ,false,"Layout Update Node Overlapping",errList);
isOK &= assertDoublePositiveSign(tf_lu_clustering_factor.getText(),false,AnnealingLayoutController.KEY_LAYOUT_UPDATE_CLUSTERING_FACTOR,errList);
isOK &= assertRange(tf_lu_clustering_moveScale.getText(),0.0,1.0,false,true,AnnealingLayoutController.KEY_LAYOUT_UPDATE_CLUSTERING_MOVE_SCALE,errList);
}
isOK &= checkAdditionalFields(errList);
if( isOK ){
setVisible(false);
dispose();
canceled = false;
}
else {
String errorMsg = new String();
for( int i = 0; i < errList.size(); i++ ){
errorMsg += (String)errList.get(i);
if( i != errList.size() - 1 )
errorMsg += "\n";
}
JOptionPane.showMessageDialog(this, errorMsg, "Error", JOptionPane.INFORMATION_MESSAGE);
}
}
/******************************************************************************/
protected boolean checkAdditionalFields(ArrayList errList){
return true;
}
/******************************************************************************/
/**
* Returns true if the dialog has been canceled.
*/
public boolean isCanceled() {
return canceled;
}
/******************************************************************************/
/** Initialize the Swing Components
*/
private void initComponents() {
panelSurface = new JPanel(new BorderLayout(5,10));
panelSurface.setBackground(new Color(205,207,215));
getContentPane().setLayout(new BorderLayout(5,10));
tp_main = new JTabbedPane();
getContentPane().add(tp_main, BorderLayout.CENTER);
//getContentPane().add(panelSurface,BorderLayout.CENTER);
/*
if( !isOptimizer )
panelSurface.setBorder(
BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(),
"Values for main run"));
*/
JPanel panelLabels = new JPanel(new GridLayout(8,1, 0,5));
JPanel panelFields = new JPanel(new GridLayout(8,1, 0,5));
JPanel panelVars = new JPanel(new BorderLayout(5,10));
JPanel panelLambda = new JPanel(new GridBagLayout());
JPanel panelButtons = new JPanel(new GridLayout(1,3,10,0));
JPanel panelBounds = new JPanel(new GridBagLayout());
JPanel panelCenter = new JPanel(new BorderLayout(5,10));
panelLabels .setOpaque(false);
panelFields .setOpaque(false);
panelVars .setOpaque(false);
panelLambda .setOpaque(false);
panelButtons.setOpaque(false);
panelBounds .setOpaque(false);
panelCenter .setOpaque(false);
getContentPane().add(panelButtons,BorderLayout.SOUTH);
panelVars.add(panelLabels,BorderLayout.WEST);
panelVars.add(panelFields,BorderLayout.CENTER);
panelCenter.add(panelLambda,BorderLayout.CENTER);
panelCenter.add(panelBounds,BorderLayout.SOUTH);
panelSurface.add(panelVars ,BorderLayout.NORTH);
panelSurface.add(panelCenter ,BorderLayout.WEST);
panelSurface.add(new JPanel(),BorderLayout.SOUTH);
panelLabels.add( new JLabel("start temperature :"));
panelLabels.add( new JLabel("min. temperature :"));
panelLabels.add( new JLabel("min. distance :"));
panelLabels.add( new JLabel("temperature scaling factor :"));
panelLabels.add( new JLabel("max. rounds :"));
panelLabels.add( new JLabel("tries per cell :"));
panelLabels.add( new JLabel("are uphill-moves allowed :"));
panelLabels.add( new JLabel("compute permutations :"));
tf_initTemperature = new JTextField();
tf_minTemperature = new JTextField();
tf_minDistance = new JTextField();
tf_tempScaleFactor = new JTextField();
tf_maxRounds = new JTextField();
tf_triesPerCell = new JTextField();
tf_lambdaNodeDistribution = new JTextField();
tf_lambdaBorderline = new JTextField();
tf_lambdaEdgeLength = new JTextField();
tf_lambdaEdgeCrossing = new JTextField();
tf_lambdaEdgeDistribution = new JTextField();
tf_lambdaNodeDistance = new JTextField();
cb_computePermutation = new JCheckBox();
cb_uphillMovesAllowed = new JCheckBox();
cb_useNodeDistribution = new JCheckBox();
cb_useBorderline = new JCheckBox();
cb_useEdgeLength = new JCheckBox();
cb_useEdgeCrossing = new JCheckBox();
cb_useEdgeDistribution = new JCheckBox();
cb_useNodeDistance = new JCheckBox();
cb_computePermutation .setOpaque(false);
cb_uphillMovesAllowed .setOpaque(false);
cb_useNodeDistribution.setOpaque(false);
cb_useBorderline .setOpaque(false);
cb_useEdgeLength .setOpaque(false);
cb_useEdgeCrossing .setOpaque(false);
cb_useEdgeDistribution.setOpaque(false);
cb_useNodeDistance .setOpaque(false);
registerCheckBoxAction(cb_useNodeDistribution);
registerCheckBoxAction(cb_useBorderline);
registerCheckBoxAction(cb_useEdgeLength);
registerCheckBoxAction(cb_useEdgeCrossing);
registerCheckBoxAction(cb_useEdgeDistribution);
registerCheckBoxAction(cb_useNodeDistance);
panelFields.add(tf_initTemperature);
panelFields.add(tf_minTemperature);
panelFields.add(tf_minDistance);
panelFields.add(tf_tempScaleFactor);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -