From 1f913baa7ae49ca192f66c6126a283361d8fef0c Mon Sep 17 00:00:00 2001 From: Elaine Tan <51374241+etantg@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:36:11 +0800 Subject: [PATCH] IDEMPIERE-6217 An Error Occurred While Uploading the CSV File as an Attachment (#2443) --- .../io/keikai/ui/au/in/TextHeightCommand.java | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 org.idempiere.keikai/src/io/keikai/ui/au/in/TextHeightCommand.java diff --git a/org.idempiere.keikai/src/io/keikai/ui/au/in/TextHeightCommand.java b/org.idempiere.keikai/src/io/keikai/ui/au/in/TextHeightCommand.java new file mode 100644 index 0000000000..a9e57206da --- /dev/null +++ b/org.idempiere.keikai/src/io/keikai/ui/au/in/TextHeightCommand.java @@ -0,0 +1,73 @@ +/* CellFetchCommand.java + +{{IS_NOTE + Purpose: + + Description: + + History: + January 10, 2008 03:10:40 PM , Created by Dennis.Chen +}}IS_NOTE + +Copyright (C) 2007 Potix Corporation. All Rights Reserved. + +{{IS_RIGHT + This program is distributed under Lesser GPL Version 2.1 in the hope that + it will be useful, but WITHOUT ANY WARRANTY. +}}IS_RIGHT +*/ +package io.keikai.ui.au.in; + + +import java.util.Map; + +import io.keikai.api.model.Sheet; +import io.keikai.model.impl.AbstractCellAdv; +import io.keikai.ui.Spreadsheet; +import org.zkoss.lang.Objects; +import org.zkoss.zk.au.AuRequest; +import org.zkoss.zk.mesg.MZk; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.UiException; + +/** + * A Command (client to server) for fetch data back + * @author Dennis.Chen + * + */ +public class TextHeightCommand extends AbstractCommand implements Command { + public final static String Command = "onZSSTextHeight"; + + //-- super --// + public void process(AuRequest request) { + final Component comp = request.getComponent(); + if (comp == null) + throw new UiException(MZk.ILLEGAL_REQUEST_COMPONENT_REQUIRED, TextHeightCommand.class.getCanonicalName()); + + final Map data = (Map) request.getData(); + if (data == null || data.size() != 4) + throw new UiException(MZk.ILLEGAL_REQUEST_WRONG_DATA, new Object[] {Objects.toString(data), TextHeightCommand.class.getCanonicalName() }); + + String sheetId = (String) data.get("sheetId"); + Sheet sheet = ((Spreadsheet) comp).getSelectedSheet(); + if (!getSheetUuid(sheet).equals(sheetId)) + return; + + int row = 0; + Object obj = data.get("row"); + if (obj instanceof Number) + row = ((Number) obj).intValue(); + + int col = 0; + obj = data.get("col"); + if (obj instanceof Number) + col = ((Number) obj).intValue(); + + int height = 0; + obj = data.get("height"); + if (obj instanceof Number) + height = ((Number) obj).intValue(); + + ((AbstractCellAdv)sheet.getInternalSheet().getCell(row, col)).setTextHeight(height); + } +} \ No newline at end of file