Browse Source

Pull request #6080: REPORT-57806 主题获取

Merge in DESIGN/design from ~STARRYI/design:REPORT-57806 to feature/x

* commit '6e1d2ba1aa9c0e764824e5189c730e665b88922f':
  REPORT-57806 主题获取
  REPORT-57806 主题获取
research/11.0
starryi 3 years ago
parent
commit
75765f1ec5
  1. 3
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  2. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java
  3. 17
      designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java

3
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java

@ -117,8 +117,7 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
popupMenu.setBackground(UIConstants.DEFAULT_BG_RULER);
OnlineShareWidget widget = getWidget();
OnlineShareWidget parentPackage = widget.getParentPackage();
String suitableThemeFile = parentPackage != null ? parentPackage.getThemePath() : null;
String suitableThemeFile = widget.getThemePath();
if (StringUtils.isNotEmpty(suitableThemeFile)) {
popupMenu.add(new DownloadSuitableThemeAction(suitableThemeFile).createMenuItem());
}

6
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java

@ -159,10 +159,10 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
@Override
public void populateBean(PreviewWidgetBlock<OnlineShareWidget> block) {
OnlineShareWidget widget = block.getWidget();
OnlineShareWidget parentPackage = widget.getParentPackage();
if (parentPackage != null && StringUtils.isNotEmpty(parentPackage.getThemeName())) {
String themeName = widget.getThemeName();
if (StringUtils.isNotEmpty(themeName)) {
suitableThemeNamePane.setVisible(true);
suitableThemeNameLabel.setText(parentPackage.getThemeName());
suitableThemeNameLabel.setText(themeName);
} else {
suitableThemeNamePane.setVisible(false);
}

17
designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe.share.util;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateTheme;
import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.PluginConstants;
import com.fr.form.share.base.CancelCheck;
@ -15,7 +14,6 @@ import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReaderHelper;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException;
import com.fr.third.org.apache.http.HttpEntity;
import com.fr.third.org.apache.http.HttpException;
import com.fr.third.org.apache.http.HttpStatus;
@ -30,11 +28,12 @@ import com.fr.third.org.apache.http.impl.client.HttpClients;
import org.jetbrains.annotations.NotNull;
import javax.crypto.Cipher;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.security.KeyFactory;
import java.security.interfaces.RSAPublicKey;
@ -147,8 +146,16 @@ public class DownloadUtils {
}
if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
HttpEntity entity = fileRes.getEntity();
InputStream content = entity.getContent();
XMLableReader reader = XMLReaderHelper.createXMLableReader(content, XMLPrintWriter.XML_ENCODER);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(entity.getContent()));
StringBuilder stringBuilder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line);
}
String content = stringBuilder.toString();
XMLableReader reader = XMLReaderHelper.createXMLableReader(new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)), XMLPrintWriter.XML_ENCODER);
FormTheme theme = new FormTheme();
reader.readXMLObject(theme);

Loading…
Cancel
Save