use of com.redhat.devtools.intellij.tektoncd.ui.UIConstants.ROW_DIMENSION in project intellij-tekton by redhat-developer.
the class InputResourcesStep method setContent.
public void setContent() {
final int[] row = { 0 };
model.getInputResources().stream().filter(input -> input.kind() == Input.Kind.RESOURCE).forEach(input -> {
JLabel lblNameResource = new JLabel("<html><span style=\\\"font-family:serif;font-size:10px;font-weight:bold;\\\">" + input.name() + "</span></html");
addComponent(lblNameResource, null, BORDER_LABEL_NAME, ROW_DIMENSION, 0, row[0], GridBagConstraints.NORTH);
addTooltip(lblNameResource, input.description().orElse(""));
row[0] += 1;
JComboBox cmbValueResource = new JComboBox();
cmbValueResource = (JComboBox) addComponent(cmbValueResource, TIMES_PLAIN_14, null, ROW_DIMENSION, 0, row[0], GridBagConstraints.NORTH);
fillComboBox(cmbValueResource, input);
addListener(input.name(), cmbValueResource);
row[0] += 1;
});
}
use of com.redhat.devtools.intellij.tektoncd.ui.UIConstants.ROW_DIMENSION in project intellij-tekton by redhat-developer.
the class ParametersStep method setContent.
public void setContent() {
textFields = new LinkedHashMap<>();
final int[] row = { 0 };
// if we are inside the AddTriggerWizard we suggest users which are the params they can use (extracted by the bindings chosen in the previous step)
if (model instanceof AddTriggerModel) {
Set<String> variablesToSuggest = ((AddTriggerModel) model).extractVariablesFromSelectedBindings();
if (!variablesToSuggest.isEmpty()) {
String suggestVariablesText = "<html><body style=\"font-family: " + Font.DIALOG + ";font-size:10px;\">The following variables can be used as Parameter values in the form $variable:<br><br>";
int cont = 0;
for (String variable : variablesToSuggest) {
suggestVariablesText += "<span style=\"font-size:10px;font-weight:bold;\">" + variable + "</span> ";
if (++cont % 4 == 0)
suggestVariablesText += "<br>";
}
suggestVariablesText += "<br><br>The variables are taken from the bindings chosen in the previous step and they will be<br>" + "filled by the EventListener when evaluating TriggerBindings for an event.</html>";
JTextPane lblVariableText = new JTextPane();
lblVariableText.setContentType("text/html");
lblVariableText.setText(suggestVariablesText);
lblVariableText.setEditable(false);
lblVariableText.setBackground(null);
lblVariableText.setBorder(null);
addComponent(lblVariableText, null, BORDER_LABEL_NAME, null, 0, row[0], GridBagConstraints.NORTHWEST);
row[0] += 1;
}
}
model.getParams().stream().filter(input -> input.kind() == Input.Kind.PARAMETER).forEach(input -> {
String label = "<html><span style=\\\"font-family:serif;font-size:10px;font-weight:bold;\\\">" + input.name() + "</span> <span style=\\\"font-family:serif;font-size:10;font-weight:normal;font-style:italic;\\\">(" + input.type() + ")</span></html>";
String tooltip = input.description().isPresent() ? input.description().get() + "\n" : "";
if (input.type().equals("string")) {
tooltip += "The parameter " + input.name() + " expects a string value.";
} else {
tooltip += "The parameter " + input.name() + " expects an array value (e.g. val1,val2,val3 ...). Leave it empty for an empty array.";
}
JLabel lblNameParam = new JLabel(label);
addComponent(lblNameParam, null, BORDER_LABEL_NAME, ROW_DIMENSION, 0, row[0], GridBagConstraints.NORTHWEST);
addTooltip(lblNameParam, tooltip);
row[0] += 1;
JTextField txtValueParam = new JTextField(input.defaultValue().orElse(""));
textFields.put(input.name(), txtValueParam);
txtValueParam = (JTextField) addComponent(txtValueParam, TIMES_PLAIN_14, null, ROW_DIMENSION, 0, row[0], GridBagConstraints.NORTHWEST);
addListener(input.name(), txtValueParam, txtValueParam.getBorder(), row[0]);
row[0] += 1;
});
}
Aggregations