Search in sources :

Example 1 with StringResourceTable

use of com.android.tools.idea.editors.strings.table.StringResourceTable in project android by JetBrains.

the class TranslationsEditorTest method setModel.

@Test
public void setModel() {
    StringResourceTable table = (StringResourceTable) myTranslationsEditor.getTable().target();
    OptionalInt optionalWidth = table.getKeyColumnPreferredWidth();
    TableColumnModel model = table.getColumnModel();
    assertTrue(optionalWidth.isPresent());
    assertEquals(optionalWidth.getAsInt(), model.getColumn(KEY_COLUMN).getPreferredWidth());
    optionalWidth = table.getDefaultValueAndLocaleColumnPreferredWidths();
    int width = optionalWidth.getAsInt();
    assertTrue(optionalWidth.isPresent());
    IntStream.range(DEFAULT_VALUE_COLUMN, table.getColumnCount()).mapToObj(model::getColumn).forEach(column -> assertEquals(width, column.getPreferredWidth()));
}
Also used : TableColumnModel(javax.swing.table.TableColumnModel) OptionalInt(java.util.OptionalInt) StringResourceTable(com.android.tools.idea.editors.strings.table.StringResourceTable) Test(org.junit.Test)

Example 2 with StringResourceTable

use of com.android.tools.idea.editors.strings.table.StringResourceTable in project android by JetBrains.

the class StringResourceViewPanel method createUIComponents.

private void createUIComponents() {
    myTable = new StringResourceTable();
    createDefaultValueTextField();
    createTranslationTextField();
}
Also used : StringResourceTable(com.android.tools.idea.editors.strings.table.StringResourceTable)

Aggregations

StringResourceTable (com.android.tools.idea.editors.strings.table.StringResourceTable)2 OptionalInt (java.util.OptionalInt)1 TableColumnModel (javax.swing.table.TableColumnModel)1 Test (org.junit.Test)1