Browse Source

REPORT-107972 设计器样式翻新 CheckBox翻新

newui
Levy.Xie-解安森 1 year ago
parent
commit
6021cbfcc6
  1. 10
      designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java
  2. 27
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  3. 6
      designer-base/src/main/resources/com/fr/design/images/newui/check-hovered.svg
  4. 20
      designer-base/src/main/resources/com/fr/design/images/newui/checked.svg
  5. 6
      designer-base/src/main/resources/com/fr/design/images/newui/not-checked.svg
  6. 19
      designer-base/src/main/resources/com/fr/design/standard/checkbox/checked.svg
  7. 7
      designer-base/src/main/resources/com/fr/design/standard/checkbox/checked_disable.svg
  8. 6
      designer-base/src/main/resources/com/fr/design/standard/checkbox/hovered.svg
  9. 6
      designer-base/src/main/resources/com/fr/design/standard/checkbox/part_checked.svg
  10. 6
      designer-base/src/main/resources/com/fr/design/standard/checkbox/unchecked.svg
  11. 6
      designer-base/src/main/resources/com/fr/design/standard/checkbox/unchecked_disable.svg

10
designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java

@ -61,8 +61,14 @@ public class FineLightIconSet extends AbstractIconSet {
new SvgIconSource("vcs_list", "com/fr/design/standard/vcslist/vcs_list.svg", true), new SvgIconSource("vcs_list", "com/fr/design/standard/vcslist/vcs_list.svg", true),
new SvgIconSource("view_folder", "com/fr/design/standard/viewfolder/view_folder.svg", true), new SvgIconSource("view_folder", "com/fr/design/standard/viewfolder/view_folder.svg", true),
new SvgIconSource("refresh", "com/fr/design/standard/refresh.svg", true), new SvgIconSource("refresh", "com/fr/design/standard/refresh.svg", true),
new SvgIconSource("new_folder", "com/fr/design/standard/newfolder/new_folder.svg", true) new SvgIconSource("new_folder", "com/fr/design/standard/newfolder/new_folder.svg", true),
); // CheckBox相关Icon
new SvgIconSource("checkbox_checked", "com/fr/design/standard/checkbox/checked.svg", true),
new SvgIconSource("checkbox_unchecked", "com/fr/design/standard/checkbox/unchecked.svg", true),
new SvgIconSource("checkbox_part_checked", "com/fr/design/standard/checkbox/part_checked.svg", true),
new SvgIconSource("checkbox_hovered", "com/fr/design/standard/checkbox/hovered.svg", true)
);
} }
} }

27
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java

@ -1,13 +1,11 @@
package com.fr.design.gui.icheckbox; package com.fr.design.gui.icheckbox;
import com.fr.design.constants.UIConstants; import com.fine.theme.icon.LazyIcon;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.core.UITextComponent; import com.fr.design.gui.core.UITextComponent;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
@ -144,7 +142,7 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
* *
* @return UICheckBoxUI * @return UICheckBoxUI
*/ */
public UICheckBoxUI getUICheckBoxUI(){ public UICheckBoxUI getUICheckBoxUI() {
return new UICheckBoxUI(); return new UICheckBoxUI();
} }
@ -176,28 +174,15 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
b.getVerticalTextPosition(), b.getHorizontalTextPosition(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
viewRect, iconRect, textRect, b.getIconTextGap()); viewRect, iconRect, textRect, b.getIconTextGap());
// fill background
if (c.isOpaque()) {
g.setColor(b.getBackground());
g.fillRect(0, 0, size.width, size.height);
}
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (model.isSelected()) { if (model.isSelected()) {
GUIPaintUtils.fillPaint(g2d, iconRect.x, iconRect.y, iconRect.width, iconRect.height, false, Constants.NULL, new LazyIcon("checkbox_checked").paintIcon(c, g, iconRect.x, iconRect.y);
model.isEnabled() ? UIConstants.CHECKBOX_HOVER_SELECTED : UIConstants.DISABLED_ICON_COLOR, 0); } else if (model.isRollover()) {
} else if (model.isRollover() && !model.isSelected()) { new LazyIcon("checkbox_hovered").paintIcon(c, g, iconRect.x, iconRect.y);
g.setColor(UIConstants.CHECKBOX_HOVER_SELECTED);
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);
} else { } else {
g.setColor(UIConstants.LINE_COLOR); new LazyIcon("checkbox_unchecked").paintIcon(c, g, iconRect.x, iconRect.y);
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);
} }
if (model.isSelected()) {
UIConstants.YES_ICON.paintIcon(c, g, iconRect.x + 2, iconRect.y + 2);
}
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
// Draw the Text // Draw the Text

6
designer-base/src/main/resources/com/fr/design/images/newui/check-hovered.svg

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 32 32" fill="none">
<rect x="6" y="6" width="20" height="20" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd"
d="M26 6H6L6 26H26V6ZM6 4C4.89543 4 4 4.89543 4 6V26C4 27.1046 4.89543 28 6 28H26C27.1046 28 28 27.1046 28 26V6C28 4.89543 27.1046 4 26 4H6Z"
fill="#2576EF"/>
</svg>

After

Width:  |  Height:  |  Size: 391 B

20
designer-base/src/main/resources/com/fr/design/images/newui/checked.svg

@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 32 32" fill="none">
<rect x="5" y="5" width="22" height="22" rx="1" fill="#2576EF" stroke="#2576EF" stroke-width="2"/>
<g filter="url(#filter0_d_102_12520)">
<path d="M10.7071 17.2929C10.3166 16.9024 9.68342 16.9024 9.29289 17.2929C8.90237 17.6834 8.90237 18.3166 9.29289 18.7071L13.2929 22.7071C13.7391 23.1533 14.482 23.0798 14.8321 22.5547L22.8321 10.5547C23.1384 10.0952 23.0142 9.47432 22.5547 9.16796C22.0952 8.86161 21.4743 8.98579 21.1679 9.44531L13.8446 20.4304L10.7071 17.2929Z"
fill="white"/>
</g>
<defs>
<filter id="filter0_d_102_12520" x="8" y="8.99991" width="16.0001" height="16.0002" filterUnits="userSpaceOnUse"
color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="0.5"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.0901961 0 0 0 0 0.341176 0 0 0 0 0.776471 0 0 0 0.5 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_102_12520"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_102_12520" result="shape"/>
</filter>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

6
designer-base/src/main/resources/com/fr/design/images/newui/not-checked.svg

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 32 32" fill="none">
<rect x="6" y="6" width="20" height="20" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd"
d="M26 6H6L6 26H26V6ZM6 4C4.89543 4 4 4.89543 4 6V26C4 27.1046 4.89543 28 6 28H26C27.1046 28 28 27.1046 28 26V6C28 4.89543 27.1046 4 26 4H6Z"
fill="#C0C7D0"/>
</svg>

After

Width:  |  Height:  |  Size: 391 B

19
designer-base/src/main/resources/com/fr/design/standard/checkbox/checked.svg

@ -0,0 +1,19 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="&#231;&#138;&#182;&#230;&#128;&#129;=&#229;&#183;&#178;&#233;&#128;&#137;,&#229;&#141;&#149;&#233;&#128;&#137;=false">
<rect id="Rectangle 157" x="4" y="4" width="24" height="24" rx="1" fill="#2576EF" stroke="#2576EF" stroke-width="2"/>
<g id="Path 2" filter="url(#filter0_d_102_12520)">
<path d="M9.95096 17.4776C9.50465 17.0313 8.78104 17.0313 8.33473 17.4776C7.88842 17.9239 7.88842 18.6475 8.33473 19.0938L12.9061 23.6652C13.4161 24.1752 14.2651 24.0911 14.6651 23.491L23.8079 9.7769C24.1581 9.25173 24.0161 8.54218 23.491 8.19206C22.9658 7.84195 22.2562 7.98386 21.9061 8.50903L13.5366 21.0632L9.95096 17.4776Z" fill="white"/>
</g>
</g>
<defs>
<filter id="filter0_d_102_12520" x="7" y="8" width="18" height="18" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="0.5"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.0901961 0 0 0 0 0.341176 0 0 0 0 0.776471 0 0 0 0.5 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_102_12520"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_102_12520" result="shape"/>
</filter>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

7
designer-base/src/main/resources/com/fr/design/standard/checkbox/checked_disable.svg

@ -0,0 +1,7 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="&#231;&#138;&#182;&#230;&#128;&#129;=&#229;&#183;&#178;&#233;&#128;&#137;&#231;&#166;&#129;&#231;&#148;&#168;, &#229;&#141;&#149;&#233;&#128;&#137;=false">
<rect id="Rectangle 36" x="5" y="5" width="22" height="22" fill="#F2F4F8"/>
<path id="Rectangle 157 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M27 5H5L5 27H27V5ZM5 3C3.89543 3 3 3.89543 3 5V27C3 28.1046 3.89543 29 5 29H27C28.1046 29 29 28.1046 29 27V5C29 3.89543 28.1046 3 27 3H5Z" fill="#CFD4DC"/>
<path id="Path 2" d="M9.95096 17.4776C9.50465 17.0313 8.78104 17.0313 8.33473 17.4776C7.88842 17.9239 7.88842 18.6475 8.33473 19.0938L12.9061 23.6652C13.4161 24.1752 14.2651 24.0911 14.6651 23.491L23.8079 9.7769C24.1581 9.25173 24.0161 8.54218 23.491 8.19206C22.9658 7.84195 22.2562 7.98386 21.9061 8.50903L13.5366 21.0632L9.95096 17.4776Z" fill="#B8BFCB"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 938 B

6
designer-base/src/main/resources/com/fr/design/standard/checkbox/hovered.svg

@ -0,0 +1,6 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="&#231;&#138;&#182;&#230;&#128;&#129;=&#230;&#130;&#172;&#230;&#181;&#174;,&#229;&#141;&#149;&#233;&#128;&#137;=false">
<rect id="Rectangle 36" x="5" y="5" width="22" height="22" fill="white"/>
<path id="Rectangle 35" fill-rule="evenodd" clip-rule="evenodd" d="M27 5H5L5 27H27V5ZM5 3C3.89543 3 3 3.89543 3 5V27C3 28.1046 3.89543 29 5 29H27C28.1046 29 29 28.1046 29 27V5C29 3.89543 28.1046 3 27 3H5Z" fill="#2576EF"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 531 B

6
designer-base/src/main/resources/com/fr/design/standard/checkbox/part_checked.svg

@ -0,0 +1,6 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="&#231;&#138;&#182;&#230;&#128;&#129;=&#233;&#131;&#168;&#229;&#136;&#134;&#233;&#128;&#137;&#229;&#174;&#154;,&#229;&#141;&#149;&#233;&#128;&#137;=false">
<path id="Rectangle 157 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M27 5H5L5 27H27V5ZM5 3C3.89543 3 3 3.89543 3 5V27C3 28.1046 3.89543 29 5 29H27C28.1046 29 29 28.1046 29 27V5C29 3.89543 28.1046 3 27 3H5Z" fill="#2576EF"/>
<rect id="Rectangle 36" x="8" y="8" width="16" height="16" rx="1" fill="#2576EF"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 586 B

6
designer-base/src/main/resources/com/fr/design/standard/checkbox/unchecked.svg

@ -0,0 +1,6 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="&#231;&#138;&#182;&#230;&#128;&#129;=&#230;&#173;&#163;&#229;&#184;&#184;,&#229;&#141;&#149;&#233;&#128;&#137;=false">
<rect id="Rectangle 158" x="4" y="4" width="24" height="24" fill="white"/>
<path id="Rectangle 35" fill-rule="evenodd" clip-rule="evenodd" d="M27 5H5L5 27H27V5ZM5 3C3.89543 3 3 3.89543 3 5V27C3 28.1046 3.89543 29 5 29H27C28.1046 29 29 28.1046 29 27V5C29 3.89543 28.1046 3 27 3H5Z" fill="#B8BFCB"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 532 B

6
designer-base/src/main/resources/com/fr/design/standard/checkbox/unchecked_disable.svg

@ -0,0 +1,6 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="&#231;&#138;&#182;&#230;&#128;&#129;=&#230;&#156;&#170;&#233;&#128;&#137;&#231;&#166;&#129;&#231;&#148;&#168;, &#229;&#141;&#149;&#233;&#128;&#137;=false">
<path id="Rectangle 157 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M27 5H5L5 27H27V5ZM5 3C3.89543 3 3 3.89543 3 5V27C3 28.1046 3.89543 29 5 29H27C28.1046 29 29 28.1046 29 27V5C29 3.89543 28.1046 3 27 3H5Z" fill="#CFD4DC"/>
<rect id="Rectangle 36" x="5" y="5" width="22" height="22" fill="#F2F4F8"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 580 B

Loading…
Cancel
Save