Skip to content

#324 - changes VarType to JComboBox with hardcoded values for Shader Node wizard #400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
private final SaveCookie saveCookie = new SaveCookieImpl();
private boolean saveImmediate = true;
private boolean updateProperties = false;
private final List<MaterialChangeListener> materialListeners = new ArrayList<MaterialChangeListener>();
private final List<MaterialChangeListener> materialListeners = new ArrayList<>();

public MaterialEditorTopComponent() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@
</Table>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="SNDefVisualPanel2_varTable"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JToolBar" name="jToolBar1">
<Properties>
<Property name="floatable" type="boolean" value="false"/>
<Property name="rollover" type="boolean" value="true"/>
</Properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
package com.jme3.gde.shadernodedefinition.wizard;

import java.awt.EventQueue;
import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.event.ListSelectionEvent;
Expand All @@ -40,9 +42,11 @@

@SuppressWarnings({"unchecked", "rawtypes"})
public final class SNDefVisualPanel2 extends JPanel {

private final Object[] emptyObj = {"", "", ""};
private final Object[] emptyObj = {"float", "", ""};
private final String type;
private final String[] varTypes = new String[]{"bool", "int", "float", "vec2",
"vec3", "vec4", "sampler", "sampler2D", "sampler3D", "mat3", "mat4"};

/**
* Creates new form SNDefVisualPanel2
Expand All @@ -51,7 +55,10 @@ public SNDefVisualPanel2(String type) {
initComponents();
this.type = type;
titleLabel.setText(type);
varTable.getColumnModel().getSelectionModel().addListSelectionListener(new ExploreSelectionListener());
varTable.getColumnModel().getSelectionModel().addListSelectionListener(
new ExploreSelectionListener());
varTable.getColumn("Type").setCellEditor(new DefaultCellEditor(
new JComboBox(varTypes)));
}

@Override
Expand Down Expand Up @@ -107,7 +114,9 @@ public void run() {
// Edit.
if (varTable.isCellEditable(row, col)) {
varTable.editCellAt(row, col);
((JTextField) varTable.getEditorComponent()).selectAll();
if(col != 0) {
((JTextField) varTable.getEditorComponent()).selectAll();
}
varTable.getEditorComponent().requestFocusInWindow();
}
}
Expand Down Expand Up @@ -149,7 +158,6 @@ public Class getColumnClass(int columnIndex) {
});
jScrollPane1.setViewportView(varTable);

jToolBar1.setFloatable(false);
jToolBar1.setRollover(true);

org.openide.awt.Mnemonics.setLocalizedText(titleLabel, org.openide.util.NbBundle.getMessage(SNDefVisualPanel2.class, "SNDefVisualPanel2.titleLabel.text")); // NOI18N
Expand Down