/** * Adds a new column. * * @param column column */ public void addColumn(Column column) { getColumns().add(column); }
/** * Immutable constructor. * * @param insertionMode insertion mode. * @param numberOfRows number of rows in the data section. * @param startIndex index of the first row of the data section (inclusive). */ public Data(InsertionMode insertionMode, Integer numberOfRows, Integer startIndex) { super(); setInsertionMode(insertionMode); setNumberOfRows(numberOfRows); setStartIndex(startIndex); setImmutable(true); }
/** * Returns whether it has the insertion mode. * * @return whether it has the insertion mode */ public boolean hasInsertionMode() { return getInsertionMode() != null; }
@Override public void declareExtensions(ExtensionProfile extProfile) { if (extProfile.isDeclared(TableEntry.class)) { return; } super.declareExtensions(extProfile); extProfile.declare(TableEntry.class, Data.getDefaultDescription(true, false)); new Data().declareExtensions(extProfile); extProfile.declare(TableEntry.class, Header.getDefaultDescription(true, false)); extProfile.declare(TableEntry.class, Worksheet.getDefaultDescription(true, false)); }
@Override public Data parseData(Element element) { checkNotNull(element); Data data = new Data(); //This line is needed for the spreadsheet API data.setStartIndex(2); parseElement(element, data); return data; }
/** * Returns whether it has the index of the first row of the data section * (inclusive). * * @return whether it has the index of the first row of the data section * (inclusive) */ public boolean hasStartIndex() { return getStartIndex() != null; }
/** * Returns the columns. * * @return columns */ public List<Column> getColumns() { return getRepeatingExtension(Column.class); }
/** * Returns whether it has the number of rows in the data section. * * @return whether it has the number of rows in the data section */ public boolean hasNumberOfRows() { return getNumberOfRows() != null; }
/** * Returns whether it has the columns. * * @return whether it has the columns */ public boolean hasColumns() { return hasRepeatingExtension(Column.class); }
@Override public void declareExtensions(ExtensionProfile extProfile) { if (extProfile.isDeclared(TableEntry.class)) { return; } super.declareExtensions(extProfile); extProfile.declare(TableEntry.class, Data.getDefaultDescription(true, false)); new Data().declareExtensions(extProfile); extProfile.declare(TableEntry.class, Header.getDefaultDescription(true, false)); extProfile.declare(TableEntry.class, Worksheet.getDefaultDescription(true, false)); }
/** * Returns whether it has the index of the first row of the data section * (inclusive). * * @return whether it has the index of the first row of the data section * (inclusive) */ public boolean hasStartIndex() { return getStartIndex() != null; }
/** * Returns the columns. * * @return columns */ public List<Column> getColumns() { return getRepeatingExtension(Column.class); }
/** * Returns whether it has the number of rows in the data section. * * @return whether it has the number of rows in the data section */ public boolean hasNumberOfRows() { return getNumberOfRows() != null; }
/** * Returns whether it has the columns. * * @return whether it has the columns */ public boolean hasColumns() { return hasRepeatingExtension(Column.class); }
@Override public void declareExtensions(ExtensionProfile extProfile) { if (extProfile.isDeclared(ListPageEntry.class)) { return; } super.declareExtensions(extProfile); extProfile.declare(ListPageEntry.class, Data.getDefaultDescription(true, false)); new Data().declareExtensions(extProfile); extProfile.declare(ListPageEntry.class, new ExtensionDescription(FeedLink.class, new XmlNamespace("gd", "http://schemas.google.com/g/2005"), "feedLink", true, false, false)); new FeedLink().declareExtensions(extProfile); extProfile.declare(ListPageEntry.class, Header.getDefaultDescription(true, false)); extProfile.declare(ListPageEntry.class, Worksheet.getDefaultDescription(true, false)); }
/** * Immutable constructor. * * @param insertionMode insertion mode. * @param numberOfRows number of rows in the data section. * @param startIndex index of the first row of the data section (inclusive). */ public Data(InsertionMode insertionMode, Integer numberOfRows, Integer startIndex) { super(); setInsertionMode(insertionMode); setNumberOfRows(numberOfRows); setStartIndex(startIndex); setImmutable(true); }
/** * Adds a new column. * * @param column column */ public void addColumn(Column column) { getColumns().add(column); }
/** * Returns whether it has the insertion mode. * * @return whether it has the insertion mode */ public boolean hasInsertionMode() { return getInsertionMode() != null; }
@Override public void declareExtensions(ExtensionProfile extProfile) { if (extProfile.isDeclared(ListPageEntry.class)) { return; } super.declareExtensions(extProfile); extProfile.declare(ListPageEntry.class, Data.getDefaultDescription(true, false)); new Data().declareExtensions(extProfile); extProfile.declare(ListPageEntry.class, new ExtensionDescription(FeedLink.class, new XmlNamespace("gd", "http://schemas.google.com/g/2005"), "feedLink", true, false, false)); new FeedLink().declareExtensions(extProfile); extProfile.declare(ListPageEntry.class, Header.getDefaultDescription(true, false)); extProfile.declare(ListPageEntry.class, Worksheet.getDefaultDescription(true, false)); }
Data data = listPage.getData(); Map<String, String> names = Maps.newHashMap(); for (Column column : data.getColumns()) { names.put(column.getIndex(), column.getName());