Skip to content
Snippets Groups Projects
Commit 2d2c5790 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

better section names

parent 49432c58
No related branches found
No related tags found
No related merge requests found
...@@ -216,8 +216,7 @@ public class ModelFragment extends Fragment{ ...@@ -216,8 +216,7 @@ public class ModelFragment extends Fragment{
requestRender(); requestRender();
} }
}); });
layoutParams = new RelativeLayout.LayoutParams( layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
glViewLayout.addView(_controlBarLayout, layoutParams); glViewLayout.addView(_controlBarLayout, layoutParams);
......
...@@ -61,9 +61,9 @@ public class OptionsModelFragment extends Fragment{ ...@@ -61,9 +61,9 @@ public class OptionsModelFragment extends Fragment{
private void getAvailableParam() private void getAvailableParam()
{ {
String[] tmp = _gmsh.getParams(); String[] tmp = _gmsh.getParams();
for(String s : tmp){ // for each parameters in ONEALB for(String s : tmp){ // for each parameter in ONEALB
boolean found = false; boolean found = false;
for(int i = 0; i<params.size(); i++){ // for each parameters for(int i = 0; i < params.size(); i++){ // for each parameter in the GUI
Parameter p = params.get(i); Parameter p = params.get(i);
if(s.split(Character.toString((char)0x03))[2].equals(p.getName())){ if(s.split(Character.toString((char)0x03))[2].equals(p.getName())){
// the parameter already exist, just refresh it // the parameter already exist, just refresh it
...@@ -94,10 +94,7 @@ public class OptionsModelFragment extends Fragment{ ...@@ -94,10 +94,7 @@ public class OptionsModelFragment extends Fragment{
}); });
params.add(mParam); params.add(mParam);
if(_listView != null) if(_listView != null)
_listView.addItem(mParam.getName().split("/")[0].equals("Parameters")? _listView.addItem(mParam.getSectionName(), mParam.getView());
mParam.getName().split("/")[0] + " > " +
mParam.getName().split("/")[1] :
mParam.getName().split("/")[0], mParam.getView());
} }
else if(s.split("|")[1].equals("string")){ else if(s.split("|")[1].equals("string")){
ParameterString mParam = new ParameterString(_listView.getContext(), _gmsh, ""); ParameterString mParam = new ParameterString(_listView.getContext(), _gmsh, "");
...@@ -112,10 +109,7 @@ public class OptionsModelFragment extends Fragment{ ...@@ -112,10 +109,7 @@ public class OptionsModelFragment extends Fragment{
}); });
params.add(mParam); params.add(mParam);
if(_listView != null) if(_listView != null)
_listView.addItem(mParam.getName().split("/")[0].equals("Parameters") ? _listView.addItem(mParam.getSectionName(), mParam.getView());
mParam.getName().split("/")[0] + " > " +
mParam.getName().split("/")[1] :
mParam.getName().split("/")[0], mParam.getView());
} }
} }
} }
......
...@@ -36,9 +36,6 @@ public class Parameter { ...@@ -36,9 +36,6 @@ public class Parameter {
protected void update() protected void update()
{ {
if(_label != null && !_label.equals(""))
_title.setText(_label);
else
_title.setText(getShortName()); _title.setText(getShortName());
if(isReadOnly()) _title.setAlpha(0.423f); if(isReadOnly()) _title.setAlpha(0.423f);
} }
...@@ -54,14 +51,37 @@ public class Parameter { ...@@ -54,14 +51,37 @@ public class Parameter {
public String getShortName() public String getShortName()
{ {
if(_label != null && _label.length() > 0) return _label; if(_label != null && _label.length() > 0) return _label;
String[] splited = _name.split("/"); String[] split = _name.split("/");
String name = splited[splited.length-1]; String name = split[split.length-1];
while(name.length() > 0 && name.charAt(0) == ' ')
name = name.substring(1);
while(name.length() > 0 && (name.charAt(0) == '{' || name.charAt(0) == '}'))
name = name.substring(1);
while(name.length() > 0 && name.charAt(0) >= '0' && name.charAt(0) <= '9') while(name.length() > 0 && name.charAt(0) >= '0' && name.charAt(0) <= '9')
name = name.substring(1); name = name.substring(1);
return name; return name;
} }
public String getSectionName()
{
String name = "";
if (_name.contains("/")) {
String[] split = _name.split("/");
for(int i = 0; i < split.length - 1; i++){
String s = split[i];
while(s.length() > 0 && s.charAt(0) == ' ')
s = s.substring(1);
while(s.length() > 0 && (s.charAt(0) == '{' || s.charAt(0) == '}'))
s = s.substring(1);
while(s.length() > 0 && s.charAt(0) >= '0' && s.charAt(0) <= '9')
s = s.substring(1);
if(i != 0)
name += " > ";
name += s;
}
}
return name;
}
public boolean isReadOnly() { return _readOnly; } public boolean isReadOnly() { return _readOnly; }
public String getLabel() { return _label; }
public int fromString(String s) public int fromString(String s)
{ {
String[] infos = s.split(Character.toString((char)0x03)); String[] infos = s.split(Character.toString((char)0x03));
......
...@@ -159,4 +159,3 @@ public class SeparatedListView extends ListView{ ...@@ -159,4 +159,3 @@ public class SeparatedListView extends ListView{
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment