Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Version: Windchill 12.1
Use Case: I need to gather user inputs in a Wizard.
Description:
Thanks to @avillanueva and @BjoernRueegg and this post https://community.ptc.com/t5/Windchill-Customization/Likely-very-simple-question-about-input-on-wizards/m-p/865207#M1969%3Fsource=search I am in the process of creating my own AttributePanelConfig.
My problem is that I can't find the right combination of ComponentType so the label and the input are aligned horizontally. So far all I can get is aligned vertically. Screenshot of what I am getting:
and screen shot of the ootb New Part wizard attributes, note the Label and the input are aligned horizontally, which is how I want mine to look like:
The following is what I am using for buildComponentConfig() and buildComponentData()
@Override
public ComponentConfig buildComponentConfig(ComponentParams params) throws WTException {
ComponentConfigFactory factory = getComponentConfigFactory();
JcaAttributePanelConfig attributePanelConfig = (JcaAttributePanelConfig) factory.newAttributePanelConfig();
//ComponentType.WIZARD_ATTRIBUTES_TABLE
//ComponentType.WIZARD_TABLE
//ComponentType.ATTRIBUTE_PANEL
//attributePanelConfig.se
attributePanelConfig.setComponentType(ComponentType.WIZARD_ATTRIBUTES_TABLE);
JcaGroupConfig groupConfig = (JcaGroupConfig) factory.newGroupConfig("customConfig1");
//ComponentType.WIZARD_ATTRIBUTES_TABLE
//ComponentType.WIZARD_TABLE
groupConfig.setComponentType(ComponentType.WIZARD_ATTRIBUTES_TABLE);
//groupConfig.setIsGridLayout(true);
groupConfig.setIsMultiColumnGridLayout(true);
groupConfig.setLabel("Input");
groupConfig.setRenderOnTop(true);
AttributeConfig input1 = factory.newAttributeConfig("input1", "Input1 Testing");
input1.setComponentType(ComponentType.WIZARD_ATTRIBUTES_TABLE);
groupConfig.addComponent(input1);
AttributeConfig input2 = factory.newAttributeConfig("input2", "Input2 Testing");
input2.setComponentType(ComponentType.WIZARD_ATTRIBUTES_TABLE);
groupConfig.addComponent(input2);
attributePanelConfig.addComponent(groupConfig);
return attributePanelConfig;
}
@Override
public Object buildComponentData(ComponentConfig config, ComponentParams params) throws WTException, ParserConfigurationException, SAXException, IOException {
Map<String, AbstractGuiComponent> guiMap = new HashMap<String, AbstractGuiComponent>();
// input test 1 with giu array
GUIComponentArray guiArray = new GUIComponentArray();
guiArray.setDelimiter(Delimiter.SPACE);
TextBox input1 = new TextBox();
input1.setId("input1");
input1.setName("input1");
input1.setWidth(5);
guiArray.addGUIComponent(input1);
IconComponent icon = new IconComponent("wtcore/images/part.gif");
icon.setTooltip("Hello World");
guiArray.addGUIComponent(icon);
guiMap.put("input1", guiArray);
// input test 2 selection
ArrayList<String> displayList = new ArrayList<String>();
ArrayList<String> internalList = new ArrayList<String>();
ArrayList<String> selectedValue = new ArrayList<String>();
displayList.add("Value 1");
displayList.add("Value 2");
displayList.add("Value 3");
internalList.add("value1");
internalList.add("value2");
internalList.add("value3");
ComboBox comboBox1 = new ComboBox(internalList, displayList, selectedValue);
comboBox1.setId("comboBox1");
comboBox1.setName("comboBox1");
comboBox1.setMultiSelect(false);
comboBox1.setMultiValued(false);
guiMap.put("input2", comboBox1);
return guiMap;
}
Anybody have any hints as the what I am missing to get these to align horizontally?
Solved! Go to Solution.
Not sure, but try setting this to false:
groupConfig.setRenderOnTop(false);
As I remember, this is the label rendering. So the label is being rendered on top and not left side.
@RandyJones.. can you try using something like below.. you may need to change the numbers to get desired result.
..
AttributeConfig input1 = factory.newAttributeConfig("input1", "Input1 Testing",1,0);
input1 .setColSpan(3);
..
AttributeConfig input2 = factory.newAttributeConfig("input2", "Input2 Testing",2,0);
input2 .setColSpan(3);
..
Thanks,
Sandeep S Desai
@Sandeep_S_Desai the only thing this changes for me is the text input will span whole row and put the icon below, for input1, if colspan is greater than 1.
input1 .setColSpan(2 <or greater>); results in this:
Hello @RandyJones,
It looks like you have a response from a community member. If it helped you solve your question please mark the reply as the Accepted Solution.
If you found a solution yourselves, please document it in this topic and mark it as accepted solution.
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.
Thanks,
Vivek N.
Community Moderation Team.
Not sure, but try setting this to false:
groupConfig.setRenderOnTop(false);
As I remember, this is the label rendering. So the label is being rendered on top and not left side.
@BjoernRueegg wrote:
Not sure, but try setting this to false:
groupConfig.setRenderOnTop(false);
As I remember, this is the label rendering. So the label is being rendered on top and not left side.
That is it!! Not sure why I had not tried that yet. Setting this to false (which is the default) the labels and inputs are rendered aligned horizontally: