public static void store(final Storage storage, final JTable table) { final TableColumnModel model = table.getTableHeader().getColumnModel(); final int columnCount = model.getColumnCount(); final boolean[] storedColumns = new boolean[columnCount]; Arrays.fill(storedColumns, false); for (int i = 0; i < columnCount; i++) { final TableColumn column = model.getColumn(i); storage.put(widthPropertyName(i), String.valueOf(column.getWidth())); final int modelIndex = column.getModelIndex(); storage.put(orderPropertyName(i), String.valueOf(modelIndex)); if (storedColumns[modelIndex]) { LOG.error("columnCount: " + columnCount + " current: " + i + " modelINdex: " + modelIndex); } storedColumns[modelIndex] = true; } }
public static void restore(final Storage storage, final JTable table) { final TableColumnModel columnModel = table.getTableHeader().getColumnModel(); int index = 0; final ArrayList<String> columnIndices = new ArrayList<String>(); while (true) { final String order = storage.get(orderPropertyName(index)); if (order == null) break; columnIndices.add(order); index++; if (index == table.getColumnCount()) break; } index = 0; for (final String columnIndex : columnIndices) { final int modelColumnIndex = indexbyModelIndex(columnModel, Integer.parseInt(columnIndex)); if (modelColumnIndex > 0 && modelColumnIndex < columnModel.getColumnCount()) { columnModel.moveColumn(modelColumnIndex, index); } index++; } for (int i = 0; i < columnIndices.size(); i++) { final String width = storage.get(widthPropertyName(i)); if (width != null && width.length() > 0) { try { columnModel.getColumn(i).setPreferredWidth(Integer.parseInt(width)); } catch(NumberFormatException e) { LOG.error("Bad width: " + width + " at column: "+ i + " from: " + storage + " actual columns count: " + columnModel.getColumnCount() + " info count: " + columnIndices.size(), e); } } } }
public static void restoreWidth(final Storage storage, final TableColumnModel columns) { for (int index = 0; true; index++) { final String widthValue = storage.get(widthPropertyName(index)); if (widthValue == null) break; try { columns.getColumn(index).setPreferredWidth(Integer.parseInt(widthValue)); } catch(NumberFormatException e) { LOG.error("Bad width: " + widthValue + " at column: " + index + " from: " + storage, e); } } }
/** * @param config * @param testFrameworkName Prefix for storage which keeps runner settings. E.g. "RubyTestUnit" * @param executor */ public SMTRunnerConsoleProperties(@NotNull final RunConfiguration config, @NotNull final String testFrameworkName, @NotNull final Executor executor) { super(new Storage.PropertiesComponentStorage(testFrameworkName + "Support.", PropertiesComponent.getInstance()), config.getProject(), executor); myConfiguration = config; myCustomFilter = new CompositeFilter(config.getProject()); }
public static void storeWidth(final Storage storage, final TableColumnModel columns) { for (int i = 0; i < columns.getColumnCount(); i++) { storage.put(widthPropertyName(i), String.valueOf(columns.getColumn(i).getWidth())); } }
@NotNull private static Storage.PropertiesComponentStorage getStorage(String testFrameworkName) { return new Storage.PropertiesComponentStorage(testFrameworkName + "Support.", PropertiesComponent.getInstance()); }
public TestConsoleProperties(@NotNull Storage storage, Project project, Executor executor) { super(storage); myProject = project; myExecutor = executor; }
public StoringPropertyContainer(String groupName, PropertiesComponent propertiesComponent) { this(new Storage.PropertiesComponentStorage(groupName, propertiesComponent)); }
public StoringPropertyContainer(@NotNull Storage storage) { myStorage = storage; }
public JavaAwareTestConsoleProperties(final Storage storage, Project project, Executor executor) { super(storage, project, executor); }
public TestConsoleProperties(final Storage storage, Project project, Executor executor) { super(storage); myProject = project; myExecutor = executor; }
public StoringPropertyContainer(@NonNls final String groupName, final PropertiesComponent propertiesComponent) { this(new Storage.PropertiesComponentStorage(groupName, propertiesComponent)); }
public StoringPropertyContainer(final Storage storage) { myStorage = storage; }
public TestNGConsoleProperties(TestNGConfiguration config, Executor executor) { super(new Storage.PropertiesComponentStorage(PREFIX, PropertiesComponent.getInstance()), config.getProject(), executor); myConfiguration = config; }
public JUnitConsoleProperties(@NotNull JUnitConfiguration configuration, Executor executor) { this(configuration, new Storage.PropertiesComponentStorage(GROUP_NAME, PropertiesComponent.getInstance()), executor); }
public JUnitConsoleProperties(@NotNull JUnitConfiguration configuration, final Storage storage, Executor executor) { super(storage, configuration.getProject(), executor); myConfiguration = configuration; }
public MavenTestConsoleProperties(MavenProject mavenProject, Project project, Executor executor, RunProfile configuration, ProcessHandler processHandler) { super(new Storage.PropertiesComponentStorage("MavenTestSupport.", PropertiesComponent.getInstance()), project, executor); this.mavenProject = mavenProject; this.configuration = configuration; this.processHandler = processHandler; }
@Nonnull private static Storage.PropertiesComponentStorage getStorage(String testFrameworkName) { return new Storage.PropertiesComponentStorage(testFrameworkName + "Support.", PropertiesComponent.getInstance()); }