Examples of Spreadsheet


Examples of com.projity.pm.graphic.spreadsheet.SpreadSheet

      }
      return true;
    }
   
      protected Transferable createTransferable(JComponent c, int action) {
        SpreadSheet spreadSheet=getSpreadSheet(c);
        if (spreadSheet==null) return null;
        ArrayList nodes=(ArrayList)spreadSheet.getSelectedNodes().clone();
       
        ArrayList fields=spreadSheet.getSelectedFields();
        boolean nodeSelection=(fields==null);
        if (fields==null) fields=spreadSheet.getSelectableFields();
        if (action==TransferHandler.COPY){
          if (nodeSelection){
            SpreadSheet.SpreadSheetAction a=getNodeListCopyAction().getSpreadSheetAction();
            a.execute(nodes);
          }
          return new NodeListTransferable(nodes,fields,spreadSheet,spreadSheet.getSelectedRows(),spreadSheet.getSelectedColumns(),nodeSelection);
        }else if (action==TransferHandler.MOVE){//cut
          if (nodeSelection){
            SpreadSheet.SpreadSheetAction a=((nodeSelection)?getNodeListCutAction():getNodeListCopyAction()).getSpreadSheetAction();
           
                for (Iterator i=nodes.iterator();i.hasNext();) {
                  Node node=(Node)i.next();
                  final boolean[] okForAll=new boolean[]{false};
                if (!transformSubprojectBranches(node,spreadSheet.getCache().getModel().getDataFactory(),new Predicate(){
                public boolean evaluate(Object arg0) {
                  if (okForAll[0]) return true;
                  Node parent=(Node)arg0;
                  boolean r=Alert.okCancel( Messages.getString("Message.subprojectCut") );
                  if (r) okForAll[0]=true;
                  return r;
                }
               
            })) return null;
              }

           
            a.execute(nodes);
          }
          return new NodeListTransferable(nodes,fields,spreadSheet,spreadSheet.getSelectedRows(),spreadSheet.getSelectedColumns(),nodeSelection);
        } else return null;
      }
View Full Code Here

Examples of com.projity.pm.graphic.spreadsheet.SpreadSheet

        } else return null;
      }
      protected void exportDone(JComponent source, Transferable data, int action) {
      }
      public boolean importData(JComponent c, Transferable t) {
        SpreadSheet spreadSheet=getSpreadSheet(c);
        if (spreadSheet==null) return false;
        DataFlavor flavor=getFlavor(t.getTransferDataFlavors());
          if (flavor!=null) {
              try {
                NodeModel model=((CommonSpreadSheetModel)spreadSheet.getModel()).getCache().getModel();
                Object data=t.getTransferData(flavor);
              if (data==null) return false;
                List nodes=null;
              if (data instanceof ArrayList){
                nodes=(List)data;
View Full Code Here

Examples of com.projity.pm.graphic.spreadsheet.SpreadSheet

   
    JComponent component=(JComponent)editor.getTableCellEditorComponent(table,value,isSelected,row,column);
    CellUtility.setAppearance(table,value,isSelected,true,row,column,component);
   
    if (table instanceof SpreadSheet){
      final SpreadSheet spreadSheet=(SpreadSheet)table;
      JComponent edit = (component instanceof DateEditor.ExtDateField) ? ((DateEditor.ExtDateField)component).getTextField() : component;
      edit.getActionMap().put("cut",new AbstractAction(){
        public void actionPerformed(java.awt.event.ActionEvent e) {
          spreadSheet.prepareAction(MenuActionConstants.ACTION_CUT).actionPerformed(new ActionEvent(spreadSheet,e.getID(),e.getActionCommand()));
        }
      });
      edit.getActionMap().put("copy",new AbstractAction(){
        public void actionPerformed(java.awt.event.ActionEvent e) {
          spreadSheet.prepareAction(MenuActionConstants.ACTION_COPY).actionPerformed(new ActionEvent(spreadSheet,e.getID(),e.getActionCommand()));
        }
      });
      edit.getActionMap().put("paste",new AbstractAction(){
        public void actionPerformed(java.awt.event.ActionEvent e) {
          spreadSheet.prepareAction(MenuActionConstants.ACTION_PASTE).actionPerformed(new ActionEvent(spreadSheet,e.getID(),e.getActionCommand()));
        }
      });
     
    }
   
View Full Code Here

Examples of org.formulacompiler.spreadsheet.Spreadsheet

  }


  private void nameModel()
  {
    final Spreadsheet ss = this.binding.getSpreadsheet();
    for (Entry<String, Spreadsheet.Range> nameDef : ss.getRangeNames().entrySet()) {
      final Spreadsheet.Range range = nameDef.getValue();
      if (range instanceof Spreadsheet.Cell) {
        final CellModel cellModel = getCellModel( (CellIndex) range );
        if (null != cellModel) {
          cellModel.setName( nameDef.getKey() );
View Full Code Here

Examples of org.jopendocument.dom.spreadsheet.SpreadSheet

public class Loader {
 
  public static void load(String metadataPath) throws NumberFormatException, IOException {
   
    File file = new File(metadataPath);
    SpreadSheet metadata = SpreadSheet.createFromFile(file);
   
    // App
    Sheet sheet = metadata.getSheet("App");
    App app = new App();
    app.setGroupId(getText(sheet, "A2"));
    app.setArtifactId(getText(sheet, "B2"));
    app.setName(getText(sheet, "C2"));
    app.setRestricted(getBoolean(sheet, "D2"));
    app.setDatePattern(getText(sheet, "E2"));
    app.setDateTimePattern(getText(sheet, "F2"));
    app.setTimePattern(getText(sheet, "G2"));
    app.setDb(getText(sheet, "H2"));
    app.setDbUser(getText(sheet, "I2"));
    app.setDbPassword(getText(sheet, "J2"));
    app.setEmailHost(getText(sheet, "K2"));
    app.setEmailId(getText(sheet, "L2"));
    app.setEmailPassword(getText(sheet, "M2"));
    app.setMaxUploadSize(Integer.parseInt(sheet.getCellAt("N2").getTextValue().trim()));
    app.setPageSize(getByte(sheet, "O2"));

    // Properties
    sheet = metadata.getSheet("Properties");
    Property property;
    for (int i = 2; !getText(sheet, "A" + i).equals(""); i++) {
      property = new Property();
      property.setName(sheet.getCellAt("A" + i).getTextValue().trim());
      property.setValue(sheet.getCellAt("B" + i).getTextValue().trim());
      property.setDataType(sheet.getCellAt("C" + i).getTextValue().trim());
      app.addProperty(property);
    }
   
    // Messages
    sheet = metadata.getSheet("Messages");
    Message message;
    for (int i = 2; !getText(sheet, "A" + i).equals(""); i++) {
      message = new Message();
      message.setName(sheet.getCellAt("A" + i).getTextValue().trim());
      message.setMessage(sheet.getCellAt("B" + i).getTextValue().trim());
      app.addMessage(message);
    }

    // Entities
    sheet = metadata.getSheet("Entities");
    BizEntity entity;
    for (int i = 2; !getText(sheet, "A" + i).equals(""); i++) {
      entity = new BizEntity();
      entity.setName(sheet.getCellAt("A" + i).getTextValue().trim());
      entity.setPlural(sheet.getCellAt("B" + i).getTextValue().trim());
      entity.setTableName(sheet.getCellAt("C" + i).getTextValue().trim());
      entity.setTitle(sheet.getCellAt("D" + i).getTextValue().trim());
      // Identifier column is set later
      entity.setOrderBy(sheet.getCellAt("F" + i).getTextValue().trim());
      entity.setCustomView(getBoolean(sheet, "G" + i));
      entity.setCustomEdit(getBoolean(sheet, "H" + i));
      entity.setCustomList(getBoolean(sheet, "I" + i));
      entity.setModule(sheet.getCellAt("J" + i).getTextValue().trim());
      app.addModule(entity.getModule()); // Adds distinct module names
     
      app.addEntity(entity);
    }
   
    // Unique Keys
    sheet = metadata.getSheet("UniqueKeys");
    UniqueKey uniqueKey;
    for (int i = 2; !getText(sheet, "A" + i).equals(""); i++) {
     
      uniqueKey = new UniqueKey();
      entity = app.getEntity(sheet.getCellAt("A" + i).getTextValue().trim());
      entity.addUniqueKey(uniqueKey);
     
      uniqueKey.setColumns(getText(sheet, "B" + i));
    }

    // Operations
    sheet = metadata.getSheet("Operations");
    Operation operation;
    for (int i = 2; !getText(sheet, "A" + i).equals(""); i++) {
     
      operation = new Operation();
      entity = app.getEntity(sheet.getCellAt("A" + i).getTextValue().trim());
      entity.addOperation(operation);
     
      operation.setName(sheet.getCellAt("B" + i).getTextValue().trim());
      operation.setLabel(sheet.getCellAt("C" + i).getTextValue().trim());
      operation.setVisibleInList(getBoolean(sheet, "D" + i));
    }

    // Attributes
    sheet = metadata.getSheet("Attributes");
    Attribute attribute;
    for (int i = 2; !getText(sheet, "A" + i).equals(""); i++) {
     
      attribute = new Attribute();
      entity = app.getEntity(sheet.getCellAt("A" + i).getTextValue().trim());
      entity.addAttribute(attribute);
     
      attribute.setName(sheet.getCellAt("B" + i).getTextValue().trim());
      attribute.setDataType(sheet.getCellAt("C" + i).getTextValue().trim());
      attribute.setDefaultValue(getText(sheet, "D" + i));
      attribute.setNullable(getBoolean(sheet, "E" + i));
      attribute.setUnigue(getBoolean(sheet, "F" + i));
      attribute.setPattern(sheet.getCellAt("G" + i).getTextValue().trim());
      attribute.setMin(getBigInteger(sheet, "H" + i));
      attribute.setMax(getBigInteger(sheet, "I" + i));
      attribute.setRelatedEntity(app.getEntity(sheet.getCellAt("J" + i).getTextValue().trim()));
      attribute.setFetchType(sheet.getCellAt("K" + i).getTextValue().trim());
      attribute.setCascadeType(sheet.getCellAt("L" + i).getTextValue().trim());
      attribute.setMappedBy(sheet.getCellAt("M" + i).getTextValue().trim());
      attribute.setOrderBy(sheet.getCellAt("N" + i).getTextValue().trim());
      attribute.setVisible(getBoolean(sheet, "O" + i));
      attribute.setSensitive(getBoolean(sheet, "P" + i));
      attribute.setVisibleInList(getBoolean(sheet, "Q" + i));
      attribute.setSearchable(getBoolean(sheet, "R" + i));
      attribute.setEditable(getBoolean(sheet, "S" + i));
      attribute.setBlankNull(getBoolean(sheet, "T" + i));
      attribute.setComputed(getBoolean(sheet, "U" + i));
      attribute.setLabel(sheet.getCellAt("V" + i).getTextValue().trim());
      attribute.setListLabel(sheet.getCellAt("W" + i).getTextValue());
      attribute.setHelpText(sheet.getCellAt("X" + i).getTextValue().trim());
      attribute.setYearRange(sheet.getCellAt("Y" + i).getTextValue().trim());
      attribute.setRows(getByte(sheet, "Z" + i));
      attribute.setCols(getByte(sheet, "AA" + i));
      attribute.setColumnName(sheet.getCellAt("AB" + i).getTextValue().trim());
     
      if (attribute.getRelatedEntity() != null &&
        attribute.getDataType().equals("ManyToOneSelect") &&
         (attribute.getEditable() || attribute.getSearchable())) {
        entity.addSelectableEntity(attribute.getRelatedEntity());
        if (attribute.getEditable())
          entity.addSelectableEditableEntity(attribute.getRelatedEntity());
        if (attribute.getSearchable())
          entity.addSelectableSearchableEntity(attribute.getRelatedEntity());
      }
       
    }
   
    // Set identifier column of entities
    sheet = metadata.getSheet("Entities");
    for (int i = 2; !getText(sheet, "A" + i).equals(""); i++) {
      String identifierColumn = sheet.getCellAt("E" + i).getTextValue().trim();
      if (!identifierColumn.equals("")) {
        entity = app.getEntity(sheet.getCellAt("A" + i).getTextValue().trim());
        attribute = entity.getAttribute(identifierColumn);
        entity.setIdentifierColumn(attribute);
      }
    }
   
    // Set select options of entities
    sheet = metadata.getSheet("SelOptions");
    SelOption selOption;
    for (int i = 2; !getText(sheet, "A" + i).equals(""); i++) {
     
      selOption = new SelOption();
      entity = app.getEntity(sheet.getCellAt("A" + i).getTextValue().trim());
View Full Code Here

Examples of org.jopendocument.dom.spreadsheet.SpreadSheet

      gui.setVocabularyText(result);
      File resultFile = SwingBoostUtils.chooseFile("Result file", false);
      // File resultFile = new File("c:/temp/vok2.wiki");
      if (resultFile != null) {
        if (resultFile.getName().contains(".ods")) {
          SpreadSheet sheet = SpreadSheet
              .createEmpty(vocabularyTable);

          // if rows have only one cell extend it over all
          // columns
          Vector rows = vocabularyTable.getDataVector();

          final int numberOfColumns = 4;
          for (int i = 0; i < rows.size(); i++) {
            Vector rowVector = (Vector) rows.get(i);
            if (rowVector.size() == numberOfColumns
                && rowVector.get(0) != null
                && rowVector.get(1) == null
                && rowVector.get(2) == null
                && rowVector.get(3) == null) {
              Object original = rowVector.get(0);
              MutableCell<SpreadSheet> cell = sheet
                  .getFirstSheet().getCellAt(0, i + 1);
              String text = cell.getTextValue();
              if (!text.equals(original))
                throw new IllegalStateException("texts differ "
                    + original + " : " + text);

              cell.getElement().setAttribute(
                  "number-columns-spanned",
                  "" + numberOfColumns,
                  cell.getODDocument().getVersion()
                      .getTABLE());

              if (numberOfColumns != cell.getColumnsSpanned())
                throw new IllegalStateException(
                    "wrong col span");
            }

          }

          sheet.saveAs(resultFile);
        } else if (resultFile.getName().contains(".wiki")) {
          StringBuilder resultBuilder = new StringBuilder();
          resultBuilder
              .append("{| class=\"wikitable\"\r\n|-\r\n! Zeichen !! Pinyin  !! Übersetzung\r\n");
         
View Full Code Here

Examples of org.zkoss.zss.ui.Spreadsheet

    final String[] data = request.getData();
    if (data == null || data.length != 17)
      throw new UiException(MZk.ILLEGAL_REQUEST_WRONG_DATA,
        new Object[] {Objects.toString(data), this});
   
    Spreadsheet spreadsheet = ((Spreadsheet)comp);
    SpreadsheetInCtrl ctrl = ((SpreadsheetInCtrl)spreadsheet.getExtraCtrl());
   
    String sheetId = data[0];
   
    int dpWidth = Integer.parseInt(data[1]);//pixel value of data panel width
    int dpHeight = Integer.parseInt(data[2]);//pixel value of data panel height
View Full Code Here

Examples of org.zkoss.zss.ui.Spreadsheet

   
    final Map data = (Map) request.getData();
    if (data == null || data.size() < 2)
      throw new UiException(MZk.ILLEGAL_REQUEST_WRONG_DATA, new Object[] {Objects.toString(data), ActionCommand.class });
   
    Spreadsheet spreadsheet = ((Spreadsheet) comp);
    String tag = (String) data.get("tag");
    String act = (String) data.get("act");
    if ("toolbar".equals(tag)) {
      spreadsheet.getActionHandler().dispatch(act, data);
    } else if ("sheet".equals(tag) && spreadsheet.getBook() != null) {
      String sheetId = (String) data.get("sheetId");
      Worksheet sheet = Utils.getSheetByUuid(spreadsheet.getBook(), sheetId);
      if (sheet != null) {
        processSheet(act, data, sheet, spreadsheet);
      }
    }
  }
View Full Code Here

Examples of org.zkoss.zss.ui.Spreadsheet

    final Map data = (Map) request.getData();
    if (data == null || data.size() != 17)
      throw new UiException(MZk.ILLEGAL_REQUEST_WRONG_DATA, new Object[] {Objects.toString(data), BlockSyncCommand.class });

    Spreadsheet spreadsheet = ((Spreadsheet) comp);
    SpreadsheetInCtrl ctrl = ((SpreadsheetInCtrl) spreadsheet.getExtraCtrl());

    String sheetId = (String) data.get("sheetId");
    int dpWidth = (Integer) data.get("dpWidth");// pixel value of data panel width
    int dpHeight = (Integer) data.get("dpHeight");// pixel value of data panel height
    int viewWidth = (Integer) data.get("viewWidth");// pixel value of view width(scrollpanel.clientWidth)
View Full Code Here

Examples of org.zkoss.zss.ui.Spreadsheet

   
    final Map data = (Map) request.getData();
    if (data == null || data.size() != 5)
      throw new UiException(MZk.ILLEGAL_REQUEST_WRONG_DATA, new Object[] {Objects.toString(data), SelectSheetCommand.class });
   
    Spreadsheet spreadsheet = ((Spreadsheet) comp);
    String sheetId = (String) data.get("sheetId");
    int left = (Integer) data.get("left");
    int right = (Integer) data.get("right");
    int top = (Integer) data.get("top");
    int bottom = (Integer) data.get("bottom");
   
    Worksheet sheet = spreadsheet.getSelectedSheet();
   
    if (sheetId.equals(((SheetCtrl)sheet).getUuid())) {
      final SpreadsheetCtrl spreadsheetCtrl = ((SpreadsheetCtrl) spreadsheet.getExtraCtrl());
     
      JSONObject mainBlock = spreadsheetCtrl.getRangeAttrs(sheet, SpreadsheetCtrl.Header.BOTH, SpreadsheetCtrl.CellAttribute.ALL, left, top, right, bottom);
      if (spreadsheet.getColumnfreeze() >= 0) {
        mainBlock.put("leftFrozen",
            spreadsheetCtrl.getRangeAttrs(sheet, SpreadsheetCtrl.Header.BOTH, SpreadsheetCtrl.CellAttribute.ALL, 0, top, spreadsheet.getColumnfreeze(), bottom));
      }
      if (spreadsheet.getRowfreeze() >= 0) {
        mainBlock.put("topFrozen",
            spreadsheetCtrl.getRangeAttrs(sheet, SpreadsheetCtrl.Header.BOTH, SpreadsheetCtrl.CellAttribute.ALL, left, 0, right, spreadsheet.getRowfreeze()));
      }
      spreadsheet.smartUpdate("activeRangeUpdate", mainBlock);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.