-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3-way merge for initial objects ui prototype
- Loading branch information
Showing
6 changed files
with
400 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...ea-plugin/src/main/java/com/evolveum/midpoint/studio/impl/diff/DefaultTreeTableModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package com.evolveum.midpoint.studio.impl.diff; | ||
|
||
import com.intellij.openapi.util.NlsContexts; | ||
import com.intellij.ui.treeStructure.treetable.TreeTableModel; | ||
import com.intellij.ui.treeStructure.treetable.TreeTableTree; | ||
import com.intellij.util.ui.ColumnInfo; | ||
import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.swing.*; | ||
import javax.swing.tree.DefaultTreeModel; | ||
import java.util.List; | ||
|
||
public class DefaultTreeTableModel<T> extends DefaultTreeModel implements TreeTableModel { | ||
|
||
private TreeTableTree tree; | ||
|
||
private List<ColumnInfo> columns; | ||
|
||
private T data; | ||
|
||
public DefaultTreeTableModel(@NotNull List<ColumnInfo> columns) { | ||
this(columns, null); | ||
} | ||
|
||
public DefaultTreeTableModel(@NotNull List<ColumnInfo> columns, T data) { | ||
super(new DefaultMutableTreeTableNode()); | ||
|
||
this.columns = columns; | ||
|
||
setData(data); | ||
} | ||
|
||
public ColumnInfo getColumnInfo(int index) { | ||
return columns.get(index); | ||
} | ||
|
||
@Override | ||
public int getColumnCount() { | ||
return columns.size(); | ||
} | ||
|
||
@Override | ||
public @NlsContexts.ColumnName String getColumnName(int column) { | ||
return columns.get(column).getName(); | ||
} | ||
|
||
@Override | ||
public Class<?> getColumnClass(int column) { | ||
return columns.get(column).getColumnClass(); | ||
} | ||
|
||
@Override | ||
public Object getValueAt(Object node, int column) { | ||
return columns.get(column).valueOf(node); | ||
} | ||
|
||
@Override | ||
public boolean isCellEditable(Object node, int column) { | ||
return columns.get(column).isCellEditable(node); | ||
} | ||
|
||
@Override | ||
public void setValueAt(Object aValue, Object node, int column) { | ||
columns.get(column).setValue(node, aValue); | ||
} | ||
|
||
public TreeTableTree getTree() { | ||
return tree; | ||
} | ||
|
||
@Override | ||
public void setTree(JTree tree) { | ||
if (!(tree instanceof TreeTableTree)) { | ||
throw new IllegalArgumentException("Tree must be instance of TreeTableTree"); | ||
} | ||
this.tree = (TreeTableTree) tree; | ||
} | ||
|
||
public T getData() { | ||
return data; | ||
} | ||
|
||
public void setData(T data) { | ||
this.data = data; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
studio-idea-plugin/src/main/java/com/evolveum/midpoint/studio/impl/diff/DeltaTreeTable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.evolveum.midpoint.studio.impl.diff; | ||
|
||
import com.evolveum.midpoint.prism.delta.ObjectDelta; | ||
import com.intellij.ui.treeStructure.treetable.TreeTable; | ||
|
||
public class DeltaTreeTable extends TreeTable { | ||
|
||
public DeltaTreeTable(ObjectDelta<?> delta) { | ||
super(new DeltaTreeTableModel()); | ||
|
||
setupComponent(); | ||
} | ||
|
||
private void setupComponent() { | ||
setDragEnabled(false); | ||
|
||
this.tableHeader.setReorderingAllowed(false); | ||
|
||
this.columnModel.getColumn(0).setPreferredWidth(40); | ||
this.columnModel.getColumn(0).setMinWidth(40); | ||
this.columnModel.getColumn(0).setMaxWidth(40); | ||
|
||
this.columnModel.getColumn(1).setPreferredWidth(200); | ||
this.columnModel.getColumn(1).setMinWidth(50); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...idea-plugin/src/main/java/com/evolveum/midpoint/studio/impl/diff/DeltaTreeTableModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.evolveum.midpoint.studio.impl.diff; | ||
|
||
import com.evolveum.midpoint.prism.delta.ObjectDelta; | ||
import com.evolveum.midpoint.studio.ui.browse.ObjectColumnInfo; | ||
import com.intellij.ui.treeStructure.treetable.TreeTableModel; | ||
import com.intellij.util.ui.ColumnInfo; | ||
|
||
import java.util.List; | ||
|
||
public class DeltaTreeTableModel extends DefaultTreeTableModel<ObjectDelta<?>> { | ||
|
||
private static final List<ColumnInfo> COLUMNS = List.of( | ||
new ObjectColumnInfo("", o -> true) { | ||
|
||
@Override | ||
public Class<?> getColumnClass() { | ||
return Boolean.class; | ||
} | ||
}, | ||
new ObjectColumnInfo("Path", o -> "asdf") { | ||
|
||
@Override | ||
public Class<?> getColumnClass() { | ||
return TreeTableModel.class; | ||
} | ||
} | ||
); | ||
|
||
public DeltaTreeTableModel() { | ||
super(COLUMNS); | ||
} | ||
} |
Oops, something went wrong.