Skip to content

Commit

Permalink
- remove TModel
Browse files Browse the repository at this point in the history
  • Loading branch information
derreisende77 committed Oct 31, 2024
1 parent 8aa7245 commit de60d14
Show file tree
Hide file tree
Showing 12 changed files with 209 additions and 220 deletions.
11 changes: 6 additions & 5 deletions src/main/java/mediathek/daten/ListeProg.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
*/
package mediathek.daten;

import mediathek.tool.models.TModel;
import mediathek.tool.models.NonEditableTableModel;

import javax.swing.table.TableModel;
import java.util.ArrayList;
import java.util.Iterator;

Expand Down Expand Up @@ -54,8 +55,8 @@ public int auf(int idx, boolean auf) {
return neu;
}

public TModel getModel() {
TModel model;
public TableModel createModel() {
TableModel model;
Object[][] object;
DatenProg daten;
int i = 0;
Expand All @@ -67,9 +68,9 @@ public TModel getModel() {
object[i] = daten.arr;
++i;
}
model = new TModel(object, DatenProg.COLUMN_NAMES);
model = new NonEditableTableModel(object, DatenProg.COLUMN_NAMES);
} else {
model = new TModel(new Object[0][DatenProg.MAX_ELEM], DatenProg.COLUMN_NAMES);
model = new NonEditableTableModel(new Object[0][DatenProg.MAX_ELEM], DatenProg.COLUMN_NAMES);
}
return model;
}
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/mediathek/daten/ListePset.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
import mediathek.gui.dialogEinstellungen.PanelProgrammPfade;
import mediathek.gui.messages.ProgramSetChangedEvent;
import mediathek.tool.MessageBus;
import mediathek.tool.models.TModel;
import mediathek.tool.models.NonEditableTableModel;
import org.apache.commons.lang3.StringUtils;

import javax.swing.*;
import javax.swing.table.TableModel;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -202,8 +203,8 @@ public boolean addPset(ListePset liste) {
return ret;
}

public TModel getModel() {
TModel model;
public TableModel createModel() {
TableModel model;
Object[][] object;
DatenPset datenPset;
int i = 0;
Expand All @@ -215,9 +216,9 @@ public TModel getModel() {
object[i] = datenPset.arr;
++i;
}
model = new TModel(object, DatenPset.COLUMN_NAMES);
model = new NonEditableTableModel(object, DatenPset.COLUMN_NAMES);
} else {
model = new TModel(new Object[0][DatenPset.MAX_ELEM], DatenPset.COLUMN_NAMES);
model = new NonEditableTableModel(new Object[0][DatenPset.MAX_ELEM], DatenPset.COLUMN_NAMES);
}
return model;
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/mediathek/daten/ListePsetVorlagen.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import mediathek.file.GetFile;
import mediathek.tool.NetUtils;
import mediathek.tool.http.MVHttpClient;
import mediathek.tool.models.TModel;
import mediathek.tool.models.NonEditableTableModel;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
Expand All @@ -15,6 +15,7 @@
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import javax.swing.table.TableModel;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
Expand All @@ -25,7 +26,6 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class ListePsetVorlagen extends ArrayList<String[]> {
private static final String BS_WIN_32 = "Windows-32Bit";
Expand All @@ -51,11 +51,11 @@ public class ListePsetVorlagen extends ArrayList<String[]> {
private static final Logger logger = LogManager.getLogger(ListePsetVorlagen.class);


public TModel getTModel(String bs) {
public TableModel createModel(String bs) {
String[][] object;
if (this.size() > 0) {
if (!bs.isEmpty()) {
List<String[]> tmp = this.stream().filter(aThi -> aThi[PGR_BS_NR].contains(bs)).collect(Collectors.toList());
List<String[]> tmp = this.stream().filter(aThi -> aThi[PGR_BS_NR].contains(bs)).toList();
object = new String[tmp.size()][PGR_MAX_ELEM];
for (int i = 0; i < tmp.size(); i++) {
object[i] = tmp.get(i);
Expand All @@ -66,9 +66,9 @@ public TModel getTModel(String bs) {
object[i] = this.get(i);
}
}
return new TModel(object, PGR_COLUMN_NAMES);
return new NonEditableTableModel(object, PGR_COLUMN_NAMES);
} else {
return new TModel(new Object[][]{}, PGR_COLUMN_NAMES);
return new NonEditableTableModel(new Object[][]{}, PGR_COLUMN_NAMES);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<Component class="javax.swing.JTable" name="jTableVorlagen">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new TModel()" type="code"/>
<Connection code="new NonEditableTableModel()" type="code"/>
</Property>
</Properties>
</Component>
Expand Down
Loading

0 comments on commit de60d14

Please sign in to comment.