!33481 Fix: 通用规范告警整改

Merge pull request !33481 from yangziyong/0518_codeformat
This commit is contained in:
openharmony_ci 2024-05-31 05:54:35 +00:00 committed by Gitee
commit 3ff03bfc0f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 100 additions and 52 deletions

View File

@ -283,7 +283,7 @@ class TreeViewTheme {
@Observed
export class NodeInfo {
private childNodeInfo: childNodeInfo;
imageSource: Resource | string | undefined = '';
public imageSource: Resource | string | undefined = '';
private parentNodeId: number;
private currentNodeId: number;
private nodeHeight: Resource | number;
@ -300,7 +300,7 @@ export class NodeInfo {
private isShowTitle: boolean;
private isShowInputText: boolean;
private isSelected: boolean;
readonly borderWidth: borderWidth =
public readonly borderWidth: borderWidth =
{ has: BORDER_WIDTH_HAS/* 2vp */, none: BORDER_WIDTH_NONE/* 0vp */ }
/* parameter of the drag event.*/
private nodeParam: NodeParam;
@ -669,7 +669,7 @@ export enum TreeListenType {
* @since 11
*/
export class TreeListener {
_events: [(callbackParam: CallbackParam) => void] | [] = [];
public _events: [(callbackParam: CallbackParam) => void] | [] = [];
_once_events: [(callbackParam: CallbackParam) => void] | [] = [];
constructor() {
@ -815,7 +815,7 @@ export class TreeListener {
* @since 11
*/
export class TreeListenerManager {
static readonly APP_KEY_EVENT_BUS = 'app_key_event_bus';
public static readonly APP_KEY_EVENT_BUS = 'app_key_event_bus';
private appEventBus: TreeListener;
private constructor() {
@ -1076,8 +1076,16 @@ export struct TreeView {
}
if (this.listNodeDataSource.getLastIndex() !== -1 && index !== this.listNodeDataSource.getLastIndex()) {
this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS, InputError.NONE, false, this.listNodeDataSource.getLastIndex());
this.listNodeDataSource.setItemVisibilityOnEdit(this.listNodeDataSource.getLastIndex(), MenuOperation.COMMIT_NODE);
this.listNodeDataSource.setPopUpInfo(
PopUpType.WARNINGS,
InputError.NONE,
false,
this.listNodeDataSource.getLastIndex()
);
this.listNodeDataSource.setItemVisibilityOnEdit(
this.listNodeDataSource.getLastIndex(),
MenuOperation.COMMIT_NODE
);
}
})
}
@ -1138,7 +1146,10 @@ export struct TreeView {
let nodeHeight: number = LIST_ITEM_HEIGHT;
/* flag the position of the focus on the node. */
let flag: Flag = Math.floor(event.getY() / (nodeHeight / FLAG_NUMBER)) % FLAG_NUMBER ? Flag.DOWN_FLAG : Flag.UP_FLAG;
let flag: Flag = Math.floor(
event.getY() /
(nodeHeight / FLAG_NUMBER)) %
FLAG_NUMBER ? Flag.DOWN_FLAG : Flag.UP_FLAG;
/* Record the node position to which the dragged node moves. */
let index: number = JSON.parse(extraParams).insertIndex;
@ -1332,13 +1343,15 @@ export struct TreeView {
this.listNodeDataSource.listNode[this.viewLastIndex].getNodeItem()
.imageNode?.setImageSource(InteractionStatus.Normal);
this.listNodeDataSource.listNode[this.viewLastIndex].imageSource = this.listNodeDataSource.listNode[this.viewLastIndex].getNodeItem()
this.listNodeDataSource.listNode[this.viewLastIndex].imageSource =
this.listNodeDataSource.listNode[this.viewLastIndex].getNodeItem()
.imageNode?.source;
}
}
if (this.listNodeDataSource.listNode[this.viewLastIndex]) {
this.listNodeDataSource.listNode[this.viewLastIndex].setNodeColor($r('sys.color.ohos_id_color_background_transparent'));
this.listNodeDataSource.listNode[this.viewLastIndex]
.setNodeColor($r('sys.color.ohos_id_color_background_transparent'));
}
this.listNodeDataSource.lastIndex = currentFocusIndex;
@ -1579,7 +1592,7 @@ function findCurrentNodeIndex(listNodeDataSource: ListNodeDataSource, currentNod
* @since 11
*/
export class TreeController {
readonly ROOT_NODE_ID: number = -1;
public readonly ROOT_NODE_ID: number = -1;
private nodeIdList: number[] = [];
private listNodeUtils: ListNodeUtils = new ListNodeUtils();
private listNodeDataSource: ListNodeDataSource = new ListNodeDataSource();
@ -1620,7 +1633,12 @@ export class TreeController {
}
let parentNodeId: number = this.listNodeUtils.findParentNodeId(clickNodeId);
let removeNodeIdList: number[] = this.listNodeUtils.removeNode(clickNodeId, parentNodeId);
this.listNodeDataSource.refreshData(this.listNodeUtils, MenuOperation.REMOVE_NODE, parentNodeId, removeNodeIdList);
this.listNodeDataSource.refreshData(
this.listNodeUtils,
MenuOperation.REMOVE_NODE,
parentNodeId,
removeNodeIdList
);
this.nodeIdList.splice(this.nodeIdList.indexOf(clickNodeId), 1);
}
@ -1663,8 +1681,16 @@ export class TreeController {
});
this.listNodeDataSource.refreshData(this.listNodeUtils, MenuOperation.ADD_NODE, clickNodeId, [newNodeId]);
this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS, InputError.NONE, false, this.listNodeDataSource.getLastIndex());
this.listNodeDataSource.setItemVisibilityOnEdit(this.listNodeDataSource.getLastIndex(), MenuOperation.COMMIT_NODE);
this.listNodeDataSource.setPopUpInfo(
PopUpType.WARNINGS,
InputError.NONE,
false,
this.listNodeDataSource.getLastIndex()
);
this.listNodeDataSource.setItemVisibilityOnEdit(
this.listNodeDataSource.getLastIndex(),
MenuOperation.COMMIT_NODE
);
this.listNodeDataSource.listNode[this.listNodeDataSource.getLastIndex()]
.setFontColor(this.treeViewTheme.primaryTitleFontColor);
let newNodeIndex: number = findCurrentNodeIndex(this.listNodeDataSource, newNodeId);
@ -1729,7 +1755,12 @@ export class TreeController {
}
if (!this.initBuild && nodeParam.parentNodeId !== undefined) {
let newNodeId: number = this.nodeIdList[this.nodeIdList.length - 1];
this.listNodeDataSource.refreshData(this.listNodeUtils, MenuOperation.ADD_NODE, nodeParam.parentNodeId, [newNodeId]);
this.listNodeDataSource.refreshData(
this.listNodeUtils,
MenuOperation.ADD_NODE,
nodeParam.parentNodeId,
[newNodeId]
);
}
return this;
}
@ -1843,22 +1874,23 @@ class BasicDataSource implements IDataSource {
}
class ListNodeDataSource extends BasicDataSource {
readonly ROOT_NODE_ID = -1;
public readonly ROOT_NODE_ID = -1;
public listNodeUtils: ListNodeUtils = new ListNodeUtils();
listNode: NodeInfo[] = [];
public listNode: NodeInfo[] = [];
private readonly INITIAL_INVALID_VALUE = -1;
public lastIndex: number = -1; // record the last focused node.
thisIndex: number = -1; // records clicked nodes in the current period.
public thisIndex: number = -1; // records clicked nodes in the current period.
private modifyNodeIndex: number = -1; // records the nodes edited in the current period.
modifyNodeId: number = -1;
public modifyNodeId: number = -1;
private currentOperation?: MenuOperation;
private expandAndCollapseInfo: Map<number, NodeStatus> = new Map<number, NodeStatus>();
loadedNodeIdAndIndexMap: Map<number, number> = new Map<number, number>(); // [currentNodeId, index]
public loadedNodeIdAndIndexMap: Map<number, number> = new Map<number, number>(); // [currentNodeId, index]
private isTouchDown: boolean = false;
private appEventBus: TreeListener = TreeListenerManager.getInstance().getTreeListener();
/* parameter of the drag event. */
private isInnerDrag: boolean = false; // Judge whether it is an internal drag event.
private isDrag: boolean = false; // It is used to handle events(For example, prevent press events) during global drag.
// It is used to handle events(For example, prevent press events) during global drag.
private isDrag: boolean = false;
private draggingCurrentNodeId: number = this.INITIAL_INVALID_VALUE; // Record the current ID of the dragged node.
private draggingParentNodeId: number = this.INITIAL_INVALID_VALUE; // Record the parent ID of the dragged node.
private currentNodeInfo: NodeInfo | null = null; // To solve the problem of currentIndex missed in onDrop event.
@ -1866,15 +1898,18 @@ class ListNodeDataSource extends BasicDataSource {
private lastPassIndex: number = this.INITIAL_INVALID_VALUE; // record the last passing node index in drag.
private lastPassId?: number = this.INITIAL_INVALID_VALUE; // record the last passing node Id in drag.
private thisPassIndex: number = this.INITIAL_INVALID_VALUE; // record the current passing node in drag.
private lastDelayExpandIndex: number = this.INITIAL_INVALID_VALUE; // record last passing node in delay expand event.
// record last passing node in delay expand event.
private lastDelayExpandIndex: number = this.INITIAL_INVALID_VALUE;
private timeoutExpandId: number = this.INITIAL_INVALID_VALUE;
private lastTimeoutExpandId: number = this.INITIAL_INVALID_VALUE;
private clearTimeoutExpandId: number = this.INITIAL_INVALID_VALUE;
private timeoutHighLightId: number = this.INITIAL_INVALID_VALUE;
private lastTimeoutHighLightId: number = this.INITIAL_INVALID_VALUE;
private clearTimeoutHighLightId: number = this.INITIAL_INVALID_VALUE;
private lastDelayHighLightIndex: number = this.INITIAL_INVALID_VALUE; // record last passing node in HighLight event.
private lastDelayHighLightId: number = this.INITIAL_INVALID_VALUE; //record last passing node Id in HighLight event.
// record last passing node in HighLight event.
private lastDelayHighLightIndex: number = this.INITIAL_INVALID_VALUE;
//record last passing node Id in HighLight event.
private lastDelayHighLightId: number = this.INITIAL_INVALID_VALUE;
private nodeIdAndSubtitleMap: Map<number, ResourceStr> = new Map<number, ResourceStr>(); // [currentNodeId, subtitle]
private flag: Flag = Flag.NONE;
private selectedParentNodeId: number = this.INITIAL_INVALID_VALUE;
@ -1884,7 +1919,7 @@ class ListNodeDataSource extends BasicDataSource {
private lastFocusNodeId: number = this.INITIAL_INVALID_VALUE;
private addFocusNodeId: number = this.INITIAL_INVALID_VALUE;
public treeViewTheme: TreeViewTheme = new TreeViewTheme();
readonly FLAG_LINE: flagLine = {
public readonly FLAG_LINE: flagLine = {
flagLineHeight: FLAG_LINE_HEIGHT,
flagLineColor: $r('sys.color.ohos_id_color_emphasize'),
xOffset: X_OFF_SET,
@ -2005,7 +2040,7 @@ class ListNodeDataSource extends BasicDataSource {
childNum[0] = thisIndex + 1;
let index: number = 1;
while (index < tmp[thisIndex].getChildNodeInfo().childNum) {
childNum[index] = childNum[index -1] + tmp[childNum[index - 1]].getChildNodeInfo().allChildNum + 1;
childNum[index] = childNum[index - 1] + tmp[childNum[index - 1]].getChildNodeInfo().allChildNum + 1;
index++;
}
if (rootNodeStatus === NodeStatus.Expand) {
@ -2858,8 +2893,9 @@ class ListNodeDataSource extends BasicDataSource {
if (this.flag === Flag.DOWN_FLAG && this.expandAndCollapseInfo.get(rearCurrentNodeId) === NodeStatus.Expand) {
parentNodeId = rearCurrentNodeId;
insertChildIndex = 0;
} else if (this.flag === Flag.UP_FLAG && this.expandAndCollapseInfo.get(rearCurrentNodeId) === NodeStatus.Expand
&& this.listNode[i].getCanShowFlagLine() === false) {
} else if (this.flag === Flag.UP_FLAG && this.expandAndCollapseInfo.get(rearCurrentNodeId) ===
NodeStatus.Expand &&
this.listNode[i].getCanShowFlagLine() === false) {
parentNodeId = rearCurrentNodeId;
insertChildIndex = 0;
} else if (isHighLight) {
@ -3212,8 +3248,7 @@ export struct TreeViewInner {
isInvalidError = true;
this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS,
InputError.INVALID_ERROR, true, thisIndex);
}
else {
} else {
res = value;
isInvalidError = false;
}
@ -3224,8 +3259,7 @@ export struct TreeViewInner {
isLengthError = true;
this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS,
InputError.LENGTH_ERROR, true, thisIndex);
}
else {
} else {
isLengthError = false;
}
if (!isLengthError && !isInvalidError) {
@ -3234,7 +3268,12 @@ export struct TreeViewInner {
})
.onSubmit((enterKey: EnterKeyType) => {
let thisIndex: number = findCurrentNodeIndex(this.listNodeDataSource, this.item.getNodeCurrentNodeId());
this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS, InputError.NONE, false, thisIndex);
this.listNodeDataSource.setPopUpInfo(
PopUpType.WARNINGS,
InputError.NONE,
false,
thisIndex
);
this.listNodeDataSource.setItemVisibilityOnEdit(thisIndex, MenuOperation.COMMIT_NODE);
})
}.backgroundColor(this.item.getNodeItem().inputText?.backgroundColor)
@ -3340,8 +3379,16 @@ export struct TreeViewInner {
}
if (this.listNodeDataSource.getLastIndex() !== -1 && thisIndex !== this.listNodeDataSource.getLastIndex()) {
this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS, InputError.NONE, false, this.listNodeDataSource.getLastIndex());
this.listNodeDataSource.setItemVisibilityOnEdit(this.listNodeDataSource.getLastIndex(), MenuOperation.COMMIT_NODE);
this.listNodeDataSource.setPopUpInfo(
PopUpType.WARNINGS,
InputError.NONE,
false,
this.listNodeDataSource.getLastIndex()
);
this.listNodeDataSource.setItemVisibilityOnEdit(
this.listNodeDataSource.getLastIndex(),
MenuOperation.COMMIT_NODE
);
}
this.lastIndex = thisIndex;
this.count--;
@ -3404,12 +3451,12 @@ export struct TreeViewInner {
export class NodeItem {
private nodeItem: nodeItem;
private childNodeInfo: childNodeInfo;
container: () => void;
nodeLevel: number;
parentNodeId: number;
currentNodeId: number;
children: Array<NodeItem>;
data: NodeParam;
public container: () => void;
public nodeLevel: number;
public parentNodeId: number;
public currentNodeId: number;
public children: Array<NodeItem>;
public data: NodeParam;
constructor(data: NodeParam) {
this.data = data;
@ -3646,7 +3693,7 @@ export class ImageNode extends NodeBaseInfo {
class MainTitleNode extends NodeBaseInfo {
private mainTitleName: ResourceStr;
mainTitleSetting: textSetting;
public mainTitleSetting: textSetting;
private showPopUpTimeout: number;
public treeViewTheme: TreeViewTheme = new TreeViewTheme();
@ -3777,7 +3824,7 @@ export class InputText extends NodeBaseInfo {
export class ListNodeUtils {
private _root: NodeItem;
public addNewNodeId: number;
private readonly MaxNodeLevel = 50;
private readonly maxNodeLevel = 50;
private readonly MAX_CN_LENGTH: number = 254;
private readonly MAX_EN_LENGTH: number = 255;
private readonly INITIAL_INVALID_VALUE = -1;
@ -3795,7 +3842,8 @@ export class ListNodeUtils {
}
traverseNodeDF(callback: (currentNode: NodeItem) => boolean, root: NodeItem = this._root) {
let stack: Array<NodeItem> = [], found: boolean = false;
let stack: Array<NodeItem> = [];
let found: boolean = false;
stack.unshift(root);
let currentNode: NodeItem = stack.shift() as NodeItem;
while (!found && currentNode) {
@ -3878,7 +3926,7 @@ export class ListNodeUtils {
this.traverseNodeBF(callback);
if (parent) {
let currentNode: NodeItem = new NodeItem(data as NodeParam);
if (parent.nodeLevel > this.MaxNodeLevel) {
if (parent.nodeLevel > this.maxNodeLevel) {
throw new Error('ListNodeUtils[addNode]: The level of the tree view cannot exceed 50.');
}
currentNode.nodeLevel = parent.nodeLevel + 1; // nodeLevel
@ -4014,7 +4062,7 @@ export class ListNodeUtils {
return [];
} else if (parent.children.length > 0) {
let nodeInfo: nodeInfo = { itemId: undefined, itemIcon: undefined, itemTitle: undefined }
let childrenNodeInfo: Array<number> = new Array(parent.children.length);
let childrenNodeInfo: number[] = new Array(parent.children.length);
for (let i: number = 0; i < childrenNodeInfo.length; i++) {
childrenNodeInfo[i] = 0;
}
@ -4041,7 +4089,7 @@ export class ListNodeUtils {
if (parent.children.length === 0) {
return [];
} else if (parent.children.length > 0) {
let childrenNodeInfo: Array<nodeInfo> = new Array(parent.children.length);
let childrenNodeInfo: nodeInfo[] = new Array(parent.children.length);
for (let i: number = 0; i < childrenNodeInfo.length; i++) {
childrenNodeInfo[i] = {};
}
@ -4078,7 +4126,8 @@ export class ListNodeUtils {
*/
dragTraverseNodeDF(callback: (node: NodeItem, listNode: NodeInfo[]) => boolean,
root: NodeItem = this._root, listNode: NodeInfo[]) {
let stack: Array<NodeItem> = [], found: boolean = false;
let stack: Array<NodeItem> = [];
let found: boolean = false;
stack.unshift(root);
let currentNode: NodeItem = stack.shift() as NodeItem;
while (!found && currentNode) {
@ -4118,7 +4167,7 @@ export class ListNodeUtils {
this.traverseNodeBF(callback);
if (parent) {
let currentNode: NodeItem = new NodeItem(data);
if (parent.nodeLevel > this.MaxNodeLevel) {
if (parent.nodeLevel > this.maxNodeLevel) {
throw new Error('ListNodeUtils[addNode]: The level of the tree view cannot exceed 50.');
}
currentNode.nodeLevel = parent.nodeLevel + 1;

View File

@ -37,7 +37,6 @@
#define ARKUI_NATIVE_TYPE_H
#include <cstdint>
#include <stdint.h>
#include "drawable_descriptor.h"
@ -1911,7 +1910,7 @@ typedef enum {
*
* @since 12
*/
ArkUI_LayoutConstraint* OH_ArkUI_LayoutConstraint_Create();
ArkUI_LayoutConstraint* OH_ArkUI_LayoutConstraint_Create(void);
/**
* @brief Creates a deep copy of a size constraint.
@ -2063,7 +2062,7 @@ ArkUI_IntSize OH_ArkUI_DrawContext_GetSize(ArkUI_DrawContext* context);
* @return Returns the water flow section configuration.
* @since 12
*/
ArkUI_WaterFlowSectionOption* OH_ArkUI_WaterFlowSectionOption_Create();
ArkUI_WaterFlowSectionOption* OH_ArkUI_WaterFlowSectionOption_Create(void);
/**
* @brief Destroys the pointer to a water flow section configuration.
@ -2418,7 +2417,7 @@ int32_t OH_ArkUI_BarrierOption_GetReferencedIdSize(ArkUI_BarrierOption* barrierS
* @return Alignment rule information.
* @since 12
*/
ArkUI_AlignmentRuleOption* OH_ArkUI_AlignmentRuleOption_Create();
ArkUI_AlignmentRuleOption* OH_ArkUI_AlignmentRuleOption_Create(void);
/**
* @brief Destroys the alignment rule information of subcomponents in relative containers.