|
|
|
|
@ -637,4 +637,315 @@ public void createNoteTable(SQLiteDatabase db) {
|
|
|
|
|
private void reCreateNoteTableTriggers(SQLiteDatabase db) {
|
|
|
|
|
// 依次删除已存在的触发器,然后重新创建它们
|
|
|
|
|
// 这里省略了具体的删除和创建触发器的SQL语句,但基本逻辑是:先删除,再创建
|
|
|
|
|
}
|
|
|
|
|
}/*
|
|
|
|
|
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
|
|
|
|
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
|
|
|
|
*
|
|
|
|
|
* 这段注释声明了文件的版权信息,包括版权年份、版权所有者和使用许可。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package java.lang;
|
|
|
|
|
|
|
|
|
|
/** The CharacterData class encapsulates the large tables found in
|
|
|
|
|
Java.lang.Character. */
|
|
|
|
|
|
|
|
|
|
// 这是一个类注释,说明CharacterData类封装了Java.lang.Character中的大型表。
|
|
|
|
|
// 但注意,这里的注释可能有些误导,因为CharacterDataUndefined实际上是CharacterData的一个子类。
|
|
|
|
|
|
|
|
|
|
class CharacterDataUndefined extends CharacterData {
|
|
|
|
|
|
|
|
|
|
// CharacterDataUndefined类继承自CharacterData类。
|
|
|
|
|
|
|
|
|
|
int getProperties(int ch) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
// 返回字符ch的属性,这里总是返回0,表示没有定义任何属性。
|
|
|
|
|
|
|
|
|
|
int getType(int ch) {
|
|
|
|
|
return Character.UNASSIGNED;
|
|
|
|
|
}
|
|
|
|
|
// 返回字符ch的类型,这里总是返回Character.UNASSIGNED,表示字符未分配。
|
|
|
|
|
|
|
|
|
|
boolean isJavaIdentifierStart(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否可以作为Java标识符的起始字符,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isJavaIdentifierPart(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否可以作为Java标识符的一部分,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isUnicodeIdentifierStart(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否可以作为Unicode标识符的起始字符,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isUnicodeIdentifierPart(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否可以作为Unicode标识符的一部分,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isIdentifierIgnorable(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否是一个可忽略的标识符字符,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isEmoji(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否是一个emoji,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isEmojiPresentation(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否以emoji形式呈现,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isEmojiModifier(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否是一个emoji修饰符,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isEmojiModifierBase(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否是一个emoji修饰符基础字符,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isEmojiComponent(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否是一个emoji组件,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isExtendedPictographic(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否是一个扩展的象形文字,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
int toLowerCase(int ch) {
|
|
|
|
|
return ch;
|
|
|
|
|
}
|
|
|
|
|
// 将字符ch转换为小写形式,这里总是返回原字符,表示没有转换。
|
|
|
|
|
|
|
|
|
|
int toUpperCase(int ch) {
|
|
|
|
|
return ch;
|
|
|
|
|
}
|
|
|
|
|
// 将字符ch转换为大写形式,这里总是返回原字符,表示没有转换。
|
|
|
|
|
|
|
|
|
|
int toTitleCase(int ch) {
|
|
|
|
|
return ch;
|
|
|
|
|
}
|
|
|
|
|
// 将字符ch转换为标题形式(通常是大写),这里总是返回原字符,表示没有转换。
|
|
|
|
|
|
|
|
|
|
int digit(int ch, int radix) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
// 返回字符ch在指定基数radix下的数字值,这里总是返回-1,表示不是有效的数字。
|
|
|
|
|
|
|
|
|
|
int getNumericValue(int ch) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
// 返回字符ch的数值,这里总是返回-1,表示没有定义数值。
|
|
|
|
|
|
|
|
|
|
boolean isDigit(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否是一个数字字符,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isLowerCase(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否是小写字符,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isUpperCase(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否是大写字符,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
boolean isWhitespace(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否是空白字符,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
byte getDirectionality(int ch) {
|
|
|
|
|
return Character.DIRECTIONALITY_UNDEFINED;
|
|
|
|
|
}
|
|
|
|
|
// 返回字符ch的方向性,这里总是返回Character.DIRECTIONALITY_UNDEFINED,表示方向性未定义。
|
|
|
|
|
|
|
|
|
|
boolean isMirrored(int ch) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 判断字符ch是否是镜像字符,这里总是返回false。
|
|
|
|
|
|
|
|
|
|
static final CharacterData instance = new CharacterDataUndefined();
|
|
|
|
|
// 创建一个CharacterDataUndefined的实例,作为这个类的唯一实例。
|
|
|
|
|
|
|
|
|
|
private CharacterDataUndefined() {};
|
|
|
|
|
// 私有构造函数,防止外部创建CharacterDataUndefined的实例。
|
|
|
|
|
}<!DOCTYPE html>
|
|
|
|
|
<html lang="zh-CN">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
<title>小米便签示例</title>
|
|
|
|
|
<link rel="stylesheet" href="styles.css">
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div id="app">
|
|
|
|
|
<h1>小米便签</h1>
|
|
|
|
|
|
|
|
|
|
<!-- 便签列表的容器 -->
|
|
|
|
|
<div id="note-list">
|
|
|
|
|
<!-- 便签项将通过JavaScript动态生成并插入到这里 -->
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 新建便签的表单 -->
|
|
|
|
|
<form id="new-note-form">
|
|
|
|
|
<input type="text" id="note-title" placeholder="输入标题">
|
|
|
|
|
<textarea id="note-content" placeholder="输入内容"></textarea>
|
|
|
|
|
<button type="submit">添加便签</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script src="scripts.js"></script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
/* 基本样式重置 */
|
|
|
|
|
body, html {
|
|
|
|
|
margin: 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
font-family: Arial, sans-serif;
|
|
|
|
|
background-color: #f5f5f5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 应用容器的样式 */
|
|
|
|
|
#app {
|
|
|
|
|
width: 80%;
|
|
|
|
|
max-width: 600px;
|
|
|
|
|
margin: 20px auto;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
padding: 20px;
|
|
|
|
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 标题样式 */
|
|
|
|
|
h1 {
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 便签列表的样式 */
|
|
|
|
|
#note-list {
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 单个便签项的样式 */
|
|
|
|
|
.note {
|
|
|
|
|
border-bottom: 1px solid #ddd;
|
|
|
|
|
padding: 10px 0;
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.note:last-child {
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 便签标题的样式 */
|
|
|
|
|
.note-title {
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
color: #333;
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 便签内容的样式 */
|
|
|
|
|
.note-content {
|
|
|
|
|
color: #666;
|
|
|
|
|
word-wrap: break-word; /* 防止长单词或URL破坏布局 */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 删除按钮的样式 */
|
|
|
|
|
.delete-button {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 10px;
|
|
|
|
|
right: 10px;
|
|
|
|
|
background-color: #ff5722;
|
|
|
|
|
color: #fff;
|
|
|
|
|
border: none;
|
|
|
|
|
padding: 5px 10px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.delete-button:hover {
|
|
|
|
|
background-color: #e64a19;
|
|
|
|
|
}// 获取页面元素
|
|
|
|
|
const noteList = document.getElementById('note-list');
|
|
|
|
|
const newNoteForm = document.getElementById('new-note-form');
|
|
|
|
|
const noteTitleInput = document.getElementById('note-title');
|
|
|
|
|
const noteContentInput = document.getElementById('note-content');
|
|
|
|
|
|
|
|
|
|
// 存储便签数据的数组
|
|
|
|
|
let notes = [];
|
|
|
|
|
|
|
|
|
|
// 渲染便签列表到页面
|
|
|
|
|
function renderNotes() {
|
|
|
|
|
noteList.innerHTML = ''; // 清空现有便签
|
|
|
|
|
notes.forEach((note, index) => {
|
|
|
|
|
// 创建一个新的便签项div
|
|
|
|
|
const noteElement = document.createElement('div');
|
|
|
|
|
noteElement.className = 'note';
|
|
|
|
|
|
|
|
|
|
// 创建标题元素并添加到便签项中
|
|
|
|
|
const titleElement = document.createElement('div');
|
|
|
|
|
titleElement.className = 'note-title';
|
|
|
|
|
titleElement.textContent = note.title;
|
|
|
|
|
noteElement.appendChild(titleElement);
|
|
|
|
|
|
|
|
|
|
// 创建内容元素并添加到便签项中
|
|
|
|
|
const contentElement = document.createElement('div');
|
|
|
|
|
contentElement.className = 'note-content';
|
|
|
|
|
contentElement.textContent = note.content;
|
|
|
|
|
noteElement.appendChild(contentElement);
|
|
|
|
|
|
|
|
|
|
// 创建删除按钮并添加到便签项中
|
|
|
|
|
const deleteButton = document.createElement('button');
|
|
|
|
|
deleteButton.className = 'delete-button';
|
|
|
|
|
deleteButton.textContent = '删除';
|
|
|
|
|
deleteButton.addEventListener('click', () => {
|
|
|
|
|
// 从数组中移除便签并重新渲染列表
|
|
|
|
|
notes.splice(index, 1);
|
|
|
|
|
renderNotes();
|
|
|
|
|
});
|
|
|
|
|
noteElement.appendChild(deleteButton);
|
|
|
|
|
|
|
|
|
|
// 将便签项添加到列表中
|
|
|
|
|
noteList.appendChild(noteElement);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 提交新便签的表单事件监听器
|
|
|
|
|
newNoteForm.addEventListener('submit', (event) => {
|
|
|
|
|
event.preventDefault(); // 阻止表单的默认提交行为
|
|
|
|
|
|
|
|
|
|
// 获取表单输入的值
|
|
|
|
|
const title = noteTitleInput.value.trim();
|
|
|
|
|
const content = noteContentInput.value.trim();
|
|
|
|
|
|
|
|
|
|
// 检查标题和内容是否为空
|
|
|
|
|
if (title && content) {
|
|
|
|
|
// 创建一个新的便签对象并添加到数组中
|
|
|
|
|
const newNote = { title, content };
|
|
|
|
|
notes.push(newNote);
|
|
|
|
|
|
|
|
|
|
// 清空表单输入
|
|
|
|
|
noteTitleInput.value = '';
|
|
|
|
|
noteContentInput.value = '';
|
|
|
|
|
|
|
|
|
|
// 重新渲染便签列表
|
|
|
|
|
renderNotes();
|
|
|
|
|
} else {
|
|
|
|
|
alert('标题和内容都不能为空!');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 初始化渲染便签列表(在加载页面时调用)
|
|
|
|
|
renderNotes();
|