예제 #1
0
 private static void setThemeStyles(
     IWorkbook workbook,
     IStyleSheet styleSheet,
     ISheet sheet,
     IStyle theme,
     String... sheetStyleNames) {
   IStyle sheetTheme = theme.getDefaultStyle(Styles.FAMILY_MAP);
   if (sheetTheme == null) return;
   IStyle sheetStyle = styleSheet.findStyle(sheet.getStyleId());
   if (sheetStyle != null) {
     sheetStyle =
         Core.getWorkbookBuilder().createWorkbook().getStyleSheet().importStyle(sheetStyle);
   }
   String value = null;
   for (String styleName : sheetStyleNames) {
     value = sheetTheme.getProperty(styleName);
     if (value != null) {
       if (sheetStyle == null)
         sheetStyle =
             Core.getWorkbookBuilder()
                 .createWorkbook()
                 .getStyleSheet()
                 .createStyle(sheet.getStyleType());
       sheetStyle.setProperty(styleName, value);
     } else if (sheetStyle != null) {
       sheetStyle.setProperty(styleName, value);
     }
   }
   if (sheetStyle != null) {
     sheetStyle = workbook.getStyleSheet().importStyle(sheetStyle);
     if (sheetStyle != null) {
       sheet.setStyleId(sheetStyle.getId());
     }
   }
 }
예제 #2
0
  @Before
  public void setUp() throws Exception {
    IMarkerSheet globalMarkers;
    InputStream markerSheetStream =
        new URL("platform:/plugin/org.xmind.core.runtime.tests/samples/markers.xml").openStream();
    try {
      globalMarkers = Core.getMarkerSheetBuilder().loadFromStream(markerSheetStream, null);
    } finally {
      markerSheetStream.close();
    }
    IInputSource source =
        new BundleResourceInputSource(
            "org.xmind.core.runtime.tests", "/samples/sample1.xmind"); // $NON-NLS-2$
    workbook = Core.getWorkbookBuilder().loadFromInputSource(source, new ByteArrayStorage(), null);
    workbook.getMarkerSheet().setParentSheet(globalMarkers);

    axisProvider = new CoreAxisProvider();
  }
예제 #3
0
 private ITopic createDummyTopic(IBranchPart sourceBranch, boolean newTopic) {
   ITopic topic;
   if (sourceBranch == null && newTopic) {
     ITopic centralTopic = (ITopic) viewer.getAdapter(ITopic.class);
     topic = centralTopic.getOwnedWorkbook().createTopic();
     centralTopic.add(topic, ITopic.DETACHED);
   } else if (sourceBranch != null) {
     ITopic sourceTopic = sourceBranch.getTopic();
     topic = sourceTopic.getOwnedWorkbook().createTopic();
     topic.setTitleText(sourceTopic.getTitleText());
     topic.setStyleId(sourceTopic.getStyleId());
     topic.setTitleWidth(sourceTopic.getTitleWidth());
     ((TopicImpl) topic).setCoreEventSupport(new CoreEventSupport());
   } else {
     topic = Core.getWorkbookBuilder().createWorkbook().createTopic();
   }
   return topic;
 }